2014-04-01 18:00:42 +00:00
< ? php
/** Adminer - Compact database management
* @ link http :// www . adminer . org /
* @ author Jakub Vrana , http :// www . vrana . cz /
* @ 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 )
2015-04-01 06:36:56 +00:00
* @ version 4.2 . 1
*/ error_reporting ( 6135 ); $Jc =! preg_match ( '~^(unsafe_raw)?$~' , ini_get ( " filter.default " )); if ( $Jc || ini_get ( " filter.default_flags " )){ foreach ( array ( '_GET' , '_POST' , '_COOKIE' , '_SERVER' ) as $X ){ $Gh = filter_input_array ( constant ( " INPUT $X " ), FILTER_UNSAFE_RAW ); if ( $Gh ) $$X = $Gh ;}} 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 " ); 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
2015-04-01 06:36:56 +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> <05> <> މb<DE89> <62> /<2F> <> HB%<25> 0<EFBFBD> <30> ><3E> <> <EFBFBD> hoW<6F> nxl ֍<> 浃CQ^<5E> <> <16> <> <EFBFBD> <EFBFBD> <EFBFBD> \r <EFBFBD> <11> <> <EFBFBD> 4lK{ <EFBFBD> Z<EFBFBD> <EFBFBD> :<3A> <> <EFBFBD> Ã<> .<2E> p<EFBFBD> <70> Ă<EFBFBD> J<EFBFBD> B-<2D> + B<> <42> <11> (<06> T<EFBFBD> <54> %<25> <> J<EFBFBD> 0<05> l<02> T<EFBFBD> `+<2B> -<01> <> @B<> <1D> ۄV<DB84> <56> <1C> \0 <EFBFBD> <EFBFBD> C<EFBFBD> ,<18> <> 0t<30> <74> <EFBFBD> F<EFBFBD> <46> <EFBFBD> ?Ġ<> \n a@Ɍ><3E> <> ZEC<45> <43> O<> -<2D> <19> <> ^ Q<> &<26> <08> <> )I)<29> <> <EFBFBD> <EFBFBD> <EFBFBD> R<EFBFBD> ] \r <EFBFBD> <EFBFBD> 9<EFBFBD> 7_<18> <> \r <EFBFBD> F80<EFBFBD> O b<> <09> <> <EFBFBD> ><3E> <> <EFBFBD> \n R<> _<EFBFBD> <5F> 8<> <38> <EFBFBD> ٫ <EFBFBD> ov0<76> b CA<43> F!<21> t<EFBFBD> <74> ă% 0<> /<2F> zAYO( 4<> <34> <EFBFBD> <EFBFBD> <EFBFBD> <14> '<27> ] I<> <49> 8hH<08> 05<30> 3<05> @x&n<> <6E> |T<> <1C> <06> ) `<60> .<2E> s6e Y<> D<EFBFBD> z<EFBFBD> <7A> <EFBFBD> <12> <> Jѓ<4A> <D193> .<2E> <> { GEb<0E> <> Ӌ<EFBFBD> <D38B> <EFBFBD> <EFBFBD> 2<EFBFBD> <05> { \$ **<2A> <01> @<40> C<11> <> -:z YHZI<5A> <49> 5F]<5D> <> Y<EFBFBD> <59> C<> O<EFBFBD> A<> <12> <0E> <> `x'<27> .*9t ' { <EFBFBD> (<28> <> wP<77> <50> <EFBFBD> <EFBFBD> =<0F> *<0E> <> <EFBFBD> *<2A> xwr<77> <19> *c<> <63> <EFBFBD> c|<7C> D<EFBFBD> <44> <EFBFBD> V<EFBFBD> <56> \r <EFBFBD> V.<2E> 0<EFBFBD> <30> <0C> V<EFBFBD> d<EFBFBD> ?Ҁ<> <D280> ,E͝`T<> <54> 6ۈ-<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> ڎT[ѐ<> z<> <15> .Ar<41> <72> ̀ P<> <50> n<EFBFBD> c= a<> 9 F<> n<EFBFBD> !<21> u<EFBFBD> <75> A<> <41> <0E> 0i P<> <50> <EFBFBD> <EFBFBD> <EFBFBD> J6e<0B> T]V<> [\r X<EFBFBD> <EFBFBD> a<EFBFBD> <EFBFBD> v<0B> k <6B> \n +E<> <45> <0F> ܕ* \0 <EFBFBD> ~<7E> <16> <> @g\" <EFBFBD> N CI\$ <EFBFBD> <EFBFBD> Ɍ<EFBFBD> <EFBFBD> <EFBFBD> x@W<> y<EFBFBD> *vuD<75> \0 <EFBFBD> v<EFBFBD> 댆V\0 <EFBFBD> V`G<1E> <> u<EFBFBD> E<EFBFBD> ֕<EFBFBD> <D695> f<EFBFBD> l<EFBFBD> h<EFBFBD> @<40> )0@<40> T<EFBFBD> <54> 7<EFBFBD> <37> <1B> §RA<52> ٷ<EFBFBD> <D9B7> 3ۘ<33> <11> /Q<> ]<5D> ,s<> { VR<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> F<18> <> <EFBFBD> A<> <41> <<3C> vץ<76> <D7A5> %@9<> <39> F<EFBFBD> <46> 5t<35> %<25> +<2B> /<0E> 8;<3B> W<EFBFBD> <57> <EFBFBD> <EFBFBD> J<1B> <> o:<3A> N<EFBFBD> `<08> <09> <> <EFBFBD> <EFBFBD> h<EFBFBD> <68> { ܣ<> <DCA3> <20> Ԑ8<D490> Eu<19> &<26> W| Ɇ<> <C986> <EFBFBD> U<EFBFBD> &\r \" <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> |-udž<75> N<EFBFBD> <03> :nc<6E> <63> fV<14> <> <EFBFBD> <C28D> # U 2 0<> >\" <EFBFBD> <04> <> ><3E> `<60> k]<5D> -<2D> <> x<EFBFBD> S<EFBFBD> ͇Т<16> <> <EFBFBD> <EFBFBD> c<EFBFBD> <63> <15> B<> <42> }<12> &`<60> <> r+E<> <45> \$ <EFBFBD> yN<EFBFBD> <EFBFBD> <EFBFBD> b,<2C> <> <EFBFBD> Wx <20> <03> -9<> <39> r<EFBFBD> ,<2C> <> `<60> +<2B> <> <EFBFBD> ˊ <> <CB8A> C<EFBFBD> <43> )<29> <> 7<02> x\r <EFBFBD> <EFBFBD> W<EFBFBD> fM<EFBFBD> SR<EFBFBD> \\ <EFBFBD> z<05> <> Q<> ̓<EFBFBD> <CC93> u A<> <41> <EFBFBD> 2<EFBFBD> <32> <EFBFBD> 4<EFBFBD> L&<26> Hi µ<> <C2B5> <EFBFBD> S\$ )e<> <65> <EFBFBD> g rȌ<72> <12> \$ ]Z<> iYs<59> <73> <17> kW<6B> n><3E> 7E1k 8<> d<EFBFBD> r<EFBFBD> <72> <EFBFBD> k<1B> <> <EFBFBD> <08> E<EFBFBD> <45> <EFBFBD> w<1C> wc m<> Ty<54> <79> <EFBFBD> <EFBFBD> <EFBFBD> a<EFBFBD> \$ tx \r B<05> <> =<3D> <> <EFBFBD> <EFBFBD> *<05> <<07> <1C> <> l<01> f<> K<EFBFBD> <4B> N/<2F> <> <03> <09> l<> <6C> <EFBFBD> kH<6B> <10> 8<EFBFBD> .<2E> <> <EFBFBD> ?f<> <1E> <> <16> <> 6<EFBFBD> ч<EFBFBD> { gi/ \" <EFBFBD> @<40> <11> K<> <4B> @2<> <32> a|#,Z<> <5A> <EFBFBD> <09> <> w<EFBFBD> d<EFBFBD> <64> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 6w<36> ^& <> <7F> t<EFBFBD> <74> <EFBFBD> P<11> <> <EFBFBD> <EFBFBD> <EFBFBD> ]<5D> <0E> <> .<2E> <> <EFBFBD> <0E> <> T<11> <> kro<72> <6F> <EFBFBD> <EFBFBD> \r o=<3D> %<25> <> h`: \0 ᱂<EFBFBD> <EFBFBD> <0B> <> |ꊣ<> a<0C> Ԯ 6*:<04> <> *<2A> <> rO-^<5E> <> <EFBFBD> <EFBFBD> n<EFBFBD> <6E> <EFBFBD> <EFBFBD> M<EFBFBD> }<7D> <> <EFBFBD> <EFBFBD> Aya<79> <61> <EFBFBD> \n <EFBFBD> u^<5E> <> <EFBFBD> rnO\r <EFBFBD> <EFBFBD> <EFBFBD> `<60> T~< /<2F> <> w<EFBFBD> y<EFBFBD> }<7D> :<07> |<7C> <> <07> <> <EFBFBD> ̡6<CCA1> <36> <EFBFBD> <12> <> <EFBFBD> v<EFBFBD> \r c <<3C> b#<23> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \$ <EFBFBD> s<EFBFBD> <EFBFBD> |燇 V)<29> h<EFBFBD> T C<> <43> (Ľ<> <16> <> ]6<> <36> 1<15> !1M<31> <4D> @a<> /<2F> `<60> >ٸ<> ߣ<EFBFBD> <DFA3> <EFBFBD> <EFBFBD> <EFBFBD> C/<2F> 6ഷ #p @p<0B> <> <EFBFBD> <EFBFBD> `Z<> <0F> <> ch<63> <68> \0 <0B> <> \0 o<EFBFBD> <EFBFBD> <EFBFBD> 4O<34> O<> i \0 - \n <EFBFBD> <0F> <> /<2F> \0 <EFBFBD> D<0E> .<2E> <20> <> <EFBFBD> .<2E> Đ\0 f i<08> <> ȫ<EFBFBD> <C8AB> <EFBFBD> \0 <EFBFBD> <EFBFBD> ID<EFBFBD> <0F> \0 <EFBFBD> <EFBFBD> \r <EFBFBD> <EFBFBD> 0f<0E> <> o<> <02> <> <03> <> G<EFBFBD> <47> <EFBFBD> <EFBFBD> e J|\r <EFBFBD> <EFBFBD> <0F> l <08> 3<08> ~<0B> i P<> <07> &<26> <> <02> /<2F> \0 <EFBFBD> 9 ^\0 r<EFBFBD> 0]<02> <> <20> o<> <0C> .<2E> \" <EFBFBD> <09> <> <EFBFBD> M<04> <> <0B> v<EFBFBD> P<EFBFBD> Z<EFBFBD> <5A> m p<> P<0E> <> <03> ڜ<EFBFBD> ޏ<08> <0F> <> { <EFBFBD> <EFBFBD> C ?<02> <> k<EFBFBD> <6B> ϼ}<7D> <> <EFBFBD> d<EFBFBD> <0C> ʏ <EFBFBD> ~=<3D> .<2E> <10> - <20> <09> m 1> h<> <0E> <> Е 1; QI<13> O P<> \r <EFBFBD> <EFBFBD> c<07> pA pV<08> k\r Q*<0B> Q}<15> <> <10> q><3E> <> u<10> 15<11> Bq Q[ 1f<31> <66> l<EFBFBD> <6C> <05> a p<> <12> <> \0 <EFBFBD> <08> *<2A> J<EFBFBD> Q=<1B> <> <08> <> <19> G<11> <0B> <0E> <> <02> <10> <> <18> _<13> <> <19> b<EFBFBD> GH F.<2E> 0<EFBFBD> <30> = 2 P<14> <> <EFBFBD> <01> <> <0B> <14> <> P !<21> # (3 \n <EFBFBD> !1&7 2f<32> <66> `<60> /<2F> <> \0 <EFBFBD> <EFBFBD> \" P<EFBFBD> U<0F> \$ <EFBFBD> \r 0<> <0B> <> , Q rU&2f<32> <66> _<1F> X<0B> <> <0C> ]<0E> 9\" <EFBFBD> S'<27> <> '<27> y<05> 8\r <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> k W)O<> )<29> <> *Ra%<25> \\ i<> %<25> <> &ҳ+r<> <0E> 3<1A> S `<60> ,<2C> v<EFBFBD> <76> &2<> L<> &Pu*<2A> <> -<2D> <> 0\" <EFBFBD> %HĬ Ԟ<> <D49E> @ؓ<> <D893> H<EFBFBD> B<EFBFBD> P(<28> <11> \$ p&<26> ,1 M<> <20> ح<EFBFBD> <08> ; \r n<EFBFBD> .<2E> <> I<> .<10> ',1<02> <> )<29> 4<EFBFBD> <34> <EFBFBD> 2<EFBFBD> u+<2B> 3<08> <> `<60> S<0C> <> pL \n t<EFBFBD> <EFBFBD> _*<2A> S 3;6r<36> 'h35<33> 55䜋d 2q+6<> <36> 8<EFBFBD> O7sC \" pm8ҭ<0E> <> 6<EFBFBD> <36> 9<EFBFBD> m \n @e0<65> <8B<38> 8<EFBFBD> <,(<28> <> <EFBFBD> 8<03> <> \0 <EFBFBD> <09> 0<EFBFBD> J<EFBFBD> <@<40> <> I<EFBFBD> <49> <EFBFBD> R6pԭm G<> \" 11<EFBFBD> 6<EFBFBD> <EFBFBD> . \" <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 5̂<EFBFBD> <04> :<3A> <> 8b<38> A1<41> ;<3B> ';<3B> ?< *\$ <13> ,<2C> ̍o = <20> T<EFBFBD> <54> /3<> #<23> <> ҆<EFBFBD> " );} 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 a<> <61> <EFBFBD> < \\ 8 Cz<43> <7A> \r <EFBFBD> <EFBFBD> ^<17> <> <EFBFBD> ]<0F> 1\\ 7<EFBFBD> C8_ E p^<1F> <> <EFBFBD> <EFBFBD> M1<4D> w \" ' 4f<34> S X9ES|䛅<> k 3<> B@<40> <> <EFBFBD> Xa=No4t7<74> <37> dD3<44> p<> <13> <13> <> : ) \\ ;<3B> <03> <> <EFBFBD> <06> \r )8H<38> <48> 44Pc= \n <EFBFBD> !pd<1A> <> QN\r <EFBFBD> H<EFBFBD> '<27> <> <EFBFBD> <EFBFBD> 2<EFBFBD> #\" եm-<2D> b,<1A> <09> M.<2E> <> <EFBFBD> -IK<49> )<29> <> e'<27> <> \" <EFBFBD> <0C> <> >2X<32> œe<C593> j:9^<5E> 1c<31> <63> <EFBFBD> ȝ<EFBFBD> :Y<> @<40> u<EFBFBD> 㓛 4<> X<EFBFBD> &<26> <> |<7C> )ђ<> <D192> -K<> x<> <78> <0B> <> S<> <53> 1<EFBFBD> <31> \$ <EFBFBD> <07> @\\ <15> !x]\0 <EFBFBD> <EFBFBD> <1D> <05> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> F<15> CO<43> :<13> 1 K<> <4B> *<2A> F4 a<> <61> <16> k<EFBFBD> <6B> <0C> KϚ<4B> <CF9A> <EFBFBD> <1C> 2l<32> p<EFBFBD> 3J<<3C> <> ,2<> <32> 8#<23> <20> <> \r <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <14> <> h<18> <> <EFBFBD> <EFBFBD> F<EFBFBD> <46> ݉2P<10> <> <1C> <> l (<28> \$ ְ \n J۷ -<2D> <> ǰcc~<7E> F<1B> <> <1E> r<EFBFBD> <72> t b<> <62> <EFBFBD> m { h<EFBFBD> .<2E> { <EFBFBD> t k<> B<07> Kc<4B> z4<7A> C<EFBFBD> 9<> ۫~><0F> <> <EFBFBD> <14> <> `Ɠ<> C <> s:<3A> <> <EFBFBD> !c<> <63> <04> ڵ<EFBFBD> *W<> HX:W<> <10> ;N<> <14> <> j*<2A> /(<28> _p3<70> <33> HI<04> Kl<4B> n! t r<> <72> G㭺<47> t C<> v<> ?m㤣<6D> <E3A4A3> <EFBFBD> <EFBFBD> <EFBFBD> \0 C<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> oܥcbf6I<EFBFBD> <EFBFBD> ' \r <EFBFBD> b<EFBFBD> <EFBFBD> 7h<EFBFBD> `<60> <> 9<EFBFBD> i<EFBFBD> d5<64> <35> taM<61> ={ ɩ <EFBFBD> <EFBFBD> `NoK<6F> !d4<64> <02> zWXd mH<6D> <48> *<2A> <> <1A> S ]<5D> <> 3&\0 ڰ d% A<> -<2D> <> <09> <> (<28> <> <EFBFBD> <16> <> <EFBFBD> <12> Q<> }<7D> <> <EFBFBD> U !t7<0B> 䋆<EFBFBD> >x<> <78> t { mY<EFBFBD> <EFBFBD> 0<EFBFBD> @^<5E> <> \" <EFBFBD> =<0C> <> <EFBFBD> @t\r <EFBFBD> <EFBFBD> <EFBFBD> <02> + Y<> .<06> <> <EFBFBD> X<EFBFBD> \n <EFBFBD> I'KT<4B> <02> ^ (<07> D. @<40> <0C> <> ++@<40> 3<EFBFBD> <33> <EFBFBD> X<EFBFBD> aE<61> ! ,<2C> Y<EFBFBD> <59> 2- 432Ԍ <0B> MO<4D> <4F> I\$ q% ċG<C48B> X9<58> <39> <EFBFBD> [R \0 n<EFBFBD> <EFBFBD> и P<EFBFBD> Jy \r <20> B<EFBFBD> p \\ H<EFBFBD> pgSɼ<15> F aejk<6A> . 4<> <34> C.^<5E> yi<79> <69> 9<EFBFBD> PĈe \" ΔNY<EFBFBD> <EFBFBD> <EFBFBD> BH<EFBFBD> # 8<> B1 \" <EFBFBD> j\\ کx<EFBFBD> <EFBFBD> #<23> <> @G 9<> 2<EFBFBD> <14> f.Ќps r<> TJ<54> x<EFBFBD> k<> <6B> <12> 4KIl<49> f<EFBFBD> 8z<38> <7A> Kȇ>AK<41> <4B> <EFBFBD> n^<5E> <> = &<26> <1D> A<EFBFBD> <1D> * ?'<27> <0B> ^%;<12> <> 4܀<34> <DC80> <EFBFBD> 9<10> <> Q<EFBFBD> <51> h<EFBFBD> N<EFBFBD> <4E> >M<> = ['<27> vHI<48> J<EFBFBD> <4A> <1F> <> <EFBFBD> v<EFBFBD> <76> <EFBFBD> R<EFBFBD> t<19> <> <<3C> <> Ҳ<EFBFBD> ^<5E> <> z<EFBFBD> B^<5E> h<EFBFBD> '<07> <12> ɩ <EFBFBD> )-'#<23> <> 9JT<4A> )<29> @jO!<21> <1B> c,e<> j<EFBFBD> <6A> <EFBFBD> <EFBFBD> @H,<2C> <> <EFBFBD> j<EFBFBD> a<EFBFBD> <01> v<EFBFBD> Z<> ><3E> <> ҷ<EFBFBD> )E` \0 \n <EFBFBD> <EFBFBD> T<EFBFBD> P<EFBFBD> 8L<<3C> c<EFBFBD> :F<> <46> <EFBFBD> \$ \n <EFBFBD> <EFBFBD> 휆<EFBFBD> <EFBFBD> CHm\" <EFBFBD> j<EFBFBD> y<> A<EFBFBD> S<EFBFBD> <53> <12> S<> <10> Q<EFBFBD> <51> <EFBFBD> <EFBFBD> <EFBFBD> <15> { T']W<> <57> U<> )_L<5F> <4C> i<EFBFBD> m<EFBFBD> O<> <4F> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <05> P: g<> { <EFBFBD> <01> Zė<5A> .<1B> { <EFBFBD> <EFBFBD> <EFBFBD> Dh\n <EFBFBD> <EFBFBD> <EFBFBD> <16> a<EFBFBD> \r ]9<> t<EFBFBD> <74> !XA<58> [Ȱ<> <C8B0> <EFBFBD> C<EFBFBD> <43> ׁ \n :<05> <13> ha<07> <> <EFBFBD> <17> \" ݢa2Lm<0C> <> <EFBFBD> \\ <09> <> p5<70> @<40> <> @m<> <6D> |W<> <57> <07> <> %<25> |u<> <75> <1D> +hK<14> L &<26> <> <20> 3<> .XW<0B> ٺ<EFBFBD> <D9BA> <EFBFBD> * q<0F> <> c<> <63> <EFBFBD> %<25> .K<> <4B> <EFBFBD> <EFBFBD> A \r <EFBFBD> xh<78> <68> <EFBFBD> I\\ <EFBFBD> <EFBFBD> d<EFBFBD> H<EFBFBD> <EFBFBD> 5\n <18> q%<25> v*<2A> <> <17> rIa<06> 0<EFBFBD> \" ]8<> k,<2C> <> A<EFBFBD> <11> { B<EFBFBD> \\ K/ p<a럈1<EB9F88> 0%<25> o 2<1B> <> Ù<EFBFBD> <0C> <> %<25> P<EFBFBD> <50> @!<21> <> i<EFBFBD> 9<EFBFBD> <39> f1<66> <31> 4<EFBFBD> <34> <EFBFBD> <EFBFBD> ap؎w<D88E> `<60> AX<41> up<75> ѽ7<D1BD> \\ L<EFBFBD> <EFBFBD> <02> <> t<EFBFBD> <74> V<07> Ɠa \$ <EFBFBD> <EFBFBD> Wҁ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> :<3A> <07> Ȉe}\r jC<EFBFBD> X<EFBFBD> <13> ]<5D> <> <EFBFBD> =m<> <6D> <EFBFBD> 8 ˺ \$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> h<EFBFBD> =<3D> K7<4B> 5<0C> <> R<EFBFBD> <52> P<EFBFBD> { rr<EFBFBD> <05> ,<2C> _<EFBFBD> Mz<4D> %ɧIZ<49> : ig<69> y% H<> 5ὂ<35> 4Q<34> fئ<66> P<> <50> l<EFBFBD> <6C> <EFBFBD> h<> <68> x<EFBFBD> <16> ꅋv<01> X& <> \$ sE<EFBFBD> <EFBFBD> <EFBFBD> 0<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 5<> <35> <EFBFBD> <EFBFBD> lW<6C> d<EFBFBD> .DH<44> \$ @<40> \r @& \r <EFBFBD> <EFBFBD> 9<EFBFBD> \0 v<EFBFBD> 7!<21> <> oӅ<6F> <D385> <1B> <> <EFBFBD> <EFBFBD> <EFBFBD> 5<EFBFBD> <35> )#X<15> i]<1A> r<> o<EFBFBD> ~<7E> <> <EFBFBD> w<EFBFBD> P<EFBFBD> <> Q<EFBFBD> =<3D> <> <EFBFBD> qC<71> <43> <EFBFBD> <EFBFBD> )<29> =<3D> #<23> <> @h'A<> tb;<3B> <> 0YDh'<02> <> \n V W }(2<> `V<> zv %<25> t<> \r Օ <EFBFBD> e<05> <> <EFBFBD> <EFBFBD> <15> <> p.끛<> <EB819B> <EFBFBD> <EFBFBD> 6H9<48> <0E> = ;n<> 8C =<3D> <09> <> <EFBFBD> <EFBFBD> q<EFBFBD> <71> @a+<2B> <1F> <> k<> 0aK<61> <4B> 3Ep<45> <70> C<EFBFBD> +<2B> A<EFBFBD> <41> Ep<45> <70> C@><3E> X<EFBFBD> <58> <EFBFBD> <EFBFBD> '<27> L<EFBFBD> <4C> <0C> { <EFBFBD> <EFBFBD> Xz<EFBFBD> <14> oD<6F> <44> %<25> sP<1D> W:[=<3D> v0<76> ?<3F> ܷ,%<25> <> <EFBFBD> { \" <19> .<2E> <> .YI<59> B<EFBFBD> <42> <EFBFBD> <09> \n Wp V<> )<29> <> <EFBFBD> q<EFBFBD> A<EFBFBD> <41> M<> V<> <18> 5<16> <> I<EFBFBD> <49> <EFBFBD> P<EFBFBD> <50> ο ˎ<CEBF> <CB8E> <EFBFBD> <EFBFBD> <08> (<28> b.<2E> \$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> [Қ<> j<> <6A> @<40> <> h\n F<EFBFBD> -4<0C> 8nj<6E> <6A> +VM<56> xnj<6E> <6A> mb \$ <EFBFBD> <20> <> <EFBFBD> <02> \n <EFBFBD> <EFBFBD> <EFBFBD> '<27> ~<05> <> Z @<40> <0B> <> <EFBFBD> <EFBFBD> V<05> <> <04> L\" <EFBFBD> <08> p<EFBFBD> <70> 5<EFBFBD> <35> O,<2C> <> <EFBFBD> \0 K<EFBFBD> \0 <EFBFBD> <EFBFBD> <EFBFBD> -6<> \r :<3A> p<16> DbՐn<D590> <6E> \$ <EFBFBD> mm\$ i )<29> O<EFBFBD> 6 (<28> <03> A PI<04> P+<2B> VHpn<70> <6E> 4?B<> M<EFBFBD> <4D> <EFBFBD> <EFBFBD> JF<4A> <46> .<2E> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 0<EFBFBD> <30> +<2B> i<EFBFBD> j<EFBFBD> P<> <50> (<28> &<26> <> <EFBFBD> a<> <61> %l]'<27> <> <EFBFBD> ^ @ (<28> 5<EFBFBD> N fs<66> <73> <05> c<> <07> b z <20> <> <0E> ><3E> <0F> <0F> x<EFBFBD> <78> \0 k <20> Đ \r <a<> X<EFBFBD> G<EFBFBD> <0B> { \r oL<EFBFBD> <EFBFBD> x<EFBFBD> &<26> <13> <> \$ <06> HjĨ1<C4A8> <31> <09> <> <<3C> l-<2D> <> <EFBFBD> <EFBFBD> \r <EFBFBD> G KO<07> <07> 0<1A> q +c P<05> j\r <EFBFBD> ̶<EFBFBD> <EFBFBD> j<> <17> <> <02> <> <11> bd<04> <> 6<EFBFBD> <36> \0 <EFBFBD> s<EFBFBD> ࢎ<EFBFBD> f<> ж<> z<EFBFBD> <7A> j><3E> <06> J<EFBFBD> <4A> <EFBFBD> <EFBFBD> <EFBFBD> H<EFBFBD> <05> '<13> <> 3<EFBFBD> <33> <0C> (F<05> т<> <0C> <> z<EFBFBD> `O q<> <71> <EFBFBD> X<07> <19> `<60> r\r <20> 1 ,<2C> <> <0E> gk lv<6C> <76> |+<2B> <14> <06> kf<6B> '<27> = R@<40> 4<> 6<EFBFBD> `<60> -<2D> .i~4<> #<08> < \$ <EFBFBD> R<EFBFBD> |u2N;Bn<<3C> -#<23> { %<25> <> <EFBFBD> <EFBFBD> b=<3D> <> #<23> <> (<28> J1b% g<> <67> <EFBFBD> z<EFBFBD> <7A> <EFBFBD> <EFBFBD> <7F> G2<47> 1 ^ 8w<10> <> b^ % /<2F> <20> <06> G<EFBFBD> *<2A> <> 7D \0 ^<18> r<EFBFBD> c<EFBFBD> <63> p \n <0E> <> L,<0C> <> 0<> + Xr<58> \$ <20> 8<EFBFBD> <38> <EFBFBD> -) +(D<> <44> <05> <> <EFBFBD> <EFBFBD> <EFBFBD> \n <EFBFBD> <02> <> b<EFBFBD> <62> <0C> s 1<> <31> 2G\\ { <EFBFBD> <EFBFBD> .I~ `<60> *<2A> <14> l]<10> <0F> N<EFBFBD> <4E> <10> X .#%\$ K<EFBFBD> <EFBFBD> S'3<> <10> <> 6<> \$ Cr<EFBFBD> C0B<30> \r <EFBFBD> --H|<7C> <> <EFBFBD> Ȇ<> ,<2C> \" <EFBFBD> 57Ӓ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> T<EFBFBD> <EFBFBD> <EFBFBD> )<29> n<EFBFBD> <0B> <> <EFBFBD> ĸ<EFBFBD> <C4B8> /2<> L<> <0F> a7<61> 2K<32> 1/ d\" <EFBFBD> 4SH<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <0C> ͌<EFBFBD> <CD8C> <13> <> 1<04> <> <EFBFBD> \0 O6R8|S|+<2B> r<EFBFBD> Ӳ<EFBFBD> <D3B2> <EFBFBD> <04> <> \$ O \r e(<28> <> <EFBFBD> \r \" 8<EFBFBD> <EFBFBD> <EFBFBD> ӎ<> s<EFBFBD> \r <EFBFBD> <EFBFBD> 2<EFBFBD> <EFBFBD> <05> ! *<2A> mNTQ<54> <51> <EFBFBD> <EFBFBD> <EFBFBD> ]jk+1 5<> R<07> h<13> 1<EFBFBD> Q<10> z `p<> <12> R<> E -S<> <53> S\r 1@vo.t<> TUFq E<> <45> ;g \\ <EFBFBD> \" DQ<EFBFBD> `<04> <> <EFBFBD> <EFBFBD> sI<73> v`<60> <> 0<EFBFBD> <30> +K<> <4B> pT<70> <54> )|<7C> l<EFBFBD> <6C> <08> <> 8%'<27> L<14> LJ @ \r &+<2B> <20> ԃ<> X<EFBFBD> <02> <> <EFBFBD> <EFBFBD> &<26> t<EFBFBD> <74> \\ *'4<> <34> NƣO\0 <EFBFBD> OT<EFBFBD> Db\r 1<EFBFBD> <EFBFBD> PL \0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> gM<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \" O><3E> <> <04> C<tJ<0E> N<EFBFBD> -:<<3C> <> <EFBFBD> \" V]`<60> /B<> <42> <EFBFBD> *ܧ<> -<2D> w<1f<31> M<EFBFBD> <4D> <EFBFBD> <EFBFBD> q<EFBFBD> 8<EFBFBD> -<2D> o<EFBFBD> ~pK<70> <4B> d<EFBFBD> <09> <> <0B> <> \n <EFBFBD> <EFBFBD> ,4<> WF<57> \$ ƺnl \0 ٭ <EFBFBD> L<03> \n <EFBFBD> <EFBFBD> <11> m<> <08> )<29> Z<EFBFBD> <5A> ZɆ<5A> <13> <15> ^@<40> <09> <> .<2E> <> j<EFBFBD> D<EFBFBD> ]K`<60> <> <EFBFBD> <EFBFBD> t\r <EFBFBD> <EFBFBD> '\$ ^S '<27> O]<5D> <> Sдؓ<D0B4> 5<16> <13> <0C> b%<15> \\ <EFBFBD> <EFBFBD> \$ <EFBFBD> L<EFBFBD> V au<61> Z<EFBFBD> <0E> U<EFBFBD> ]<15> <> <EFBFBD> |EM<45> <4D> <EFBFBD> <EFBFBD> ]i<> ]<5D> <> 9<EFBFBD> 1d f.eP\r <EFBFBD> <EFBFBD> !<21> s)Uj <20> <0E> W)\" <EFBFBD> &BSŕ'<27> ~<7E> vps _ '_f<5F> uT 5G0<47> 5r<vzl<7A> <6C> h<15> r<EFBFBD> <72> <0B> YiqMD<07> <> Uqf<71> Ԝ /<2F> <> <EFBFBD> <EFBFBD> ;o<> \r <1A> T<EFBFBD> <54> <EFBFBD> <EFBFBD> <EFBFBD> `{ \0 r<0C> Ӕ \n <EFBFBD> <EFBFBD> U!<21> յ<> \" i<EFBFBD> (<28> <0B> P<EFBFBD> <16> v<EFBFBD> <76> Ң<EFBFBD> i0<69> i<EFBFBD> <69> O<> <4F> <EFBFBD> <EFBFBD> <EFBFBD> <0F> <> <EFBFBD> // <20> \r U<EFBFBD> r \" <EFBFBD> <EFBFBD> Q<EFBFBD> <EFBFBD> \n \0 <EFBFBD> :<03> <> E<EFBFBD> n<> k<EFBFBD> <6B> #~R<> \" <EFBFBD> en<1E> <20> <02> tJ<74> <07> <> ;<3B> P <09> Uu<55> Ctg<74> t L<05> <> 8d\0 <EFBFBD> @<40> l `w<> ~ <20> <> xw<78> b<> <09> <> J <20> <> <EFBFBD> vn\n <EFBFBD> <EFBFBD> , u;<3B> <02> uu<75> .<2E> V< o &|1<> <31> <1E> Q|e/|<7C> <> HbQs<51> > w ]7<> 7 0<> <30> <EFBFBD> <EFBFBD> <EFBFBD> <04> !\" ː 4\0 z W<> 2 D<07> \\ W<EFBFBD> <2 \" <EFBFBD> <07> _ x w<> |<7C> q J<7F> &<26> e<EFBFBD> <65> <EFBFBD> <EFBFBD> <EFBFBD> 24\" qX<EFBFBD> : d6<64> <36> +<2B> <> <EFBFBD> -̓<> /<2F> <> <EFBFBD> <EFBFBD>
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
2014-04-01 18:00:42 +00:00
connection (){ global $h ; return $h ;} function
adminer (){ global $b ; return $b ;} function
2015-04-01 06:36:56 +00:00
idf_unescape ( $t ){ $Qd = substr ( $t , - 1 ); return
str_replace ( $Qd . $Qd , $Qd , substr ( $t , 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
remove_slashes ( $If , $Jc = false ){ if ( get_magic_quotes_gpc ()){ while ( list ( $x , $X ) = each ( $If )){ foreach ( $X
as $Gd => $W ){ unset ( $If [ $x ][ $Gd ]); if ( is_array ( $W )){ $If [ $x ][ stripslashes ( $Gd )] = $W ; $If [] =& $If [ $x ][ stripslashes ( $Gd )];} else $If [ $x ][ stripslashes ( $Gd )] = ( $Jc ? $W : stripslashes ( $W ));}}}} function
bracket_escape ( $t , $Na = false ){ static $th = array ( ':' => ':1' , ']' => ':2' , '[' => ':3' ); return
strtr ( $t ,( $Na ? array_flip ( $th ) : $th ));} function
charset ( $h ){ return ( version_compare ( $h -> server_info , " 5.5.3 " ) >= 0 ? " utf8mb4 " : " utf8 " );} function
2014-04-01 18:00:42 +00:00
h ( $P ){ return
2015-04-01 06:36:56 +00:00
str_replace ( " \0 " , " � " , htmlspecialchars ( $P , ENT_QUOTES , 'utf-8' ));} function
2014-04-01 18:00:42 +00:00
nbsp ( $P ){ return ( trim ( $P ) != " " ? h ( $P ) : " " );} function
nl_br ( $P ){ return
str_replace ( " \n " , " <br> " , $P );} function
2015-04-01 06:36:56 +00:00
checkbox ( $C , $Y , $db , $Nd = " " , $Pe = " " , $ib = " " ){ $J = " <input type='checkbox' name=' $C ' value=' " . h ( $Y ) . " ' " . ( $db ? " checked " : " " ) . ( $Pe ? ' onclick="' . h ( $Pe ) . '"' : '' ) . " > " ; return ( $Nd != " " || $ib ? " <label " . ( $ib ? " class=' $ib ' " : " " ) . " > $J " . h ( $Nd ) . " </label> " : $J );} function
optionlist ( $Ve , $tg = null , $Oh = false ){ $J = " " ; foreach ( $Ve
as $Gd => $W ){ $We = array ( $Gd => $W ); if ( is_array ( $W )){ $J .= '<optgroup label="' . h ( $Gd ) . '">' ; $We = $W ;} foreach ( $We
as $x => $X ) $J .= '<option' . ( $Oh || is_string ( $x ) ? ' value="' . h ( $x ) . '"' : '' ) . (( $Oh || is_string ( $x ) ? ( string ) $x : $X ) === $tg ? ' selected' : '' ) . '>' . h ( $X ); if ( is_array ( $W )) $J .= '</optgroup>' ;} return $J ;} function
html_select ( $C , $Ve , $Y = " " , $Oe = true ){ if ( $Oe ) return " <select name=' " . h ( $C ) . " ' " . ( is_string ( $Oe ) ? ' onchange="' . h ( $Oe ) . '"' : " " ) . " > " . optionlist ( $Ve , $Y ) . " </select> " ; $J = " " ; foreach ( $Ve
2014-04-01 18:00:42 +00:00
as $x => $X ) $J .= " <label><input type='radio' name=' " . h ( $C ) . " ' value=' " . h ( $x ) . " ' " . ( $x == $Y ? " checked " : " " ) . " > " . h ( $X ) . " </label> " ; return $J ;} function
2015-04-01 06:36:56 +00:00
select_input ( $Ja , $Ve , $Y = " " , $vf = " " ){ return ( $Ve ? " <select $Ja ><option value=''> $vf " . optionlist ( $Ve , $Y , true ) . " </select> " : " <input $Ja size='10' value=' " . h ( $Y ) . " ' placeholder=' $vf '> " );} function
2014-04-01 18:00:42 +00:00
confirm (){ return " onclick= \" return confirm(' " . lang ( 0 ) . " '); \" " ;} function
2015-04-01 06:36:56 +00:00
print_fieldset ( $jd , $Vd , $Zh = false , $Pe = " " ){ echo " <fieldset><legend><a href='#fieldset- $jd ' onclick= \" " . h ( $Pe ) . " return !toggle('fieldset- $jd '); \" > $Vd </a></legend><div id='fieldset- $jd ' " . ( $Zh ? " " : " class='hidden' " ) . " > \n " ;} function
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
2014-04-01 18:00:42 +00:00
js_escape ( $P ){ return
addcslashes ( $P , " \r \n ' \\ / " );} function
2015-04-01 06:36:56 +00:00
json_row ( $x , $X = null ){ static $Kc = true ; if ( $Kc ) echo " { " ; if ( $x != " " ){ echo ( $Kc ? " " : " , " ) . " \n \t \" " . addcslashes ( $x , " \r \n \" \\ / " ) . '": ' . ( $X !== null ? '"' . addcslashes ( $X , " \r \n \" \\ / " ) . '"' : 'undefined' ); $Kc = false ;} else { echo " \n } \n " ; $Kc = true ;}} function
ini_bool ( $td ){ $X = ini_get ( $td ); 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
2015-04-01 06:36:56 +00:00
set_password ( $Vh , $N , $V , $G ){ $_SESSION [ " pwds " ][ $Vh ][ $N ][ $V ] = ( $_COOKIE [ " adminer_key " ] && is_string ( $G ) ? array ( encrypt_string ( $G , $_COOKIE [ " adminer_key " ])) : $G );} function
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
q ( $P ){ global $h ; return $h -> quote ( $P );} function
2014-04-01 18:00:42 +00:00
get_vals ( $H , $e = 0 ){ global $h ; $J = array (); $I = $h -> query ( $H ); if ( is_object ( $I )){ while ( $K = $I -> fetch_row ()) $J [] = $K [ $e ];} return $J ;} function
2015-04-01 06:36:56 +00:00
get_key_vals ( $H , $i = null , $jh = 0 ){ global $h ; if ( ! is_object ( $i )) $i = $h ; $J = array (); $i -> timeout = $jh ; $I = $i -> query ( $H ); $i -> timeout = 0 ; if ( is_object ( $I )){ while ( $K = $I -> fetch_row ()) $J [ $K [ 0 ]] = $K [ 1 ];} return $J ;} function
get_rows ( $H , $i = null , $n = " <p class='error'> " ){ global $h ; $ub = ( is_object ( $i ) ? $i : $h ); $J = array (); $I = $ub -> query ( $H ); if ( is_object ( $I )){ while ( $K = $I -> fetch_assoc ()) $J [] = $K ;} elseif ( ! $I &&! is_object ( $i ) && $n && defined ( " PAGE_HEADER " )) echo $n . error () . " \n " ; return $J ;} function
2014-04-01 18:00:42 +00:00
unique_array ( $K , $v ){ foreach ( $v
as $u ){ if ( preg_match ( " ~PRIMARY|UNIQUE~ " , $u [ " type " ])){ $J = array (); foreach ( $u [ " columns " ] as $x ){ if ( ! isset ( $K [ $x ])) continue
2 ; $J [ $x ] = $K [ $x ];} return $J ;}}} function
2015-04-01 06:36:56 +00:00
escape_key ( $x ){ if ( preg_match ( '(^([\w(]+)(' . str_replace ( " _ " , " .* " , preg_quote ( idf_escape ( " _ " ))) . ')([ \w)]+)$)' , $x , $B )) return $B [ 1 ] . idf_escape ( idf_unescape ( $B [ 2 ])) . $B [ 3 ]; return
idf_escape ( $x );} function
where ( $Z , $p = array ()){ global $h , $w ; $J = array (); foreach (( array ) $Z [ " where " ] as $x => $X ){ $x = bracket_escape ( $x , 1 ); $e = escape_key ( $x ); $J [] = $e . (( $w == " sql " && preg_match ( '~^[0-9]*\\.[0-9]*$~' , $X )) || $w == " mssql " ? " LIKE " . q ( addcslashes ( $X , " %_ \\ " )) : " = " . unconvert_field ( $p [ $x ], q ( $X ))); if ( $w == " sql " && preg_match ( '~char|text~' , $p [ $x ][ " type " ]) && preg_match ( " ~[^ -@]~ " , $X )) $J [] = " $e = " . q ( $X ) . " COLLATE " . charset ( $h ) . " _bin " ;} foreach (( array ) $Z [ " null " ] as $x ) $J [] = escape_key ( $x ) . " 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
where_link ( $s , $e , $Y , $Re = " = " ){ return " &where%5B $s %5D%5Bcol%5D= " . urlencode ( $e ) . " &where%5B $s %5D%5Bop%5D= " . urlencode (( $Y !== null ? $Re : " IS NULL " )) . " &where%5B $s %5D%5Bval%5D= " . urlencode ( $Y );} function
convert_fields ( $f , $p , $M = array ()){ $J = " " ; foreach ( $f
as $x => $X ){ if ( $M &&! in_array ( idf_escape ( $x ), $M )) continue ; $Ga = convert_field ( $p [ $x ]); if ( $Ga ) $J .= " , $Ga AS " . idf_escape ( $x );} return $J ;} function
cookie ( $C , $Y , $Xd = 2592000 ){ global $ba ; $F = array ( $C ,( preg_match ( " ~ \n ~ " , $Y ) ? " " : $Y ),( $Xd ? time () + $Xd : 0 ), preg_replace ( '~\\?.*~' , '' , $_SERVER [ " REQUEST_URI " ]), " " , $ba ); if ( version_compare ( PHP_VERSION , '5.2.0' ) >= 0 ) $F [] = true ; return
2014-04-01 18:00:42 +00:00
call_user_func_array ( 'setcookie' , $F );} function
restart_session (){ if ( ! ini_bool ( " session.use_cookies " )) session_start ();} function
stop_session (){ if ( ! ini_bool ( " session.use_cookies " )) session_write_close ();} function & get_session ( $x ){ return $_SESSION [ $x ][ DRIVER ][ SERVER ][ $_GET [ " username " ]];} function
set_session ( $x , $X ){ $_SESSION [ $x ][ DRIVER ][ SERVER ][ $_GET [ " username " ]] = $X ;} function
2015-04-01 06:36:56 +00:00
auth_url ( $Vh , $N , $V , $m = null ){ global $Xb ; preg_match ( '~([^?]*)\\??(.*)~' , remove_from_uri ( implode ( " | " , array_keys ( $Xb )) . " |username| " . ( $m !== null ? " db| " : " " ) . session_name ()), $B ); return " $B[1] ? " . ( sid () ? SID . " & " : " " ) . ( $Vh != " server " || $N != " " ? urlencode ( $Vh ) . " = " . 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
2015-04-01 06:36:56 +00:00
redirect ( $A , $me = null ){ if ( $me !== null ){ restart_session (); $_SESSION [ " messages " ][ preg_replace ( '~^[^?]*~' , '' ,( $A !== null ? $A : $_SERVER [ " REQUEST_URI " ]))][] = $me ;} if ( $A !== null ){ if ( $A == " " ) $A = " . " ; header ( " Location: $A " ); exit ;}} function
query_redirect ( $H , $A , $me , $Sf = true , $wc = true , $Dc = false , $ih = " " ){ global $h , $n , $b ; if ( $wc ){ $Hg = microtime ( true ); $Dc =! $h -> query ( $H ); $ih = format_time ( $Hg );} $Fg = " " ; if ( $H ) $Fg = $b -> messageQuery ( $H , $ih ); if ( $Dc ){ $n = error () . $Fg ; return
false ;} if ( $Sf ) redirect ( $A , $me . $Fg ); return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
queries ( $H ){ global $h ; static $Mf = array (); static $Hg ; if ( ! $Hg ) $Hg = microtime ( true ); if ( $H === null ) return
array ( implode ( " \n " , $Mf ), format_time ( $Hg )); $Mf [] = ( preg_match ( '~;$~' , $H ) ? " DELIMITER ;; \n $H ; \n DELIMITER " : $H ) . " ; " ; return $h -> query ( $H );} function
apply_queries ( $H , $S , $sc = 'table' ){ foreach ( $S
as $Q ){ if ( ! queries ( " $H " . $sc ( $Q ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2015-04-01 06:36:56 +00:00
queries_redirect ( $A , $me , $Sf ){ list ( $Mf , $ih ) = queries ( null ); return
query_redirect ( $Mf , $A , $me , $Sf , false , ! $Sf , $ih );} function
format_time ( $Hg ){ return
lang ( 1 , max ( 0 , microtime ( true ) - $Hg ));} function
remove_from_uri ( $jf = " " ){ return
substr ( preg_replace ( " ~(?<=[?&])( $jf " . ( SID ? " " : " | " . session_name ()) . " )=[^&]*&~ " , '' , " $_SERVER[REQUEST_URI] & " ), 0 , - 1 );} function
pagination ( $E , $Db ){ return " " . ( $E == $Db ? $E + 1 : '<a href="' . h ( remove_from_uri ( " page " ) . ( $E ? " &page= $E " . ( $_GET [ " next " ] ? " &next= " . urlencode ( $_GET [ " next " ]) : " " ) : " " )) . '">' . ( $E + 1 ) . " </a> " );} function
get_file ( $x , $Kb = false ){ $Hc = $_FILES [ $x ]; if ( ! $Hc ) return
null ; foreach ( $Hc
as $x => $X ) $Hc [ $x ] = ( array ) $X ; $J = '' ; foreach ( $Hc [ " error " ] as $x => $n ){ if ( $n ) return $n ; $C = $Hc [ " name " ][ $x ]; $qh = $Hc [ " tmp_name " ][ $x ]; $wb = file_get_contents ( $Kb && preg_match ( '~\\.gz$~' , $C ) ? " compress.zlib:// $qh " : $qh ); if ( $Kb ){ $Hg = substr ( $wb , 0 , 3 ); if ( function_exists ( " iconv " ) && preg_match ( " ~^ \xFE \xFF |^ \xFF \xFE ~ " , $Hg , $Yf )) $wb = iconv ( " utf-16 " , " utf-8 " , $wb ); elseif ( $Hg == " \xEF \xBB \xBF " ) $wb = substr ( $wb , 3 ); $J .= $wb . " \n \n " ;} else $J .= $wb ;} return $J ;} function
upload_error ( $n ){ $je = ( $n == UPLOAD_ERR_INI_SIZE ? ini_get ( " upload_max_filesize " ) : 0 ); return ( $n ? lang ( 2 ) . ( $je ? " " . lang ( 3 , $je ) : " " ) : lang ( 4 ));} function
repeat_pattern ( $tf , $y ){ return
str_repeat ( " $tf { 0,65535} " , $y / 65535 ) . " $tf { 0, " . ( $y % 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
2015-04-01 06:36:56 +00:00
shorten_utf8 ( $P , $y = 80 , $Og = " " ){ if ( ! preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n - \ x { FFFF}] " , $y ) . " )( $ )?)u " , $P , $B )) preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n -~] " , $y ) . " )( $ )?) " , $P , $B ); return
h ( $B [ 1 ]) . $Og . ( isset ( $B [ 2 ]) ? " " : " <i>...</i> " );} function
format_number ( $X ){ return
strtr ( number_format ( $X , 0 , " . " , lang ( 5 )), preg_split ( '~~u' , lang ( 6 ), - 1 , PREG_SPLIT_NO_EMPTY ));} function
2014-04-01 18:00:42 +00:00
friendly_url ( $X ){ return
preg_replace ( '~[^a-z0-9_]~i' , '-' , $X );} function
2015-04-01 06:36:56 +00:00
hidden_fields ( $If , $md = array ()){ while ( list ( $x , $X ) = each ( $If )){ if ( ! in_array ( $x , $md )){ if ( is_array ( $X )){ foreach ( $X
as $Gd => $W ) $If [ $x . " [ $Gd ] " ] = $W ;} else
echo '<input type="hidden" name="' . h ( $x ) . '" 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
2015-04-01 06:36:56 +00:00
table_status1 ( $Q , $Ec = false ){ $J = table_status ( $Q , $Ec ); return ( $J ? $J : array ( " Name " => $Q ));} function
column_foreign_keys ( $Q ){ global $b ; $J = array (); foreach ( $b -> foreignKeys ( $Q ) as $q ){ foreach ( $q [ " source " ] as $X ) $J [ $X ][] = $q ;} return $J ;} function
enum_input ( $U , $Ja , $o , $Y , $mc = null ){ global $b ; preg_match_all ( " ~'((?:[^']|'')*)'~ " , $o [ " length " ], $ee ); $J = ( $mc !== null ? " <label><input type=' $U ' $Ja value=' $mc ' " . (( is_array ( $Y ) ? in_array ( $mc , $Y ) : $Y === 0 ) ? " checked " : " " ) . " ><i> " . lang ( 7 ) . " </i></label> " : " " ); foreach ( $ee [ 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 $h , $Bh , $b , $w ; $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 " ;} $bg = ( $w == " mssql " && $o [ " auto_increment " ]); if ( $bg &&! $_POST [ " save " ]) $r = null ; $Uc = ( isset ( $_GET [ " select " ]) || $bg ? array ( " orig " => lang ( 8 )) : array ()) + $b -> editFunctions ( $o ); $Ja = " name='fields[ $C ]' " ; if ( $o [ " type " ] == " enum " ) echo
nbsp ( $Uc [ " " ]) . " <td> " . $b -> editInput ( $_GET [ " edit " ], $o , $Ja , $Y ); else { $Kc = 0 ; foreach ( $Uc
as $x => $X ){ if ( $x === " " ||! $X ) break ; $Kc ++ ;} $Oe = ( $Kc ? " onchange= \" var f = this.form['function[ " . h ( js_escape ( bracket_escape ( $o [ " field " ]))) . " ]']; if ( $Kc > f.selectedIndex) f.selectedIndex = $Kc ; \" onkeyup='keyupChange.call(this);' " : " " ); $Ja .= $Oe ; $cd = ( in_array ( $r , $Uc ) || isset ( $Uc [ $r ])); echo ( count ( $Uc ) > 1 ? " <select name='function[ $C ]' onchange='functionChange(this);' " . on_help ( " getTarget(event).value.replace(/^SQL \$ /, '') " , 1 ) . " > " . optionlist ( $Uc , $r === null || $cd ? $r : " " ) . " </select> " : nbsp ( reset ( $Uc ))) . '<td>' ; $vd = $b -> editInput ( $_GET [ " edit " ], $o , $Ja , $Y ); if ( $vd != " " ) echo $vd ; elseif ( $o [ " type " ] == " set " ){ preg_match_all ( " ~'((?:[^']|'')*)'~ " , $o [ " length " ], $ee ); foreach ( $ee [ 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' : '' ) . " $Oe > " . 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 ' $Oe > " ; elseif (( $gh = preg_match ( '~text|lob~' , $o [ " type " ])) || preg_match ( " ~ \n ~ " , $Y )){ if ( $gh && $w != " 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 " ) echo " <textarea $Ja cols='50' rows='12' class='jush-js'> " . h ( $Y ) . '</textarea>' ; else { $le = ( ! 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 )) : ( $Bh [ $o [ " type " ]] ? $Bh [ $o [ " type " ]] + ( $o [ " unsigned " ] ? 0 : 1 ) : 0 )); if ( $w == 'sql' && $h -> server_info >= 5.6 && preg_match ( '~time~' , $o [ " type " ])) $le += 7 ; echo " <input " . (( ! $cd || $r === " " ) && preg_match ( '~(?<!o)int~' , $o [ " type " ]) ? " type='number' " : " " ) . " value=' " . h ( $Y ) . " ' " . ( $le ? " maxlength=' $le ' " : " " ) . ( preg_match ( '~char|binary~' , $o [ " type " ]) && $le > 20 ? " size='40' " : " " ) . " $Ja > " ;}}} function
process_input ( $o ){ global $b ; $t = bracket_escape ( $o [ " field " ]); $r = $_POST [ " function " ][ $t ]; $Y = $_POST [ " fields " ][ $t ]; if ( $o [ " type " ] == " enum " ){ if ( $Y ==- 1 ) return
false ; if ( $Y == " " ) return " NULL " ; return + $Y ;} if ( $o [ " auto_increment " ] && $Y == " " ) return
null ; if ( $r == " orig " ) return ( $o [ " on_update " ] == " CURRENT_TIMESTAMP " ? idf_escape ( $o [ " field " ]) : false ); if ( $r == " NULL " ) return " NULL " ; if ( $o [ " type " ] == " set " ) return
array_sum (( array ) $Y ); if ( $r == " json " ){ $r = " " ; $Y = json_decode ( $Y , true ); if ( ! is_array ( $Y )) return
false ; return $Y ;} if ( preg_match ( '~blob|bytea|raw|file~' , $o [ " type " ]) && ini_bool ( " file_uploads " )){ $Hc = get_file ( " fields- $t " ); if ( ! is_string ( $Hc )) return
2014-04-01 18:00:42 +00:00
false ; return
2015-04-01 06:36:56 +00:00
q ( $Hc );} return $b -> processInput ( $o , $Y , $r );} function
fields_from_edit (){ global $Wb ; $J = array (); foreach (( array ) $_POST [ " field_keys " ] as $x => $X ){ if ( $X != " " ){ $X = bracket_escape ( $X ); $_POST [ " function " ][ $X ] = $_POST [ " field_funs " ][ $x ]; $_POST [ " fields " ][ $X ] = $_POST [ " field_vals " ][ $x ];}} foreach (( array ) $_POST [ " fields " ] as $x => $X ){ $C = bracket_escape ( $x , 1 ); $J [ $C ] = array ( " field " => $C , " privileges " => array ( " insert " => 1 , " update " => 1 ), " null " => 1 , " auto_increment " => ( $x == $Wb -> primary ),);} return $J ;} function
search_tables (){ global $b , $h ; $_GET [ " where " ][ 0 ][ " op " ] = " LIKE %% " ; $_GET [ " where " ][ 0 ][ " val " ] = $_POST [ " query " ]; $Qc = false ; foreach ( table_status ( '' , true ) as $Q => $R ){ $C = $b -> tableName ( $R ); if ( isset ( $R [ " Engine " ]) && $C != " " && ( ! $_POST [ " tables " ] || in_array ( $Q , $_POST [ " tables " ]))){ $I = $h -> query ( " SELECT " . limit ( " 1 FROM " . table ( $Q ), " WHERE " . implode ( " AND " , $b -> selectSearchProcess ( fields ( $Q ), array ())), 1 )); if ( ! $I || $I -> fetch_row ()){ if ( ! $Qc ){ echo " <ul> \n " ; $Qc = true ;} echo " <li> " . ( $I ? " <a href=' " . h ( ME . " select= " . urlencode ( $Q ) . " &where[0][op]= " . urlencode ( $_GET [ " where " ][ 0 ][ " op " ]) . " &where[0][val]= " . urlencode ( $_GET [ " where " ][ 0 ][ " val " ])) . " '> $C </a> \n " : " $C : <span class='error'> " . error () . " </span> \n " );}}} echo ( $Qc ? " </ul> " : " <p class='message'> " . lang ( 9 )) . " \n " ;} function
dump_headers ( $kd , $ve = false ){ global $b ; $J = $b -> dumpHeaders ( $kd , $ve ); $hf = $_POST [ " output " ]; if ( $hf != " text " ) header ( " Content-Disposition: attachment; filename= " . $b -> dumpFilename ( $kd ) . " . $J " . ( $hf != " file " &&! preg_match ( '~[^0-9a-z]~' , $hf ) ? " . $hf " : " " )); session_write_close (); ob_flush (); flush (); return $J ;} function
2014-04-01 18:00:42 +00:00
dump_csv ( $K ){ foreach ( $K
as $x => $X ){ if ( preg_match ( " ~[ \" \n ,; \t ]~ " , $X ) || $X === " " ) $K [ $x ] = '"' . str_replace ( '"' , '""' , $X ) . '"' ;} echo
implode (( $_POST [ " format " ] == " csv " ? " , " : ( $_POST [ " format " ] == " tsv " ? " \t " : " ; " )), $K ) . " \r \n " ;} function
2015-04-01 06:36:56 +00:00
apply_sql_function ( $r , $e ){ return ( $r ? ( $r == " unixepoch " ? " DATETIME( $e , ' $r ') " : ( $r == " count distinct " ? " COUNT(DISTINCT " : strtoupper ( " $r ( " )) . " $e ) " ) : $e );} function
get_temp_dir (){ $J = ini_get ( " upload_tmp_dir " ); if ( ! $J ){ if ( function_exists ( 'sys_get_temp_dir' )) $J = sys_get_temp_dir (); else { $Ic =@ tempnam ( " " , " " ); if ( ! $Ic ) return
false ; $J = dirname ( $Ic ); unlink ( $Ic );}} return $J ;} function
password_file ( $j ){ $Ic = get_temp_dir () . " /adminer.key " ; $J =@ file_get_contents ( $Ic ); if ( $J ||! $j ) return $J ; $Sc =@ fopen ( $Ic , " w " ); if ( $Sc ){ chmod ( $Ic , 0660 ); $J = rand_string (); fwrite ( $Sc , $J ); fclose ( $Sc );} return $J ;} function
2014-04-01 18:00:42 +00:00
rand_string (){ return
md5 ( uniqid ( mt_rand (), true ));} function
2015-04-01 06:36:56 +00:00
select_value ( $X , $_ , $o , $hh ){ global $b , $ba ; if ( is_array ( $X )){ $J = " " ; foreach ( $X
as $Gd => $W ) $J .= " <tr> " . ( $X != array_values ( $X ) ? " <th> " . h ( $Gd ) : " " ) . " <td> " . select_value ( $W , $_ , $o , $hh ); return " <table cellspacing='0'> $J </table> " ;} if ( ! $_ ) $_ = $b -> selectLink ( $X , $o ); if ( $_ === null ){ if ( is_mail ( $X )) $_ = " mailto: $X " ; if ( $Kf = is_url ( $X )) $_ = (( $Kf == " http " && $ba ) || preg_match ( '~WebKit~i' , $_SERVER [ " HTTP_USER_AGENT " ]) ? $X : " $Kf ://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 ( $hh != " " && is_shortable ( $o )) $J = shorten_utf8 ( $J , max ( 0 , + $hh )); else $J = h ( $J );} return $b -> selectVal ( $J , $_ , $o , $X );} function
is_mail ( $jc ){ $Ha = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]' ; $Vb = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; $tf = " $Ha +( \\ . $Ha +)*@( $Vb ? \\ .)+ $Vb " ; return
is_string ( $jc ) && preg_match ( " (^ $tf (, \\ s* $tf )* \$ )i " , $jc );} function
is_url ( $P ){ $Vb = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; return ( preg_match ( " ~^(https?)://( $Vb ? \\ .)+ $Vb (: \\ d+)?(/.*)?( \\ ?.*)?(#.*)? \$ ~i " , $P , $B ) ? strtolower ( $B [ 1 ]) : " " );} function
is_shortable ( $o ){ return
preg_match ( '~char|text|lob|geometry|point|linestring|polygon|string~' , $o [ " type " ]);} function
count_rows ( $Q , $Z , $Ad , $Xc ){ global $w ; $H = " FROM " . table ( $Q ) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " ); return ( $Ad && ( $w == " sql " || count ( $Xc ) == 1 ) ? " SELECT COUNT(DISTINCT " . implode ( " , " , $Xc ) . " ) $H " : " SELECT COUNT(*) " . ( $Ad ? " FROM (SELECT 1 $H $Yc ) x " : $H ));} function
slow_query ( $H ){ global $b , $T ; $m = $b -> database (); $jh = $b -> queryTimeout (); if ( support ( " kill " ) && is_object ( $i = connect ()) && ( $m == " " || $i -> select_db ( $m ))){ $Ld = $i -> result ( " SELECT 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 () {
2015-04-01 06:36:56 +00:00
}, \ 'token=' , $T , '&kill=' , $Ld , ' \ ' );
}, ',1000*$jh,' );
2014-04-01 18:00:42 +00:00
</ script >
2015-04-01 06:36:56 +00:00
';}else$i=null;ob_flush();flush();$J=@get_key_vals($H,$i,$jh);if($i){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
2015-04-01 06:36:56 +00:00
get_token (){ $Pf = rand ( 1 , 1e6 ); return ( $Pf ^ $_SESSION [ " token " ]) . " : $Pf " ;} function
verify_token (){ list ( $T , $Pf ) = explode ( " : " , $_POST [ " token " ]); return ( $Pf ^ $_SESSION [ " token " ]) == $T ;} function
lzw_decompress ( $Ra ){ $Rb = 256 ; $Sa = 8 ; $kb = array (); $dg = 0 ; $eg = 0 ; for ( $s = 0 ; $s < strlen ( $Ra ); $s ++ ){ $dg = ( $dg << 8 ) + ord ( $Ra [ $s ]); $eg += 8 ; if ( $eg >= $Sa ){ $eg -= $Sa ; $kb [] = $dg >> $eg ; $dg &= ( 1 << $eg ) - 1 ; $Rb ++ ; if ( $Rb >> $Sa ) $Sa ++ ;}} $Qb = range ( " \0 " , " \xFF " ); $J = " " ; foreach ( $kb
as $s => $jb ){ $ic = $Qb [ $jb ]; if ( ! isset ( $ic )) $ic = $di . $di [ 0 ]; $J .= $ic ; if ( $s ) $Qb [] = $di . $ic [ 0 ]; $di = $ic ;} return $J ;} function
on_help ( $pb , $Ag = 0 ){ return " onmouseover='helpMouseover(this, event, " . h ( $pb ) . " , $Ag );' onmouseout='helpMouseout(this, event);' " ;} function
edit_form ( $a , $p , $K , $Jh ){ global $b , $w , $T , $n ; $Tg = $b -> tableName ( table_status1 ( $a , true )); page_header (( $Jh ? lang ( 10 ) : lang ( 11 )), $n , array ( " select " => array ( $a , $Tg )), $Tg ); if ( $K === false ) echo " <p class='error'> " . lang ( 12 ) . " \n " ; echo ' < form action = " " method = " post " enctype = " multipart/form-data " id = " form " >
';if(!$p)echo"<p class=' error '>".lang(13)."\n";else{echo"<table cellspacing=' 0 ' onkeydown=' return editingKeydown ( event ); ' > \n " ;foreach( $p
as $C => $o ){ echo " <tr><th> " . $b -> fieldName ( $o ); $Lb = $_GET [ " set " ][ bracket_escape ( $C )]; if ( $Lb === null ){ $Lb = $o [ " default " ]; if ( $o [ " type " ] == " bit " && preg_match ( " ~^b'([01]*)' \$ ~ " , $Lb , $Yf )) $Lb = $Yf [ 1 ];} $Y = ( $K !== null ? ( $K [ $C ] != " " && $w == " sql " && preg_match ( " ~enum|set~ " , $o [ " type " ]) ? ( is_array ( $K [ $C ]) ? array_sum ( $K [ $C ]) :+ $K [ $C ]) : $K [ $C ]) : ( ! $Jh && $o [ " auto_increment " ] ? " " : ( isset ( $_GET [ " select " ]) ? false : $Lb ))); if ( ! $_POST [ " save " ] && is_string ( $Y )) $Y = $b -> editVal ( $Y , $o ); $r = ( $_POST [ " save " ] ? ( string ) $_POST [ " function " ][ $C ] : ( $Jh && $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=' " . ( $Jh ? lang ( 15 ) . " ' onclick='return !ajaxForm(this.form, \" " . lang ( 16 ) . '...", this)' : lang ( 17 )) . " ' title='Ctrl+Shift+Enter'> \n " ;} echo ( $Jh ? " <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 " ]), ' " >
< input type = " hidden " name = " save " value = " 1 " >
< input type = " hidden " name = " token " value = " ', $T ,' " >
</ form >
';}global$b,$h,$Xb,$fc,$pc,$n,$Uc,$Zc,$ba,$ud,$w,$ca,$Pd,$Ne,$uf,$Lg,$dd,$T,$vh,$Bh,$Ih,$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),$Jc);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);$Pd=array(' en '=>' English ',' ar '=>' العربية ',' bn '=>' বাংলা ',' ca '=>' Català ',' cs '=>' Čeština ',' da '=>' Dansk ',' de '=>' Deutsch ',' es '=>' Español ',' et '=>' Eesti ',' fa '=>' فارسی ',' fr '=>' Français ',' 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
2015-04-01 06:36:56 +00:00
lang ( $t , $Ee = null ){ if ( is_string ( $t )){ $xf = array_search ( $t , get_translations ( " en " )); if ( $xf !== false ) $t = $xf ;} global $ca , $vh ; $uh = ( $vh [ $t ] ? $vh [ $t ] : $t ); if ( is_array ( $uh )){ $xf = ( $Ee == 1 ? 0 : ( $ca == 'cs' || $ca == 'sk' ? ( $Ee && $Ee < 5 ? 1 : 2 ) : ( $ca == 'fr' ? ( ! $Ee ? 0 : 1 ) : ( $ca == 'pl' ? ( $Ee % 10 > 1 && $Ee % 10 < 5 && $Ee / 10 % 10 != 1 ? 1 : 2 ) : ( $ca == 'sl' ? ( $Ee % 100 == 1 ? 0 : ( $Ee % 100 == 2 ? 1 : ( $Ee % 100 == 3 || $Ee % 100 == 4 ? 2 : 3 ))) : ( $ca == 'lt' ? ( $Ee % 10 == 1 && $Ee % 100 != 11 ? 0 : ( $Ee % 10 > 1 && $Ee / 10 % 10 != 1 ? 1 : 2 )) : ( $ca == 'ru' || $ca == 'sr' || $ca == 'uk' ? ( $Ee % 10 == 1 && $Ee % 100 != 11 ? 0 : ( $Ee % 10 > 1 && $Ee % 10 < 5 && $Ee / 10 % 10 != 1 ? 1 : 2 )) : 1 ))))))); $uh = $uh [ $xf ];} $Ea = func_get_args (); array_shift ( $Ea ); $Pc = str_replace ( " %d " , " %s " , $uh ); if ( $Pc != $uh ) $Ea [ 0 ] = format_number ( $Ee ); return
vsprintf ( $Pc , $Ea );} function
switch_lang (){ global $ca , $Pd ; echo " <form action='' method='post'> \n <div id='lang'> " , lang ( 19 ) . " : " . html_select ( " lang " , $Pd , $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 ( $Pd [ $_COOKIE [ " adminer_lang " ]])){ cookie ( " adminer_lang " , $_COOKIE [ " adminer_lang " ]); $ca = $_COOKIE [ " adminer_lang " ];} elseif ( isset ( $Pd [ $_SESSION [ " lang " ]])) $ca = $_SESSION [ " lang " ]; else { $ua = array (); preg_match_all ( '~([-a-z]+)(;q=([0-9.]+))?~' , str_replace ( " _ " , " - " , strtolower ( $_SERVER [ " HTTP_ACCEPT_LANGUAGE " ])), $ee , PREG_SET_ORDER ); foreach ( $ee
2014-04-01 18:00:42 +00:00
as $B ) $ua [ $B [ 1 ]] = ( isset ( $B [ 3 ]) ? $B [ 3 ] : 1 ); arsort ( $ua ); foreach ( $ua
2015-04-01 06:36:56 +00:00
as $x => $Lf ){ if ( isset ( $Pd [ $x ])){ $ca = $x ; break ;} $x = preg_replace ( '~-.*~' , '' , $x ); if ( ! isset ( $ua [ $x ]) && isset ( $Pd [ $x ])){ $ca = $x ; break ;}}} $vh =& $_SESSION [ " translations " ]; if ( $_SESSION [ " translations_version " ] != 646742810 ){ $vh = array (); $_SESSION [ " translations_version " ] = 646742810 ;} function
get_translations ( $Od ){ switch ( $Od ){ case " en " : $g = " A9 D<07> y<EFBFBD> @s:<3A> G<EFBFBD> <47> (<28> ff<66> <66> <EFBFBD> <EFBFBD> <EFBFBD> <09> <> :<1B> S<> <53> <EFBFBD> a2 \" 1<> .. L'<27> I<EFBFBD> <49> m<EFBFBD> #<23> s,<2C> K<17> <> OP#I<> @%9<> <39> i4<08> o2ύ<32> <CF8D> <EFBFBD> <EFBFBD> <EFBFBD> ,9<> %<02> P<EFBFBD> b2<19> <06> a<EFBFBD> <61> r\n 2<EFBFBD> N C<> (<28> r4<72> <34> 1C`(<28> :Eb<45> 9A<14> i:<02> &㙔<> y<EFBFBD> <79> F<> <46> <EFBFBD> Y<> <59> \r <13> \n <EFBFBD> 8Z<0E> S=\$ A<19> <> <0C> <13> `<60> =<3D> ܌<EFBFBD> <DC8C> <EFBFBD> 0<EFBFBD> \n <EFBFBD> <EFBFBD> dF<EFBFBD> <09> <> n:Zΰ)<29> <> Q<EFBFBD> <51> <EFBFBD> <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> <> ˞N<14> t<EFBFBD> <74> ~9<> <39> <EFBFBD> <EFBFBD> <16> B؍ <42> 8<EFBFBD> :- p<> <70> <EFBFBD> KX<4B> 9,<2C> p<EFBFBD> :<0E> 8<EFBFBD> <08> (<28> \0 <EFBFBD> <EFBFBD> (<28> <> <EFBFBD> <EFBFBD> @<40> <> <EFBFBD> -B<> ƎN<C68E> <4E> <EFBFBD> @.<2E> <> 9<EFBFBD> #<23> <> <EFBFBD> 3<EFBFBD> <33> <EFBFBD> Ӊ<EFBFBD> z<EFBFBD> 7:<3A> <> <EFBFBD> ތ<EFBFBD> <DE8C> @<40> F<EFBFBD> .1<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \r \" <0E> \" ӈ#c:9<0C> <> ;<3B> R<EFBFBD> <52> Т <EFBFBD> < ;<3B> <> <EFBFBD> چ\$ #<10> !,<2C> 3<EFBFBD> <33> <EFBFBD> <EFBFBD> 2ȀP<C880> :<3A> <> #ʾ K#8<38> <CE80> <EFBFBD> <EFBFBD> Ac<18> 7<> <37> <EFBFBD> <EFBFBD> -Bμ<42> <CEBC> H<EFBFBD> <1E> <> 3<EFBFBD> <33> <EFBFBD> £<EFBFBD> ǣ;<3B> ,<2C> <> |<7C> :<3A> R<EFBFBD> p9<70> m<EFBFBD> P(<28> <> \\ 6<EFBFBD> md<EFBFBD> :<3A> <0B> ƀ<EFBFBD> -<2D> <> <EFBFBD> <EFBFBD> <03> M,<2C> K<EFBFBD> A#FN<46> <4E> _T<5F> v h<0B> <> <EFBFBD> K<08> .# gfX<66> x<EFBFBD> <78> 2<EFBFBD> <32> <EFBFBD> <EFBFBD> Q`P<> <<16> <> 2<EFBFBD> v<EFBFBD> . X<16> <> )ٶ:<3A> !<21> 2<EFBFBD> J<EFBFBD> <20> [<5B> 3<0C> b<EFBFBD> ѹq<D1B9> \n <EFBFBD> <EFBFBD> <EFBFBD> z5V<EFBFBD> (<28> <> &<26> <> <EFBFBD> <EFBFBD> 3T<11> l<EFBFBD> <05> <> <18> O<EFBFBD> [~7'<27> <08> <> 3<EFBFBD> p<13> <> t.<0C> xN<17> <> <18> %<25> <> -<2D> MA 67V\n JP<EFBFBD> <EFBFBD> <EFBFBD> \r <EFBFBD> <EFBFBD> <EFBFBD> b<EFBFBD> <EFBFBD> #2<> x<EFBFBD> <1E> <> <04> <> ;<3B> ̳<> j֔F<D694> =<3D> <> <EFBFBD> \n NN64<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> J 2b(<28> <> <EFBFBD> e8Ɯ7% TA* \\ Z<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Ѐ<> <D080> <EFBFBD> D4<0E> <> <EFBFBD> <05> x<EFBFBD> <78> <EFBFBD> <EFBFBD> f<> <05> 8<EFBFBD> Ǽc<C7BC> <1E> s<EFBFBD> ^ 4#<23> *:oB<6F> ,ލa }m<> U<EFBFBD> <55> <05> |<7C> <> <EFBFBD> Ē<EFBFBD> <C492> :<1C> <> GQ<47> a<EFBFBD> <61> Z<EFBFBD> 8 \\ . \\ <EFBFBD> <EFBFBD> <0F> <> <EFBFBD> K<EFBFBD> \" P<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <03> ˼<1A> qE<71> <45> \0 <EFBFBD> \$ \n [<5B> ȼ<EFBFBD> \0 P<EFBFBD> )<02> g)3E<33> <45> <EFBFBD> <EFBFBD> wUk<55> <6B> c<EFBFBD> 0<EFBFBD> RX<52> &<19> <> <EFBFBD> ʞ^t<> <74> )+<2B> 2'<27> } MI<4D> E:<3A> <> <EFBFBD> 'U<> v Az \" <10> rBR<42> i}i |<7C> <10> l<EFBFBD> <6C> f0d<30> <20> G<0E> K dx<64> <1D> @<40> L<EFBFBD> (d<0E> <> <EFBFBD> <20> ¢<> F- ) T<> g<EFBFBD> 21yIP<49> <50> 8<08> @UF<55> <46> <EFBFBD> <EFBFBD> 䟍z<E49F8D> k<EFBFBD> <6B> ؘ<EFBFBD> P<EFBFBD> Q<> 3\$ x<EFBFBD> (X<19> 2<EFBFBD> \$ <EFBFBD> <EFBFBD> ɒ0<EFBFBD> <1E> <> 7<EFBFBD> p<EFBFBD> <17> I<06> :#q ȳ<> R<EFBFBD> <52> F<> <46> D<EFBFBD> p<13> p \n <EFBFBD> @\" <10> @Tx\" <EFBFBD> <EFBFBD> <EFBFBD> <1F> @o\r <EFBFBD> <EFBFBD> <EFBFBD> \" <EFBFBD> N XaC\n <EFBFBD> G\0 <EFBFBD> <EFBFBD> |<7C> <> <EFBFBD> Sa<<3C> <> s<EFBFBD> q<EFBFBD> 0aT 5<> 9<12> RY<0C> <⒐<> j<EFBFBD> <6A> <EFBFBD> 5E ;<3B> <> j ey<65> g<0C> 4<EFBFBD> Ҍ<> A<EFBFBD> Z(̟<18> T}<7D> <> <EFBFBD> 0n<30> \0 <EFBFBD> (<28> <0C> <19> \\ k,<2C> & ~tָod<6F> <64> \0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> I<EFBFBD> ?(<0C> S<> <10> #<23> \r <EFBFBD> <EFBFBD> <EFBFBD> <<3C> C8hzOQ<4F> <h<> P<17> zz'^vO<76> k<06> J<EFBFBD> r(6Gi-8<> A:4<> <0C> 3Y<33> <59> <09> <> <EFBFBD> e<EFBFBD> <65> <EFBFBD> <EFBFBD> B<EFBFBD> Vq(\n <EFBFBD> <EFBFBD> +<2B> t<EFBFBD> \" dXmG<05> F<EFBFBD> <46> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> )鴂<> % Aܲ W<> NU h<> <1B> q<> Ţ} #<23> O<> <2<> <32> (;<13> <> <EFBFBD> <EFBFBD> nBa=X a<03> ;/!I <49> <7F> <EFBFBD> Li<4C> <69> <EFBFBD> <EFBFBD> d,<2C> :vK<76> <4B> F<0E> <> ._<> +1<05> <> 2 #<08> I <09> 0<EFBFBD> ((<28> 6'J<> 5 \$ !<%<25> c \\ <EFBFBD> <12> <> <EFBFBD> <04> Z<EFBFBD> zӅz<15> <> W O<> \r <EFBFBD> <EFBFBD> <08> <11> V<EFBFBD> _<EFBFBD> A<EFBFBD> <15> <> <EFBFBD> <EFBFBD> <EFBFBD> ]<5D> 5<EFBFBD> z5<7A> <35> 3 ?G<1F> <> <EFBFBD> V<EFBFBD> oZ<6F> <5A> <EFBFBD> <EFBFBD> <EFBFBD> M<EFBFBD> G<EFBFBD> <47> <13> 9 }<7D> Vٕ<DC8F> <12> <> <EFBFBD> (q<> <71> <EFBFBD> @<15> (b<> <62> <EFBFBD> <EFBFBD> <EFBFBD> <13> <14> <> [\\ <EFBFBD> 7<> <07> <> <0B> dI (׆<> vK9<4B> p<> <70> P<EFBFBD> u<EFBFBD> )v<> <76> ܽ&# u<> <75> e<EFBFBD> *4<> <34> Г{ <EFBFBD> Y><3E> `<60> \$ k옢<15> <> 3 \$ <EFBFBD> <17> ;e<02> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 1<EFBFBD> <31> 2Ϟ<08> X\n <EFBFBD> <EFBFBD> <14> 3pJ]<5D> x U<> 1<EFBFBD> <31> <EFBFBD> <EFBFBD> _g<5F> 2<EFBFBD> F<> Y<EFBFBD> EE<45> <45> 5<EFBFBD> ͉͊<CD8A> <<3C> <> ę+7<> ZڥT<DAA5> b<EFBFBD> l9<6C> <39> <EFBFBD> <EFBFBD> <EFBFBD> `<60> K<EFBFBD> :A#<1E> @<40> |<14> <> \$ i<EFBFBD> <12> XS ̫<> <CCAB> f \n 1]YN<59> aR #<23> <> Q<EFBFBD> xo \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> r<EFBFBD> <EFBFBD> ʓ%<25> a{ )4<> <34> <EFBFBD> @K<> <4B> eܫ<65> <DCAB> <EFBFBD> <EFBFBD> ]<5D> W2e \\ ́<EFBFBD> &tϹ <74> ^<5E> 5<EFBFBD> { *<2A> <> _z ?rkckr`<60> !<21> <> <EFBFBD> <13> M<EFBFBD> <4D> <EFBFBD> z4<7A> h<EFBFBD> 3<EFBFBD> l<EFBFBD> <6C> <EFBFBD> B7 x<> X.<2E> <> <EFBFBD> 2<EFBFBD> jo<6A> <6F> Ψљ Cj<43> N#<23> <> <EFBFBD> <EFBFBD> ꖨ<EFBFBD> V <56> [<5B> <> t<EFBFBD> <74> 3)<29> Sf48 <20> >h 2<> |؋I { <EFBFBD> 즻<EFBFBD> <EFBFBD> Z<EFBFBD> - WaGI d\r <EFBFBD> x<EFBFBD> )<29> <> <EFBFBD> \r <EFBFBD> <EFBFBD> \n z (z<> S<EFBFBD> \\ LJj<4A> <6A> f- % W<> <57> dޣ<64> <DEA3> Uf܃ e(<28> W<EFBFBD> y<EFBFBD> VQ<56> <51> <EFBFBD> <EFBFBD> <EFBFBD> o<EFBFBD> <6F> W}<7D> 곲3<EAB3B2> <33> <EFBFBD> 6<> ><3E> g<EFBFBD> <67> 7 Gګ]<5D> JPS<50> }]\\ <EFBFBD> |2<> <19> _<EFBFBD> <5F> <EFBFBD> <EFBFBD> <EFBFBD> 2@<40> \$ .ر<> 2%&5 \0 <EFBFBD> 1<EFBFBD> <EFBFBD> W<04> ڪ<> <DAAA> \" ٴ,<2C> <> <EFBFBD> <EFBFBD> L<> :J8<4A> N<> ƙ<EFBFBD> <C699> #6<> <36> <EFBFBD> <EFBFBD> \r ):)<29> q<EFBFBD> ́<EFBFBD> Q<EFBFBD> <51> '<27> d BX<42> <58> @A<> <41> <EFBFBD> N<07> <> <EFBFBD> n<EFBFBD> <6E> <EFBFBD> <EFBFBD> p<EFBFBD> <70> <EFBFBD> <EFBFBD> <EFBFBD> E<EFBFBD> <19> <> hX<68> <58> 9<12> /<2F> <> \" <EFBFBD> ΰĘ<CEB0> <1C> f<EFBFBD> <66> <EFBFBD> <EFBFBD> j<EFBFBD> <6A> \n <EFBFBD> _s<5F> <73> \n <EFBFBD> bT߽ y<07> <> <EFBFBD> [@<40> <> <EFBFBD> <EFBFBD> <EFBFBD> 1<EFBFBD> d<EFBFBD> -4<> h<EFBFBD> <68> <EFBFBD> <1B> <> _;<3B> <> K<EFBFBD> q<EFBFBD> <71> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \\ <EFBFBD> \" <EFBFBD> <EFBFBD> i<EFBFBD> <GV<47> <56> ;4#N<> z|<7C> <> A<EFBFBD> <41> }-<2D> :<3A> V2<56> '<1F> M;<3B> <> <EFBFBD> ĭ<EFBFBD> X<EFBFBD> <58> <12> <12> /ӿ<1E> QXFb^ =<3D> <> WI<57> RP<10> l p<> 4<EFBFBD> 0<30> <1C> # 7<> p<EFBFBD> <70> K<EFBFBD> <4B> ' R<> <52> x<EFBFBD> \n <EFBFBD> <EFBFBD> <05> pw<70> \\ R <20> % \n <EFBFBD> IMT%<25> r<EFBFBD> \n <EFBFBD> <EFBFBD> <0B> <> l<08> <> F\" l 3 ޙ<> <DE99> TCN <09> <> \r /<2F> <> <EFBFBD> \n <EFBFBD> #<23> 6<EFBFBD> J; L<> <4C> <EFBFBD> <EFBFBD> Ip<49> <70> \n <EFBFBD> <EFBFBD> |<7C> BP<42> <03> <> <EFBFBD> <EFBFBD> _<EFBFBD> @70pcH<63> ٠ P<> B !<04> <> <EFBFBD> <EFBFBD> \" ¤<> N<EFBFBD> 1 ϖ<> <CF96> *<2A> <1A> D<EFBFBD> <44> P<EFBFBD> <50> ˪<EFBFBD> <CBAA> <EFBFBD> <08> <> ¯ p<> F0<46> <30> \0 <EFBFBD> P<EFBFBD> <EFBFBD> BJ<42> <4A> M<EFBFBD> <02> M<EFBFBD> <4D> <EFBFBD> <08> <0C> l<EFBFBD> \0 <EFBFBD> <EFBFBD> E<06> <> <EFBFBD> <0E> <> Z<08> #N<> <4E> <EFBFBD> %D<> <44> %<25> 'bB<62> \$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> %<25> <02> <> 6'd<> -<2D> <> @<40> <<0F> <> <EFBFBD> <EFBFBD> k<EFBFBD> v<EFBFBD> <76> <EFBFBD> <EFBFBD> O<EFBFBD> yM<79> ٬<EFBFBD> <0B> <> j<EFBFBD> /<2F> \r <0C> <18> <> <EFBFBD> 6mȜ e<C89C> <65> <EFBFBD> <EFBFBD> \" <EFBFBD> -J<> 2<EFBFBD> D<EFBFBD> <44> <EFBFBD> <05> v\$ <EFBFBD> f<EFBFBD> B<EFBFBD> <01> <20> \n <EFBFBD> <18> \\ " ; break ; case " ar " : $g = " <EFBFBD> C<EFBFBD> P<EFBFBD> <> <C28D> l*<2A> \r <EFBFBD> ,&\n <EFBFBD> A<EFBFBD> <15> <> <EFBFBD> (J.<19> <> 0T2 ]6QM<51> <4D> O<02> !b<11> #e<02> \\ ɥ<12> \$ <EFBFBD> \\ \n l+[ \n <EFBFBD> d<EFBFBD> k4<EFBFBD> O<EFBFBD> <EFBFBD> &<26> ղ<EFBFBD> <D5B2> <EFBFBD> Q )̅7lI<6C> <49> <EFBFBD> <0C> E\$ <EFBFBD> ʑ<13> <> m_7 GT\r <EFBFBD> eDك) *Vʙ<56> 'T6U1<55> z<EFBFBD> H<EFBFBD> ]N*PZ,<2C> BT`<60> <> <EFBFBD> <EFBFBD> % VD<56> 5<EFBFBD> AU0<55> H<EFBFBD> S<EFBFBD> d!iQl(p (N<12> <> <EFBFBD> 1<EFBFBD> e4<65> nY7<59> D<06> <09> <> 7<1B> <03> <> <EFBFBD> i6 L<> S<EFBFBD> <53> <EFBFBD> <EFBFBD> :<3A> <0C> <13> <> <EFBFBD> h4<68> N<EFBFBD> 栭<> 6 I<> Eq<0B> <> n<EFBFBD> h /<03> \\ <EFBFBD> QY2<EFBFBD> <EFBFBD> <EFBFBD> n3<EFBFBD> '<27> <> <EFBFBD> v <09> le<6C> <65> <16> <> <1D> <> <EFBFBD> 7<EFBFBD> F tl.n<> l?O <B?<08> <> [%<1B> !<21> <> <07> Ez<45> <7A> -<2D> k<1E> <> <EFBFBD> <EFBFBD> )<29> <> <EFBFBD> <EFBFBD> @<40> \n <<3C> <> <EFBFBD> <EFBFBD> n<EFBFBD> <6E> <EFBFBD> <EFBFBD> <04> <> <EFBFBD> s \" B<EFBFBD> !<15> <> <EFBFBD> <EFBFBD> *<2A> \\ <EFBFBD> '<27> b<EFBFBD> U'<05> <04> H<EFBFBD> A<EFBFBD> U<EFBFBD> <55> <EFBFBD> ܑ<EFBFBD> ,<2C> ∮h<04> <> <EFBFBD> R<EFBFBD> <04> ti !<05> /<2F> q<EFBFBD> :<3A> GP\n <EFBFBD> @<40> <> <06> <> \n <1E> e<EFBFBD> :<3A> .<2E> \n &T<> <54> <EFBFBD> F<EFBFBD> <46> <0B> <> <EFBFBD> ?I<> <49> <EFBFBD> <EFBFBD> h<EFBFBD> \\ <EFBFBD> IL}\n <EFBFBD> ;<3B> U<18> C<EFBFBD> <43> p<EFBFBD> <70> &<26> l<EFBFBD> O<EFBFBD> ]<02> <> <EFBFBD> <EFBFBD> 6<EFBFBD> !<21> <> ޑ<EFBFBD> p<> <H LSU\\ oH(L<> Kɥ<4B> <C9A5> <EFBFBD> B<EFBFBD> r<12> <> <EFBFBD> <16> <> e)<29> 0<> <30> I 2*ڥY'<27> RF \\ <EFBFBD> JtU<74> <55> dE+(<28> =YS6I<36> TUrj<72> Y><3E> <> \$ <EFBFBD> <16> <> <EFBFBD> <EFBFBD> <EFBFBD> <09> MU è<> 67<36> cr<63> <72> c<08> <> Mp<4D> <02> <> <EFBFBD> \0 <EFBFBD> (<28> <> <EFBFBD> ea<65> <61> <EFBFBD> k<K<> <12> <> <15> <> <EFBFBD> YOU<4F> <55> <EFBFBD> OS<4F> IN<49> <0C> VW<56> t_c<5F> <05> R<EFBFBD> I<EFBFBD> <49> 2<EFBFBD> <32> Qn<51> f9J<16> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \\ <EFBFBD> I<0C> <> V A`\n <EFBFBD> <0E> U<EFBFBD> { e<EFBFBD> <0F> \\ <EFBFBD> W<EFBFBD> <EFBFBD> 6<EFBFBD> c<EFBFBD> <EFBFBD> ƫ<EFBFBD> :&O fU<66> *<2A> <> #<23> <> 6 MCT0<54> Mx<4D> 3<0C> c<EFBFBD> 2<EFBFBD> Ѕ \r <EFBFBD> L<EFBFBD> lP\n <EFBFBD> { d6<EFBFBD> <EFBFBD> <EFBFBD> @:<3A> Ø<EFBFBD> 1<EFBFBD> m<EFBFBD> <6D> 3^<5E> \0 <EFBFBD> 7<EFBFBD> <EFBFBD> 8<EFBFBD> 7Ö<37> 0<EFBFBD> <30> <0B> r<> \0 @6<> 㫊 aJn!<21> b<EFBFBD> <62> o#X<> 7 <20> 6S.<2E> <> <EFBFBD> \r <EFBFBD> <EFBFBD> Pj OP}2<> *P<> <20> !<21> <> 2T<32> hl\\ <EFBFBD> <EFBFBD> 3\0 <EFBFBD> > !<0E> ֲ<<3C> l<11> <> i &<26> r<EFBFBD> <72> Њ<EFBFBD> <0E> RDC <09> <08> <> <EFBFBD> M<EFBFBD> <4D> 9<EFBFBD> <39> x<EFBFBD> `<60> <> <EFBFBD> <EFBFBD> 4<EFBFBD> #'b -^<5E> 3<07> <10> <03> p @<40> <17> x<0B> ds<64> <73> 2<EFBFBD> \\ <EFBFBD> <EFBFBD> 8/upH< W Cxn<05> <> |<7C> #v<1F> _9<5F> <39> 5<EFBFBD> | Chp7!<21> Շ@x<0B> >D.l2<6C> pްM<DEB0> <4D> .<2E> <> Cg [<5B> \r <EFBFBD> Ш0#\$ <EFBFBD> <EFBFBD> !/BO}&<26> &<08> L<0B> !/1<01> <> 0h<0B> W\$ <EFBFBD> <EFBFBD> <EFBFBD> <15> X<EFBFBD> <58> R dF<64> 4<04> b<EFBFBD> <62> <EFBFBD> !<21> X<EFBFBD> <58> 8<EFBFBD> V<EFBFBD> <56> <EFBFBD> x<EFBFBD> LZ*<2A> \\ <EFBFBD> <EFBFBD> <EFBFBD> sQ <1D> <> 2PQ\" <EFBFBD> <EFBFBD> 1\$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <14> <18> X/d<18> b<> N<7F> [|B<11> Ţ<EFBFBD> R\" =<3D> OX<4F> <58> p<EFBFBD> F<EFBFBD> ɩ <01> 4<EFBFBD> c<0F> <> <EFBFBD> <EFBFBD> <> <DEB6> M<> ><0C> <> 7<EFBFBD> <37> @ `So}' Ղ \0 <EFBFBD> <EFBFBD> <EFBFBD> I<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ݼT<EFBFBD> McTc\n <)<29> B DT<44> <54> 1<11> J<EFBFBD> <4A> \n <EFBFBD> <EFBFBD> <EFBFBD> [&<26> <> Z<EFBFBD> Bt<42> c<F<> * ۞<> 6Of<4F> <66> YI셥
2014-04-01 18:00:42 +00:00
Min_PDO
extends
PDO { var $_result , $server_info , $affected_rows , $errno , $error ; function
2015-04-01 06:36:56 +00:00
__construct (){ global $b ; $xf = array_search ( " SQL " , $b -> operators ); if ( $xf !== false ) unset ( $b -> operators [ $xf ]);} function
dsn ( $cc , $V , $G ){ try { parent :: __construct ( $cc , $V , $G );} catch ( Exception $uc ){ auth_error ( $uc -> getMessage ());} $this -> setAttribute ( 13 , array ( 'Min_PDOStatement' )); $this -> server_info = $this -> getAttribute ( 4 );} function
query ( $H , $Ch = 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
2015-04-01 06:36:56 +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 ;}}} $Xb = array (); class
2014-04-01 18:00:42 +00:00
Min_SQL { var $_conn ; function
Min_SQL ( $h ){ $this -> _conn = $h ;} function
2015-04-01 06:36:56 +00:00
select ( $Q , $M , $Z , $Xc , $Xe = array (), $z = 1 , $E = 0 , $Ef = false ){ global $b , $w ; $Ad = ( count ( $Xc ) < count ( $M )); $H = $b -> selectQueryBuild ( $M , $Z , $Xc , $Xe , $z , $E ); if ( ! $H ) $H = " SELECT " . limit (( $_GET [ " page " ] != " last " &&+ $z && $Xc && $Ad && $w == " sql " ? " SQL_CALC_FOUND_ROWS " : " " ) . implode ( " , " , $M ) . " \n FROM " . table ( $Q ),( $Z ? " \n WHERE " . implode ( " AND " , $Z ) : " " ) . ( $Xc && $Ad ? " \n GROUP BY " . implode ( " , " , $Xc ) : " " ) . ( $Xe ? " \n ORDER BY " . implode ( " , " , $Xe ) : " " ),( $z != " " ? + $z : null ),( $E ? $z * $E : 0 ), " \n " ); $Hg = microtime ( true ); $J = $this -> _conn -> query ( $H ); if ( $Ef ) echo $b -> selectQuery ( $H , format_time ( $Hg )); return $J ;} function
delete ( $Q , $Nf , $z = 0 ){ $H = " FROM " . table ( $Q ); return
queries ( " DELETE " . ( $z ? limit1 ( $H , $Nf ) : " $H $Nf " ));} function
update ( $Q , $O , $Nf , $z = 0 , $vg = " \n " ){ $Th = array (); foreach ( $O
as $x => $X ) $Th [] = " $x = $X " ; $H = table ( $Q ) . " SET $vg " . implode ( " , $vg " , $Th ); return
queries ( " UPDATE " . ( $z ? limit1 ( $H , $Nf ) : " $H $Nf " ));} function
2014-04-01 18:00:42 +00:00
insert ( $Q , $O ){ return
queries ( " INSERT INTO " . table ( $Q ) . ( $O ? " ( " . implode ( " , " , array_keys ( $O )) . " ) \n VALUES ( " . implode ( " , " , $O ) . " ) " : " DEFAULT VALUES " ));} function
2015-04-01 06:36:56 +00:00
insertUpdate ( $Q , $L , $Cf ){ return
2014-04-01 18:00:42 +00:00
false ;} function
begin (){ return
queries ( " BEGIN " );} function
commit (){ return
queries ( " COMMIT " );} function
rollback (){ return
2015-04-01 06:36:56 +00:00
queries ( " ROLLBACK " );}} $Xb [ " sqlite " ] = " SQLite 3 " ; $Xb [ " sqlite2 " ] = " SQLite 2 " ; if ( isset ( $_GET [ " sqlite " ]) || isset ( $_GET [ " sqlite2 " ])){ $_f = 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
2015-04-01 06:36:56 +00:00
Min_SQLite ( $Ic ){ $this -> _link = new
SQLite3 ( $Ic ); $Wh = $this -> _link -> version (); $this -> server_info = $Wh [ " 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
quote ( $P ){ return ( is_utf8 ( $P ) ? " ' " . $this -> _link -> escapeString ( $P ) . " ' " : " x' " . reset ( unpack ( 'H*' , $P )) . " ' " );} function
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
Min_Result ( $I ){ $this -> _result = $I ;} function
fetch_assoc (){ return $this -> _result -> fetchArray ( SQLITE3_ASSOC );} function
fetch_row (){ return $this -> _result -> fetchArray ( SQLITE3_NUM );} function
fetch_field (){ $e = $this -> _offset ++ ; $U = $this -> _result -> columnType ( $e ); return ( object ) array ( " name " => $this -> _result -> columnName ( $e ), " type " => $U , " charsetnr " => ( $U == SQLITE3_BLOB ? 63 : 0 ),);} function
__desctruct (){ return $this -> _result -> finalize ();}}} else { class
Min_SQLite { var $extension = " SQLite " , $server_info , $affected_rows , $error , $_link ; function
2015-04-01 06:36:56 +00:00
Min_SQLite ( $Ic ){ $this -> server_info = sqlite_libversion (); $this -> _link = new
SQLiteDatabase ( $Ic );} function
query ( $H , $Ch = false ){ $se = ( $Ch ? " unbufferedQuery " : " query " ); $I =@ $this -> _link -> $se ( $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
quote ( $P ){ return " ' " . sqlite_escape_string ( $P ) . " ' " ;} function
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
Min_Result ( $I ){ $this -> _result = $I ; if ( method_exists ( $I , 'numRows' )) $this -> num_rows = $I -> numRows ();} function
fetch_assoc (){ $K = $this -> _result -> fetch ( SQLITE_ASSOC ); if ( ! $K ) return
false ; $J = array (); foreach ( $K
as $x => $X ) $J [( $x [ 0 ] == '"' ? idf_unescape ( $x ) : $x )] = $X ; return $J ;} function
fetch_row (){ return $this -> _result -> fetch ( SQLITE_NUM );} function
2015-04-01 06:36:56 +00:00
fetch_field (){ $C = $this -> _result -> fieldName ( $this -> _offset ++ ); $tf = '(\\[.*]|"(?:[^"]|"")*"|(.+))' ; if ( preg_match ( " ~^( $tf\\ .)? $tf\ $ ~ " , $C , $B )){ $Q = ( $B [ 3 ] != " " ? $B [ 3 ] : idf_unescape ( $B [ 2 ])); $C = ( $B [ 5 ] != " " ? $B [ 5 ] : idf_unescape ( $B [ 4 ]));} return ( object ) array ( " name " => $C , " orgname " => $C , " orgtable " => $Q ,);}}}} elseif ( extension_loaded ( " pdo_sqlite " )){ class
2014-04-01 18:00:42 +00:00
Min_SQLite
extends
Min_PDO { var $extension = " PDO_SQLite " ; function
2015-04-01 06:36:56 +00:00
Min_SQLite ( $Ic ){ $this -> dsn ( DRIVER . " : $Ic " , " " , " " );}}} if ( class_exists ( " Min_SQLite " )){ class
2014-04-01 18:00:42 +00:00
Min_DB
extends
Min_SQLite { function
Min_DB (){ $this -> Min_SQLite ( " :memory: " );} function
2015-04-01 06:36:56 +00:00
select_db ( $Ic ){ if ( is_readable ( $Ic ) && $this -> query ( " ATTACH " . $this -> quote ( preg_match ( " ~(^[/ \\ \\ ]|:)~ " , $Ic ) ? $Ic : dirname ( $_SERVER [ " SCRIPT_FILENAME " ]) . " / $Ic " ) . " AS a " )){ $this -> Min_SQLite ( $Ic ); 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
2015-04-01 06:36:56 +00:00
insertUpdate ( $Q , $L , $Cf ){ $Th = array (); foreach ( $L
as $O ) $Th [] = " ( " . implode ( " , " , $O ) . " ) " ; return
queries ( " REPLACE INTO " . table ( $Q ) . " ( " . implode ( " , " , array_keys ( reset ( $L ))) . " ) VALUES \n " . implode ( " , \n " , $Th ));}} function
2014-04-01 18:00:42 +00:00
idf_escape ( $t ){ return '"' . str_replace ( '"' , '""' , $t ) . '"' ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ return
new
Min_DB ;} function
get_databases (){ return
array ();} function
2015-04-01 06:36:56 +00:00
limit ( $H , $Z , $z , $D = 0 , $vg = " " ){ return " $H $Z " . ( $z !== null ? $vg . " LIMIT $z " . ( $D ? " OFFSET $D " : " " ) : " " );} function
2014-04-01 18:00:42 +00:00
limit1 ( $H , $Z ){ global $h ; return ( $h -> result ( " SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT') " ) ? limit ( $H , $Z , 1 ) : " $H $Z " );} function
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){ global $h ; return $h -> 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
table_status ( $C = " " ){ global $h ; $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 " ] = $h -> 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 ( $R ){ return $R [ " Engine " ] == " view " ;} function
fk_support ( $R ){ global $h ; return ! $h -> result ( " SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY') " );} function
2015-04-01 06:36:56 +00:00
fields ( $Q ){ global $h ; $J = array (); $Cf = " " ; foreach ( get_rows ( " PRAGMA table_info( " . table ( $Q ) . " ) " ) as $K ){ $C = $K [ " name " ]; $U = strtolower ( $K [ " type " ]); $Lb = $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 ( " ~'(.*)'~ " , $Lb , $B ) ? str_replace ( " '' " , " ' " , $B [ 1 ]) : ( $Lb == " NULL " ? null : $Lb )), " null " =>! $K [ " notnull " ], " privileges " => array ( " select " => 1 , " insert " => 1 , " update " => 1 ), " primary " => $K [ " pk " ],); if ( $K [ " pk " ]){ if ( $Cf != " " ) $J [ $Cf ][ " auto_increment " ] = false ; elseif ( preg_match ( '~^integer$~i' , $U )) $J [ $C ][ " auto_increment " ] = true ; $Cf = $C ;}} $Fg = $h -> result ( " SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q ( $Q )); preg_match_all ( '~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i' , $Fg , $ee , PREG_SET_ORDER ); foreach ( $ee
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
2015-04-01 06:36:56 +00:00
indexes ( $Q , $i = null ){ global $h ; if ( ! is_object ( $i )) $i = $h ; $J = array (); $Fg = $i -> result ( " SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . q ( $Q )); if ( preg_match ( '~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*")++)~i' , $Fg , $B )){ $J [ " " ] = array ( " type " => " PRIMARY " , " columns " => array (), " lengths " => array (), " descs " => array ()); preg_match_all ( '~((("[^"]*+")+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i' , $B [ 1 ], $ee , PREG_SET_ORDER ); foreach ( $ee
as $B ){ $J [ " " ][ " columns " ][] = idf_unescape ( $B [ 2 ]) . $B [ 4 ]; $J [ " " ][ " descs " ][] = ( preg_match ( '~DESC~i' , $B [ 5 ]) ? '1' : null );}} if ( ! $J ){ foreach ( fields ( $Q ) as $C => $o ){ if ( $o [ " primary " ]) $J [ " " ] = array ( " type " => " PRIMARY " , " columns " => array ( $C ), " lengths " => array (), " descs " => array ( null ));}} $Gg = get_key_vals ( " SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q ( $Q ), $i ); foreach ( get_rows ( " PRAGMA index_list( " . table ( $Q ) . " ) " , $i ) as $K ){ $C = $K [ " name " ]; $u = array ( " type " => ( $K [ " unique " ] ? " UNIQUE " : " INDEX " )); $u [ " lengths " ] = array (); $u [ " descs " ] = array (); foreach ( get_rows ( " PRAGMA index_info( " . idf_escape ( $C ) . " ) " , $i ) as $lg ){ $u [ " columns " ][] = $lg [ " name " ]; $u [ " descs " ][] = null ;} if ( preg_match ( '~^CREATE( UNIQUE)? INDEX ' . preg_quote ( idf_escape ( $C ) . ' ON ' . idf_escape ( $Q ), '~' ) . ' \((.*)\)$~i' , $Gg [ $C ], $Yf )){ preg_match_all ( '/("[^"]*+")+( DESC)?/' , $Yf [ 2 ], $ee ); foreach ( $ee [ 2 ] as $x => $X ){ if ( $X ) $u [ " descs " ][ $x ] = '1' ;}} if ( ! $J [ " " ] || $u [ " type " ] != " UNIQUE " || $u [ " columns " ] != $J [ " " ][ " columns " ] || $u [ " descs " ] != $J [ " " ][ " descs " ] ||! preg_match ( " ~^sqlite_~ " , $C )) $J [ $C ] = $u ;} return $J ;} function
foreign_keys ( $Q ){ $J = array (); foreach ( get_rows ( " PRAGMA foreign_key_list( " . table ( $Q ) . " ) " ) as $K ){ $q =& $J [ $K [ " id " ]]; if ( ! $q ) $q = $K ; $q [ " source " ][] = $K [ " from " ]; $q [ " target " ][] = $K [ " to " ];} return $J ;} function
2014-04-01 18:00:42 +00:00
view ( $C ){ global $h ; return
array ( " select " => preg_replace ( '~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\\s+~iU' , '' , $h -> result ( " SELECT sql FROM sqlite_master WHERE name = " . q ( $C ))));} function
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
error (){ global $h ; return
h ( $h -> error );} function
2015-04-01 06:36:56 +00:00
check_sqlite_name ( $C ){ global $h ; $Cc = " db|sdb|sqlite " ; if ( ! preg_match ( " ~^[^ \\ 0]* \\ .( $Cc ) \$ ~ " , $C )){ $h -> error = lang ( 21 , str_replace ( " | " , " , " , $Cc )); return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2015-04-01 06:36:56 +00:00
create_database ( $m , $d ){ global $h ; if ( file_exists ( $m )){ $h -> error = lang ( 22 ); return
false ;} if ( ! check_sqlite_name ( $m )) return
2014-04-01 18:00:42 +00:00
false ; try { $_ = new
2015-04-01 06:36:56 +00:00
Min_SQLite ( $m );} catch ( Exception $uc ){ $h -> error = $uc -> 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
2015-04-01 06:36:56 +00:00
drop_databases ( $l ){ global $h ; $h -> Min_SQLite ( " :memory: " ); foreach ( $l
as $m ){ if ( !@ unlink ( $m )){ $h -> error = lang ( 22 ); return
2014-04-01 18:00:42 +00:00
false ;}} return
true ;} function
rename_database ( $C , $d ){ global $h ; if ( ! check_sqlite_name ( $C )) return
2015-04-01 06:36:56 +00:00
false ; $h -> Min_SQLite ( " :memory: " ); $h -> 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
2015-04-01 06:36:56 +00:00
alter_table ( $Q , $C , $p , $Mc , $rb , $nc , $d , $La , $of ){ $Nh = ( $Q == " " || $Mc ); foreach ( $p
as $o ){ if ( $o [ 0 ] != " " ||! $o [ 1 ] || $o [ 2 ]){ $Nh = true ; break ;}} $c = array (); $ff = array (); foreach ( $p
as $o ){ if ( $o [ 1 ]){ $c [] = ( $Nh ? $o [ 1 ] : " ADD " . implode ( $o [ 1 ])); if ( $o [ 0 ] != " " ) $ff [ $o [ 0 ]] = $o [ 1 ][ 0 ];}} if ( ! $Nh ){ foreach ( $c
2014-04-01 18:00:42 +00:00
as $X ){ if ( ! queries ( " ALTER TABLE " . table ( $Q ) . " $X " )) return
false ;} if ( $Q != $C &&! queries ( " ALTER TABLE " . table ( $Q ) . " RENAME TO " . table ( $C ))) return
2015-04-01 06:36:56 +00:00
false ;} elseif ( ! recreate_table ( $Q , $C , $c , $ff , $Mc )) return
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
2015-04-01 06:36:56 +00:00
recreate_table ( $Q , $C , $p , $ff , $Mc , $v = array ()){ if ( $Q != " " ){ if ( ! $p ){ foreach ( fields ( $Q ) as $x => $o ){ $p [] = process_field ( $o , $o ); $ff [ $x ] = idf_escape ( $x );}} $Df = false ; foreach ( $p
as $o ){ if ( $o [ 6 ]) $Df = true ;} $ac = array (); foreach ( $v
as $x => $X ){ if ( $X [ 2 ] == " DROP " ){ $ac [ $X [ 1 ]] = true ; unset ( $v [ $x ]);}} foreach ( indexes ( $Q ) as $Jd => $u ){ $f = array (); foreach ( $u [ " columns " ] as $x => $e ){ if ( ! $ff [ $e ]) continue
2 ; $f [] = $ff [ $e ] . ( $u [ " descs " ][ $x ] ? " DESC " : " " );} if ( ! $ac [ $Jd ]){ if ( $u [ " type " ] != " PRIMARY " ||! $Df ) $v [] = array ( $u [ " type " ], $Jd , $f );}} foreach ( $v
as $x => $X ){ if ( $X [ 0 ] == " PRIMARY " ){ unset ( $v [ $x ]); $Mc [] = " PRIMARY KEY ( " . implode ( " , " , $X [ 2 ]) . " ) " ;}} foreach ( foreign_keys ( $Q ) as $Jd => $q ){ foreach ( $q [ " source " ] as $x => $e ){ if ( ! $ff [ $e ]) continue
2 ; $q [ " source " ][ $x ] = idf_unescape ( $ff [ $e ]);} if ( ! isset ( $Mc [ " $Jd " ])) $Mc [] = " " . format_foreign_key ( $q );} queries ( " BEGIN " );} foreach ( $p
as $x => $o ) $p [ $x ] = " " . implode ( $o ); $p = array_merge ( $p , array_filter ( $Mc )); if ( ! queries ( " CREATE TABLE " . table ( $Q != " " ? " adminer_ $C " : $C ) . " ( \n " . implode ( " , \n " , $p ) . " \n ) " )) return
false ; if ( $Q != " " ){ if ( $ff &&! queries ( " INSERT INTO " . table ( " adminer_ $C " ) . " ( " . implode ( " , " , $ff ) . " ) SELECT " . implode ( " , " , array_map ( 'idf_escape' , array_keys ( $ff ))) . " FROM " . table ( $Q ))) return
false ; $zh = array (); foreach ( triggers ( $Q ) as $xh => $kh ){ $wh = trigger ( $xh ); $zh [] = " CREATE TRIGGER " . idf_escape ( $xh ) . " " . implode ( " " , $kh ) . " ON " . table ( $C ) . " \n $wh[Statement] " ;} if ( ! queries ( " DROP TABLE " . table ( $Q ))) return
2014-04-01 18:00:42 +00:00
false ; queries ( " ALTER TABLE " . table ( " adminer_ $C " ) . " RENAME TO " . table ( $C )); if ( ! alter_indexes ( $C , $v )) return
2015-04-01 06:36:56 +00:00
false ; foreach ( $zh
as $wh ){ if ( ! queries ( $wh )) return
2014-04-01 18:00:42 +00:00
false ;} queries ( " COMMIT " );} return
true ;} function
index_sql ( $Q , $U , $C , $f ){ return " CREATE $U " . ( $U != " INDEX " ? " INDEX " : " " ) . idf_escape ( $C != " " ? $C : uniqid ( $Q . " _ " )) . " ON " . table ( $Q ) . " $f " ;} function
alter_indexes ( $Q , $c ){ foreach ( $c
2015-04-01 06:36:56 +00:00
as $Cf ){ if ( $Cf [ 0 ] == " PRIMARY " ) return
2014-04-01 18:00:42 +00:00
recreate_table ( $Q , $Q , array (), array (), array (), $c );} foreach ( array_reverse ( $c ) as $X ){ if ( ! queries ( $X [ 2 ] == " DROP " ? " DROP INDEX " . idf_escape ( $X [ 1 ]) : index_sql ( $Q , $X [ 0 ], $X [ 1 ], " ( " . implode ( " , " , $X [ 2 ]) . " ) " ))) return
false ;} return
true ;} function
truncate_tables ( $S ){ return
apply_queries ( " DELETE FROM " , $S );} function
2015-04-01 06:36:56 +00:00
drop_views ( $Yh ){ return
apply_queries ( " DROP VIEW " , $Yh );} function
2014-04-01 18:00:42 +00:00
drop_tables ( $S ){ return
apply_queries ( " DROP TABLE " , $S );} function
2015-04-01 06:36:56 +00:00
move_tables ( $S , $Yh , $bh ){ return
2014-04-01 18:00:42 +00:00
false ;} function
trigger ( $C ){ global $h ; if ( $C == " " ) return
2015-04-01 06:36:56 +00:00
array ( " Statement " => " BEGIN \n \t ; \n END " ); $t = '(?:[^`"\\s]+|`[^`]*`|"[^"]*")+' ; $yh = trigger_options (); preg_match ( " ~^CREATE \\ s+TRIGGER \\ s* $t\\s *( " . implode ( " | " , $yh [ " Timing " ]) . " ) \\ s+([a-z]+)(?: \\ s+OF \\ s+( $t ))? \\ s+ON \\ s* $t\\s *(?:FOR \\ s+EACH \\ s+ROW \\ s)?(.*)~is " , $h -> result ( " SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = " . q ( $C )), $B ); $Ge = $B [ 3 ]; return
array ( " Timing " => strtoupper ( $B [ 1 ]), " Event " => strtoupper ( $B [ 2 ]) . ( $Ge ? " OF " : " " ), " Of " => ( $Ge [ 0 ] == '`' || $Ge [ 0 ] == '"' ? idf_unescape ( $Ge ) : $Ge ), " Trigger " => $C , " Statement " => $B [ 4 ],);} function
triggers ( $Q ){ $J = array (); $yh = trigger_options (); foreach ( get_rows ( " SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $Q )) as $K ){ preg_match ( '~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*(' . implode ( " | " , $yh [ " 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
last_id (){ global $h ; return $h -> result ( " SELECT LAST_INSERT_ROWID() " );} function
2015-04-01 06:36:56 +00:00
explain ( $h , $H ){ return $h -> query ( " EXPLAIN QUERY PLAN $H " );} function
2014-04-01 18:00:42 +00:00
found_rows ( $R , $Z ){} function
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2015-04-01 06:36:56 +00:00
set_schema ( $pg ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
create_sql ( $Q , $La ){ global $h ; $J = $h -> result ( " SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = " . q ( $Q )); foreach ( indexes ( $Q ) as $C => $u ){ if ( $C == '' ) continue ; $J .= " ; \n \n " . index_sql ( $Q , $u [ 'type' ], $C , " ( " . implode ( " , " , array_map ( 'idf_escape' , $u [ 'columns' ])) . " ) " );} return $J ;} function
2014-04-01 18:00:42 +00:00
truncate_sql ( $Q ){ return " DELETE FROM " . table ( $Q );} function
2015-04-01 06:36:56 +00:00
use_sql ( $Gb ){} function
trigger_sql ( $Q , $Mg ){ return
2014-04-01 18:00:42 +00:00
implode ( get_vals ( " SELECT sql || ';; \n ' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $Q )));} function
show_variables (){ global $h ; $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 $x ) $J [ $x ] = $h -> result ( " PRAGMA $x " ); return $J ;} function
2015-04-01 06:36:56 +00:00
show_status (){ $J = array (); foreach ( get_vals ( " PRAGMA compile_options " ) as $Ue ){ list ( $x , $X ) = explode ( " = " , $Ue , 2 ); $J [ $x ] = $X ;} return $J ;} function
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
support ( $Fc ){ return
preg_match ( '~^(columns|database|drop_col|dump|indexes|move_col|sql|status|table|trigger|variables|view|view_trigger)$~' , $Fc );} $w = " sqlite " ; $Bh = array ( " integer " => 0 , " real " => 0 , " numeric " => 0 , " text " => 0 , " blob " => 0 ); $Lg = array_keys ( $Bh ); $Ih = array (); $Se = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Uc = array ( " hex " , " length " , " lower " , " round " , " unixepoch " , " upper " ); $Zc = array ( " avg " , " count " , " count distinct " , " group_concat " , " max " , " min " , " sum " ); $fc = array ( array (), array ( " integer|real|numeric " => " +/- " , " text " => " || " ,));} $Xb [ " pgsql " ] = " PostgreSQL " ; if ( isset ( $_GET [ " pgsql " ])){ $_f = 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
2015-04-01 06:36:56 +00:00
_error ( $qc , $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 ){ $Wh = pg_version ( $this -> _link ); $this -> server_info = $Wh [ " server " ]; pg_set_client_encoding ( $this -> _link , " UTF8 " );} return ( bool ) $this -> _link ;} function
2014-04-01 18:00:42 +00:00
quote ( $P ){ return " ' " . pg_escape_string ( $this -> _link , $P ) . " ' " ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ global $b ; if ( $Gb == $b -> database ()) return $this -> _database ; $J =@ pg_connect ( " $this->_string dbname=' " . addcslashes ( $Gb , " ' \\ " ) . " ' " , 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
2015-04-01 06:36:56 +00:00
query ( $H , $Ch = 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
Min_Result ( $I ){ $this -> _result = $I ; $this -> num_rows = pg_num_rows ( $I );} function
fetch_assoc (){ return
pg_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
pg_fetch_row ( $this -> _result );} function
fetch_field (){ $e = $this -> _offset ++ ; $J = new
stdClass ; if ( function_exists ( 'pg_field_table' )) $J -> orgtable = pg_field_table ( $this -> _result , $e ); $J -> name = pg_field_name ( $this -> _result , $e ); $J -> orgname = $J -> name ; $J -> type = pg_field_type ( $this -> _result , $e ); $J -> charsetnr = ( $J -> type == " bytea " ? 63 : 0 ); return $J ;} function
__destruct (){ pg_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_pgsql " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_PgSQL " ; function
2015-04-01 06:36:56 +00:00
connect ( $N , $V , $G ){ global $b ; $m = $b -> database (); $P = " pgsql:host=' " . str_replace ( " : " , " ' port=' " , addcslashes ( $N , " ' \\ " )) . " ' options='-c client_encoding=utf8' " ; $this -> dsn ( " $P dbname=' " . ( $m != " " ? addcslashes ( $m , " ' \\ " ) : " postgres " ) . " ' " , $V , $G ); return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ global $b ; return ( $b -> database () == $Gb );} function
2014-04-01 18:00:42 +00:00
close (){}}} class
Min_Driver
extends
Min_SQL { function
2015-04-01 06:36:56 +00:00
insertUpdate ( $Q , $L , $Cf ){ global $h ; foreach ( $L
as $O ){ $Jh = array (); $Z = array (); foreach ( $O
as $x => $X ){ $Jh [] = " $x = $X " ; if ( isset ( $Cf [ idf_unescape ( $x )])) $Z [] = " $x = $X " ;} if ( ! (( $Z && queries ( " UPDATE " . table ( $Q ) . " SET " . implode ( " , " , $Jh ) . " WHERE " . implode ( " AND " , $Z )) && $h -> affected_rows ) || queries ( " INSERT INTO " . table ( $Q ) . " ( " . implode ( " , " , array_keys ( $O )) . " ) VALUES ( " . implode ( " , " , $O ) . " ) " ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;}} function
idf_escape ( $t ){ return '"' . str_replace ( '"' , '""' , $t ) . '"' ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ global $b ; $h = new
2015-04-01 06:36:56 +00:00
Min_DB ; $k = $b -> credentials (); if ( $h -> connect ( $k [ 0 ], $k [ 1 ], $k [ 2 ])){ if ( $h -> server_info >= 9 ) $h -> query ( " SET application_name = 'Adminer' " ); return $h ;} return $h -> error ;} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
get_vals ( " SELECT datname FROM pg_database ORDER BY datname " );} function
2015-04-01 06:36:56 +00:00
limit ( $H , $Z , $z , $D = 0 , $vg = " " ){ return " $H $Z " . ( $z !== null ? $vg . " LIMIT $z " . ( $D ? " OFFSET $D " : " " ) : " " );} function
2014-04-01 18:00:42 +00:00
limit1 ( $H , $Z ){ return " $H $Z " ;} function
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){ global $h ; return $h -> result ( " SHOW LC_COLLATE " );} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
logged_user (){ global $h ; return $h -> 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
2015-04-01 06:36:56 +00:00
table_status ( $C = " " ){ $J = array (); foreach ( get_rows ( " SELECT relname AS \" Name \" , CASE relkind WHEN 'r' THEN 'table' WHEN 'mv' THEN 'materialized view' WHEN 'f' THEN 'foreign table' ELSE 'view' END AS \" Engine \" , pg_relation_size(oid) AS \" Data_length \" , pg_total_relation_size(oid) - pg_relation_size(oid) AS \" Index_length \" , obj_description(oid, 'pg_class') AS \" Comment \" , relhasoids::int AS \" Oid \" , reltuples as \" Rows \"
2014-04-01 18:00:42 +00:00
FROM pg_class
2015-04-01 06:36:56 +00:00
WHERE relkind IN ( 'r' , 'v' , 'mv' , 'f' )
2014-04-01 18:00:42 +00:00
AND relnamespace = ( SELECT oid FROM pg_namespace WHERE nspname = current_schema ())
" .( $C != " " ? " AND relname = " .q( $C ): " ORDER BY relname " ))as $K ) $J[$K["Name"] ]= $K ;return( $C != " " ? $J[$C] : $J );}function
2015-04-01 06:36:56 +00:00
is_view ( $R ){ return
in_array ( $R [ " Engine " ], array ( " view " , " materialized view " ));} function
2014-04-01 18:00:42 +00:00
fk_support ( $R ){ return
true ;} function
2015-04-01 06:36:56 +00:00
fields ( $Q ){ $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
WHERE c . relname = " .q( $Q ). "
AND n . nspname = current_schema ()
AND NOT a . attisdropped
AND a . attnum > 0
2015-04-01 06:36:56 +00:00
ORDER BY a . attnum " )as $K ) { preg_match('~([^([]+)( \ ((.*) \ ))?([a-z ]+)?(( \ [[0-9]*])*) $ ~', $K["full_type"] , $B );list(, $U , $y , $K["length"] , $wa , $Fa )= $B ; $K["length"] .= $Fa ; $cb = $U . $wa ;if(isset( $Ca[$cb] )) { $K [ " type " ] = $Ca [ $cb ]; $K [ " full_type " ] = $K [ " type " ] . $y . $Fa ; } else { $K [ " type " ] = $U ; $K [ " full_type " ] = $K [ " type " ] . $y . $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 ( $Q , $i = null ){ global $h ; if ( ! is_object ( $i )) $i = $h ; $J = array (); $Ug = $i -> result ( " SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q ( $Q )); $f = get_key_vals ( " SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Ug AND attnum > 0 " , $i ); foreach ( get_rows ( " SELECT relname, indisunique::int, indisprimary::int, indkey, indoption FROM pg_index i, pg_class ci WHERE i.indrelid = $Ug AND ci.oid = i.indexrelid " , $i ) as $K ){ $Zf = $K [ " relname " ]; $J [ $Zf ][ " type " ] = ( $K [ " indisprimary " ] ? " PRIMARY " : ( $K [ " indisunique " ] ? " UNIQUE " : " INDEX " )); $J [ $Zf ][ " columns " ] = array (); foreach ( explode ( " " , $K [ " indkey " ]) as $qd ) $J [ $Zf ][ " columns " ][] = $f [ $qd ]; $J [ $Zf ][ " descs " ] = array (); foreach ( explode ( " " , $K [ " indoption " ]) as $rd ) $J [ $Zf ][ " descs " ][] = ( $rd & 1 ? '1' : null ); $J [ $Zf ][ " lengths " ] = array ();} return $J ;} function
foreign_keys ( $Q ){ global $Ne ; $J = array (); foreach ( get_rows ( " SELECT conname, pg_get_constraintdef(oid) AS definition
2014-04-01 18:00:42 +00:00
FROM pg_constraint
WHERE conrelid = ( SELECT pc . oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON ( pn . oid = pc . relnamespace ) WHERE pc . relname = " .q( $Q ). " AND pn . nspname = current_schema ())
AND contype = 'f' :: char
2015-04-01 06:36:56 +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 ], $de )){ $K [ 'ns' ] = str_replace ( '""' , '"' , preg_replace ( '~^"(.+)"$~' , '\1' , $de [ 2 ])); $K [ 'table' ] = str_replace ( '""' , '"' , preg_replace ( '~^"(.+)"$~' , '\1' , $de [ 4 ])); } $K['target'] =array_map('trim',explode(',', $B[3] )); $K['on_delete'] =(preg_match( " ~ ON DELETE ( $Ne ) ~ " , $B[4] , $de )? $de[1] :'NO ACTION'); $K['on_update'] =(preg_match( " ~ ON UPDATE ( $Ne ) ~ " , $B[4] , $de )? $de[1] :'NO ACTION'); $J[$K['conname'] ]= $K ;}}return $J ;}function
2014-04-01 18:00:42 +00:00
view ( $C ){ global $h ; return
array ( " select " => $h -> result ( " SELECT pg_get_viewdef( " . q ( $C ) . " ) " ));} function
collations (){ return
array ();} function
2015-04-01 06:36:56 +00:00
information_schema ( $m ){ return ( $m == " information_schema " );} function
2014-04-01 18:00:42 +00:00
error (){ global $h ; $J = h ( $h -> 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
nl_br ( $J );} function
2015-04-01 06:36:56 +00:00
create_database ( $m , $d ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $d ? " ENCODING " . idf_escape ( $d ) : " " ));} function
drop_databases ( $l ){ global $h ; $h -> close (); return
apply_queries ( " DROP DATABASE " , $l , 'idf_escape' );} function
2014-04-01 18:00:42 +00:00
rename_database ( $C , $d ){ return
queries ( " ALTER DATABASE " . idf_escape ( DB ) . " RENAME TO " . idf_escape ( $C ));} function
auto_increment (){ return " " ;} function
2015-04-01 06:36:56 +00:00
alter_table ( $Q , $C , $p , $Mc , $rb , $nc , $d , $La , $of ){ $c = array (); $Mf = array (); foreach ( $p
as $o ){ $e = idf_escape ( $o [ 0 ]); $X = $o [ 1 ]; if ( ! $X ) $c [] = " DROP $e " ; else { $Sh = $X [ 5 ]; unset ( $X [ 5 ]); if ( isset ( $X [ 6 ]) && $o [ 0 ] == " " ) $X [ 1 ] = ( $X [ 1 ] == " bigint " ? " big " : " " ) . " serial " ; if ( $o [ 0 ] == " " ) $c [] = ( $Q != " " ? " ADD " : " " ) . implode ( $X ); else { if ( $e != $X [ 0 ]) $Mf [] = " ALTER TABLE " . table ( $Q ) . " RENAME $e TO $X[0] " ; $c [] = " ALTER $e TYPE $X[1] " ; if ( ! $X [ 6 ]){ $c [] = " ALTER $e " . ( $X [ 3 ] ? " SET $X[3] " : " DROP DEFAULT " ); $c [] = " ALTER $e " . ( $X [ 2 ] == " NULL " ? " DROP NOT " : " SET " ) . $X [ 2 ];}} if ( $o [ 0 ] != " " || $Sh != " " ) $Mf [] = " COMMENT ON COLUMN " . table ( $Q ) . " . $X[0] IS " . ( $Sh != " " ? substr ( $Sh , 9 ) : " '' " );}} $c = array_merge ( $c , $Mc ); if ( $Q == " " ) array_unshift ( $Mf , " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); elseif ( $c ) array_unshift ( $Mf , " ALTER TABLE " . table ( $Q ) . " \n " . implode ( " , \n " , $c )); if ( $Q != " " && $Q != $C ) $Mf [] = " ALTER TABLE " . table ( $Q ) . " RENAME TO " . table ( $C ); if ( $Q != " " || $rb != " " ) $Mf [] = " COMMENT ON TABLE " . table ( $C ) . " IS " . q ( $rb ); if ( $La != " " ){} foreach ( $Mf
2014-04-01 18:00:42 +00:00
as $H ){ if ( ! queries ( $H )) return
false ;} return
true ;} function
2015-04-01 06:36:56 +00:00
alter_indexes ( $Q , $c ){ $j = array (); $Yb = array (); $Mf = array (); foreach ( $c
as $X ){ if ( $X [ 0 ] != " INDEX " ) $j [] = ( $X [ 2 ] == " DROP " ? " \n DROP CONSTRAINT " . idf_escape ( $X [ 1 ]) : " \n ADD " . ( $X [ 1 ] != " " ? " CONSTRAINT " . idf_escape ( $X [ 1 ]) : " " ) . " $X[0] " . ( $X [ 0 ] == " PRIMARY " ? " KEY " : " " ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " ); elseif ( $X [ 2 ] == " DROP " ) $Yb [] = idf_escape ( $X [ 1 ]); else $Mf [] = " CREATE INDEX " . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $Q . " _ " )) . " ON " . table ( $Q ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " ;} if ( $j ) array_unshift ( $Mf , " ALTER TABLE " . table ( $Q ) . implode ( " , " , $j )); if ( $Yb ) array_unshift ( $Mf , " DROP INDEX " . implode ( " , " , $Yb )); foreach ( $Mf
2014-04-01 18:00:42 +00:00
as $H ){ if ( ! queries ( $H )) return
false ;} return
true ;} function
truncate_tables ( $S ){ return
queries ( " TRUNCATE " . implode ( " , " , array_map ( 'table' , $S ))); return
true ;} function
2015-04-01 06:36:56 +00:00
drop_views ( $Yh ){ return
drop_tables ( $Yh );} function
drop_tables ( $S ){ foreach ( $S
as $Q ){ $Ig = table_status ( $Q ); if ( ! queries ( " DROP " . strtoupper ( $Ig [ " Engine " ]) . " " . table ( $Q ))) return
false ;} return
true ;} function
move_tables ( $S , $Yh , $bh ){ foreach ( array_merge ( $S , $Yh ) as $Q ){ $Ig = table_status ( $Q ); if ( ! queries ( " ALTER " . strtoupper ( $Ig [ " Engine " ]) . " " . table ( $Q ) . " SET SCHEMA " . idf_escape ( $bh ))) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
trigger ( $C ){ if ( $C == " " ) return
array ( " Statement " => " EXECUTE PROCEDURE () " ); $L = get_rows ( 'SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", \'FOR EACH \' || action_orientation AS "Type", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = ' . q ( $_GET [ " trigger " ]) . ' AND trigger_name = ' . q ( $C )); return
reset ( $L );} function
triggers ( $Q ){ $J = array (); foreach ( get_rows ( " SELECT * FROM information_schema.triggers WHERE event_object_table = " . q ( $Q )) as $K ) $J [ $K [ " trigger_name " ]] = array ( $K [ " condition_timing " ], $K [ " event_manipulation " ]); return $J ;} function
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
explain ( $h , $H ){ return $h -> query ( " EXPLAIN $H " );} function
2015-04-01 06:36:56 +00:00
found_rows ( $R , $Z ){ global $h ; if ( preg_match ( " ~ rows=([0-9]+)~ " , $h -> result ( " EXPLAIN SELECT * FROM " . idf_escape ( $R [ " Name " ]) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " )), $Yf )) return $Yf [ 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
get_schema (){ global $h ; return $h -> result ( " SELECT current_schema() " );} function
2015-04-01 06:36:56 +00:00
set_schema ( $og ){ global $h , $Bh , $Lg ; $J = $h -> query ( " SET search_path TO " . idf_escape ( $og )); foreach ( types () as $U ){ if ( ! isset ( $Bh [ $U ])){ $Bh [ $U ] = 0 ; $Lg [ lang ( 23 )][] = $U ;}} return $J ;} function
use_sql ( $Gb ){ return " \ connect " . idf_escape ( $Gb );} function
2014-04-01 18:00:42 +00:00
show_variables (){ return
get_key_vals ( " SHOW ALL " );} function
process_list (){ global $h ; return
get_rows ( " SELECT * FROM pg_stat_activity ORDER BY " . ( $h -> server_info < 9.2 ? " procpid " : " pid " ));} function
show_status (){} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
support ( $Fc ){ global $h ; return
preg_match ( '~^(database|table|columns|sql|indexes|comment|view|' . ( $h -> server_info >= 9.3 ? 'materializedview|' : '' ) . 'scheme|processlist|sequence|trigger|type|variables|drop_col)$~' , $Fc );} $w = " pgsql " ; $Bh = array (); $Lg = array (); foreach ( array ( lang ( 24 ) => array ( " smallint " => 5 , " integer " => 10 , " bigint " => 19 , " boolean " => 1 , " numeric " => 0 , " real " => 7 , " double precision " => 16 , " money " => 20 ), lang ( 25 ) => array ( " date " => 13 , " time " => 17 , " timestamp " => 20 , " timestamptz " => 21 , " interval " => 0 ), lang ( 26 ) => 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 $x => $X ){ $Bh += $X ; $Lg [ $x ] = array_keys ( $X );} $Ih = array (); $Se = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " ~ " , " !~ " , " LIKE " , " LIKE %% " , " ILIKE " , " ILIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " ); $Uc = array ( " char_length " , " lower " , " round " , " to_hex " , " to_timestamp " , " upper " ); $Zc = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $fc = array ( array ( " char " => " md5 " , " date|time " => " now " ,), array ( " int|numeric|real|money " => " +/- " , " date|time " => " + interval/- interval " , " char|text " => " || " ,));} $Xb [ " oracle " ] = " Oracle " ; if ( isset ( $_GET [ " oracle " ])){ $_f = 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
2015-04-01 06:36:56 +00:00
_error ( $qc , $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
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
query ( $H , $Ch = 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
Min_Result ( $I ){ $this -> _result = $I ;} function
_convert ( $K ){ foreach (( array ) $K
as $x => $X ){ if ( is_a ( $X , 'OCI-Lob' )) $K [ $x ] = $X -> load ();} return $K ;} function
fetch_assoc (){ return $this -> _convert ( oci_fetch_assoc ( $this -> _result ));} function
fetch_row (){ return $this -> _convert ( oci_fetch_row ( $this -> _result ));} function
fetch_field (){ $e = $this -> _offset ++ ; $J = new
stdClass ; $J -> name = oci_field_name ( $this -> _result , $e ); $J -> orgname = $J -> name ; $J -> type = oci_field_type ( $this -> _result , $e ); $J -> charsetnr = ( preg_match ( " ~raw|blob|bfile~ " , $J -> type ) ? 63 : 0 ); return $J ;} function
__destruct (){ oci_free_statement ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_oci " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_OCI " ; function
connect ( $N , $V , $G ){ $this -> dsn ( " oci:dbname=// $N ;charset=AL32UTF8 " , $V , $G ); return
true ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ return
2014-04-01 18:00:42 +00:00
true ;}}} class
Min_Driver
extends
Min_SQL { function
begin (){ return
true ;}} function
idf_escape ( $t ){ return '"' . str_replace ( '"' , '""' , $t ) . '"' ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ global $b ; $h = new
2015-04-01 06:36:56 +00:00
Min_DB ; $k = $b -> credentials (); if ( $h -> connect ( $k [ 0 ], $k [ 1 ], $k [ 2 ])) return $h ; return $h -> error ;} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
get_vals ( " SELECT tablespace_name FROM user_tablespaces " );} function
2015-04-01 06:36:56 +00:00
limit ( $H , $Z , $z , $D = 0 , $vg = " " ){ 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
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){ global $h ; return $h -> result ( " SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET' " );} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
logged_user (){ global $h ; return $h -> result ( " SELECT USER FROM DUAL " );} function
tables_list (){ return
get_key_vals ( " SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = " . q ( DB ) . "
UNION SELECT view_name , 'view' FROM user_views
ORDER BY 1 " );}function
2015-04-01 06:36:56 +00:00
count_tables ( $l ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2015-04-01 06:36:56 +00:00
table_status ( $C = " " ){ $J = array (); $qg = 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 = $qg " : " " ) . "
UNION SELECT view_name , 'view' , 0 , 0 FROM user_views " .( $C != " " ? " WHERE view_name = $qg " : " " ). "
2014-04-01 18:00:42 +00:00
ORDER BY 1 " )as $K ) { if( $C != " " )return $K ; $J[$K["Name"] ]= $K ;}return $J ;}function
is_view ( $R ){ return $R [ " Engine " ] == " view " ;} function
fk_support ( $R ){ return
true ;} function
fields ( $Q ){ $J = array (); foreach ( get_rows ( " SELECT * FROM all_tab_columns WHERE table_name = " . q ( $Q ) . " ORDER BY column_id " ) as $K ){ $U = $K [ " DATA_TYPE " ]; $y = " $K[DATA_PRECISION] , $K[DATA_SCALE] " ; if ( $y == " , " ) $y = $K [ " DATA_LENGTH " ]; $J [ $K [ " COLUMN_NAME " ]] = array ( " field " => $K [ " COLUMN_NAME " ], " full_type " => $U . ( $y ? " ( $y ) " : " " ), " type " => strtolower ( $U ), " length " => $y , " default " => $K [ " DATA_DEFAULT " ], " null " => ( $K [ " NULLABLE " ] == " Y " ), " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ),);} return $J ;} function
indexes ( $Q , $i = null ){ $J = array (); foreach ( get_rows ( " SELECT uic.*, uc.constraint_type
FROM user_ind_columns uic
LEFT JOIN user_constraints uc ON uic . index_name = uc . constraint_name AND uic . table_name = uc . table_name
WHERE uic . table_name = " .q( $Q ). "
2015-04-01 06:36:56 +00:00
ORDER BY uc . constraint_type , uic . column_position " , $i )as $K ) { $od = $K [ " INDEX_NAME " ]; $J [ $od ][ " type " ] = ( $K [ " CONSTRAINT_TYPE " ] == " P " ? " PRIMARY " : ( $K [ " CONSTRAINT_TYPE " ] == " U " ? " UNIQUE " : " INDEX " )); $J [ $od ][ " columns " ][] = $K [ " COLUMN_NAME " ]; $J [ $od ][ " lengths " ][] = ( $K [ " CHAR_LENGTH " ] && $K [ " CHAR_LENGTH " ] != $K [ " COLUMN_LENGTH " ] ? $K [ " CHAR_LENGTH " ] : null ); $J [ $od ][ " 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
error (){ global $h ; return
h ( $h -> error );} function
explain ( $h , $H ){ $h -> query ( " EXPLAIN PLAN FOR $H " ); return $h -> query ( " SELECT * FROM plan_table " );} function
found_rows ( $R , $Z ){} function
2015-04-01 06:36:56 +00:00
alter_table ( $Q , $C , $p , $Mc , $rb , $nc , $d , $La , $of ){ $c = $Yb = array (); foreach ( $p
as $o ){ $X = $o [ 1 ]; if ( $X && $o [ 0 ] != " " && idf_escape ( $o [ 0 ]) != $X [ 0 ]) queries ( " ALTER TABLE " . table ( $Q ) . " RENAME COLUMN " . idf_escape ( $o [ 0 ]) . " TO $X[0] " ); if ( $X ) $c [] = ( $Q != " " ? ( $o [ 0 ] != " " ? " MODIFY ( " : " ADD ( " ) : " " ) . implode ( $X ) . ( $Q != " " ? " ) " : " " ); else $Yb [] = idf_escape ( $o [ 0 ]);} if ( $Q == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); return ( ! $c || queries ( " ALTER TABLE " . table ( $Q ) . " \n " . implode ( " \n " , $c ))) && ( ! $Yb || queries ( " ALTER TABLE " . table ( $Q ) . " DROP ( " . implode ( " , " , $Yb ) . " ) " )) && ( $Q == $C || queries ( " ALTER TABLE " . table ( $Q ) . " RENAME TO " . table ( $C )));} function
foreign_keys ( $Q ){ $J = array (); $H = " SELECT c_list.CONSTRAINT_NAME as NAME,
c_src . COLUMN_NAME as SRC_COLUMN ,
c_dest . OWNER as DEST_DB ,
c_dest . TABLE_NAME as DEST_TABLE ,
c_dest . COLUMN_NAME as DEST_COLUMN ,
c_list . DELETE_RULE as ON_DELETE
FROM ALL_CONSTRAINTS c_list , ALL_CONS_COLUMNS c_src , ALL_CONS_COLUMNS c_dest
WHERE c_list . CONSTRAINT_NAME = c_src . CONSTRAINT_NAME
AND c_list . R_CONSTRAINT_NAME = c_dest . CONSTRAINT_NAME
AND c_list . CONSTRAINT_TYPE = 'R'
AND c_src . TABLE_NAME = " .q( $Q );foreach(get_rows( $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
2014-04-01 18:00:42 +00:00
truncate_tables ( $S ){ return
apply_queries ( " TRUNCATE TABLE " , $S );} function
2015-04-01 06:36:56 +00:00
drop_views ( $Yh ){ return
apply_queries ( " DROP VIEW " , $Yh );} function
2014-04-01 18:00:42 +00:00
drop_tables ( $S ){ return
apply_queries ( " DROP TABLE " , $S );} function
last_id (){ return
0 ;} function
schemas (){ return
get_vals ( " SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX')) " );} function
get_schema (){ global $h ; return $h -> result ( " SELECT sys_context('USERENV', 'SESSION_USER') FROM dual " );} function
2015-04-01 06:36:56 +00:00
set_schema ( $pg ){ global $h ; return $h -> query ( " ALTER SESSION SET CURRENT_SCHEMA = " . idf_escape ( $pg ));} 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
support ( $Fc ){ return
preg_match ( '~^(columns|database|drop_col|indexes|processlist|scheme|sql|status|table|variables|view|view_trigger)$~' , $Fc );} $w = " oracle " ; $Bh = array (); $Lg = array (); foreach ( array ( lang ( 24 ) => array ( " number " => 38 , " binary_float " => 12 , " binary_double " => 21 ), lang ( 25 ) => array ( " date " => 10 , " timestamp " => 29 , " interval year " => 12 , " interval day " => 28 ), lang ( 26 ) => 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 $x => $X ){ $Bh += $X ; $Lg [ $x ] = array_keys ( $X );} $Ih = array (); $Se = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT REGEXP " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Uc = array ( " length " , " lower " , " round " , " upper " ); $Zc = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $fc = array ( array ( " date " => " current_date " , " timestamp " => " current_timestamp " ,), array ( " number|float|double " => " +/- " , " date|timestamp " => " + interval/- interval " , " char|clob " => " || " ,));} $Xb [ " mssql " ] = " MS SQL " ; if ( isset ( $_GET [ " mssql " ])){ $_f = array ( " SQLSRV " , " MSSQL " ); 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
connect ( $N , $V , $G ){ $this -> _link =@ sqlsrv_connect ( $N , array ( " UID " => $V , " PWD " => $G , " CharacterSet " => " UTF-8 " )); if ( $this -> _link ){ $sd = sqlsrv_server_info ( $this -> _link ); $this -> server_info = $sd [ 'SQLServerVersion' ];} else $this -> _get_error (); return ( bool ) $this -> _link ;} function
2014-04-01 18:00:42 +00:00
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ return $this -> query ( " USE " . idf_escape ( $Gb ));} function
query ( $H , $Ch = 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
Min_Result ( $I ){ $this -> _result = $I ;} function
_convert ( $K ){ foreach (( array ) $K
as $x => $X ){ if ( is_a ( $X , 'DateTime' )) $K [ $x ] = $X -> format ( " Y-m-d H:i:s " );} return $K ;} function
fetch_assoc (){ return $this -> _convert ( sqlsrv_fetch_array ( $this -> _result , SQLSRV_FETCH_ASSOC , SQLSRV_SCROLL_NEXT ));} function
fetch_row (){ return $this -> _convert ( sqlsrv_fetch_array ( $this -> _result , SQLSRV_FETCH_NUMERIC , SQLSRV_SCROLL_NEXT ));} 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
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ return
mssql_select_db ( $Gb );} function
query ( $H , $Ch = 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
mssql_next_result ( $this -> _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
Min_Result ( $I ){ $this -> _result = $I ; $this -> num_rows = mssql_num_rows ( $I );} function
fetch_assoc (){ return
mssql_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
mssql_fetch_row ( $this -> _result );} function
num_rows (){ return
mssql_num_rows ( $this -> _result );} function
fetch_field (){ $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
__destruct (){ mssql_free_result ( $this -> _result );}}} class
Min_Driver
extends
Min_SQL { function
2015-04-01 06:36:56 +00:00
insertUpdate ( $Q , $L , $Cf ){ foreach ( $L
as $O ){ $Jh = array (); $Z = array (); foreach ( $O
as $x => $X ){ $Jh [] = " $x = $X " ; if ( isset ( $Cf [ idf_unescape ( $x )])) $Z [] = " $x = $X " ;} if ( ! queries ( " MERGE " . table ( $Q ) . " USING (VALUES( " . implode ( " , " , $O ) . " )) AS source (c " . implode ( " , c " , range ( 1 , count ( $O ))) . " ) ON " . implode ( " AND " , $Z ) . " WHEN MATCHED THEN UPDATE SET " . implode ( " , " , $Jh ) . " 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
idf_escape ( $t ){ return " [ " . str_replace ( " ] " , " ]] " , $t ) . " ] " ;} function
table ( $t ){ return ( $_GET [ " ns " ] != " " ? idf_escape ( $_GET [ " ns " ]) . " . " : " " ) . idf_escape ( $t );} function
connect (){ global $b ; $h = new
2015-04-01 06:36:56 +00:00
Min_DB ; $k = $b -> credentials (); if ( $h -> connect ( $k [ 0 ], $k [ 1 ], $k [ 2 ])) return $h ; return $h -> error ;} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
get_vals ( " EXEC sp_databases " );} function
2015-04-01 06:36:56 +00:00
limit ( $H , $Z , $z , $D = 0 , $vg = " " ){ 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
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){ global $h ; return $h -> result ( " SELECT collation_name FROM sys.databases WHERE name = " . q ( $m ));} function
2014-04-01 18:00:42 +00:00
engines (){ return
array ();} function
logged_user (){ global $h ; return $h -> result ( " SELECT SUSER_NAME() " );} function
tables_list (){ return
get_key_vals ( " SELECT name, type_desc FROM sys.all_objects WHERE schema_id = SCHEMA_ID( " . q ( get_schema ()) . " ) AND type IN ('S', 'U', 'V') ORDER BY name " );} function
2015-04-01 06:36:56 +00:00
count_tables ( $l ){ global $h ; $J = array (); foreach ( $l
as $m ){ $h -> select_db ( $m ); $J [ $m ] = $h -> 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
is_view ( $R ){ return $R [ " Engine " ] == " VIEW " ;} function
fk_support ( $R ){ return
true ;} function
fields ( $Q ){ $J = array (); foreach ( get_rows ( " SELECT c.*, t.name type, d.definition [default]
FROM sys . all_columns c
JOIN sys . all_objects o ON c . object_id = o . object_id
JOIN sys . types t ON c . user_type_id = t . user_type_id
LEFT JOIN sys . default_constraints d ON c . default_object_id = d . parent_column_id
WHERE o . schema_id = SCHEMA_ID ( " .q(get_schema()). " ) AND o . type IN ( 'S' , 'U' , 'V' ) AND o . name = " .q( $Q ))as $K ) { $U = $K [ " type " ]; $y = ( preg_match ( " ~char|binary~ " , $U ) ? $K [ " max_length " ] : ( $U == " decimal " ? " $K[precision] , $K[scale] " : " " )); $J [ $K [ " name " ]] = array ( " field " => $K [ " name " ], " full_type " => $U . ( $y ? " ( $y ) " : " " ), " type " => $U , " length " => $y , " 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 ( $Q , $i = null ){ $J = array (); foreach ( get_rows ( " SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
FROM sys . indexes i
INNER JOIN sys . index_columns ic ON i . object_id = ic . object_id AND i . index_id = ic . index_id
INNER JOIN sys . columns c ON ic . object_id = c . object_id AND ic . column_id = c . column_id
WHERE OBJECT_NAME ( i . object_id ) = " .q( $Q ), $i )as $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 $h ; return
array ( " select " => preg_replace ( '~^(?:[^[]|\\[[^]]*])*\\s+AS\\s+~isU' , '' , $h -> result ( " SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = " . q ( $C ))));} function
collations (){ $J = array (); foreach ( get_vals ( " SELECT name FROM fn_helpcollations() " ) as $d ) $J [ preg_replace ( '~_.*~' , '' , $d )][] = $d ; 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
error (){ global $h ; return
nl_br ( h ( preg_replace ( '~^(\\[[^]]*])+~m' , '' , $h -> error )));} function
2015-04-01 06:36:56 +00:00
create_database ( $m , $d ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( preg_match ( '~^[a-z0-9_]+$~i' , $d ) ? " COLLATE $d " : " " ));} function
drop_databases ( $l ){ return
queries ( " DROP DATABASE " . implode ( " , " , array_map ( 'idf_escape' , $l )));} function
2014-04-01 18:00:42 +00:00
rename_database ( $C , $d ){ if ( preg_match ( '~^[a-z0-9_]+$~i' , $d )) queries ( " ALTER DATABASE " . idf_escape ( DB ) . " COLLATE $d " ); queries ( " ALTER DATABASE " . idf_escape ( DB ) . " MODIFY NAME = " . idf_escape ( $C )); return
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
alter_table ( $Q , $C , $p , $Mc , $rb , $nc , $d , $La , $of ){ $c = array (); foreach ( $p
as $o ){ $e = idf_escape ( $o [ 0 ]); $X = $o [ 1 ]; if ( ! $X ) $c [ " DROP " ][] = " COLUMN $e " ; else { $X [ 1 ] = preg_replace ( " ~( COLLATE )'( \\ w+)'~ " , " \\ 1 \\ 2 " , $X [ 1 ]); if ( $o [ 0 ] == " " ) $c [ " ADD " ][] = " \n " . implode ( " " , $X ) . ( $Q == " " ? substr ( $Mc [ $X [ 0 ]], 16 + strlen ( $X [ 0 ])) : " " ); else { unset ( $X [ 6 ]); if ( $e != $X [ 0 ]) queries ( " EXEC sp_rename " . q ( table ( $Q ) . " . $e " ) . " , " . q ( idf_unescape ( $X [ 0 ])) . " , 'COLUMN' " ); $c [ " ALTER COLUMN " . implode ( " " , $X )][] = " " ;}}} if ( $Q == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( " . implode ( " , " ,( array ) $c [ " ADD " ]) . " \n ) " ); if ( $Q != $C ) queries ( " EXEC sp_rename " . q ( table ( $Q )) . " , " . q ( $C )); if ( $Mc ) $c [ " " ] = $Mc ; foreach ( $c
2014-04-01 18:00:42 +00:00
as $x => $X ){ if ( ! queries ( " ALTER TABLE " . idf_escape ( $C ) . " $x " . implode ( " , " , $X ))) return
false ;} return
true ;} function
2015-04-01 06:36:56 +00:00
alter_indexes ( $Q , $c ){ $u = array (); $Yb = array (); foreach ( $c
as $X ){ if ( $X [ 2 ] == " DROP " ){ if ( $X [ 0 ] == " PRIMARY " ) $Yb [] = idf_escape ( $X [ 1 ]); else $u [] = idf_escape ( $X [ 1 ]) . " ON " . table ( $Q );} elseif ( ! queries (( $X [ 0 ] != " PRIMARY " ? " CREATE $X[0] " . ( $X [ 0 ] != " INDEX " ? " INDEX " : " " ) . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $Q . " _ " )) . " ON " . table ( $Q ) : " ALTER TABLE " . table ( $Q ) . " ADD PRIMARY KEY " ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " )) return
false ;} return ( ! $u || queries ( " DROP INDEX " . implode ( " , " , $u ))) && ( ! $Yb || queries ( " ALTER TABLE " . table ( $Q ) . " DROP " . implode ( " , " , $Yb )));} function
2014-04-01 18:00:42 +00:00
last_id (){ global $h ; return $h -> result ( " SELECT SCOPE_IDENTITY() " );} function
explain ( $h , $H ){ $h -> query ( " SET SHOWPLAN_ALL ON " ); $J = $h -> query ( $H ); $h -> query ( " SET SHOWPLAN_ALL OFF " ); return $J ;} function
found_rows ( $R , $Z ){} function
2015-04-01 06:36:56 +00:00
foreign_keys ( $Q ){ $J = array (); foreach ( get_rows ( " EXEC sp_fkeys @fktable_name = " . q ( $Q )) 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
2014-04-01 18:00:42 +00:00
truncate_tables ( $S ){ return
apply_queries ( " TRUNCATE TABLE " , $S );} function
2015-04-01 06:36:56 +00:00
drop_views ( $Yh ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $Yh )));} function
2014-04-01 18:00:42 +00:00
drop_tables ( $S ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $S )));} function
2015-04-01 06:36:56 +00:00
move_tables ( $S , $Yh , $bh ){ return
apply_queries ( " ALTER SCHEMA " . idf_escape ( $bh ) . " TRANSFER " , array_merge ( $S , $Yh ));} 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
triggers ( $Q ){ $J = array (); foreach ( get_rows ( " SELECT sys1.name,
CASE WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsInsertTrigger' ) = 1 THEN 'INSERT' WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsUpdateTrigger' ) = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsDeleteTrigger' ) = 1 THEN 'DELETE' END [ Event ],
CASE WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsInsteadOfTrigger' ) = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [ Timing ]
FROM sysobjects sys1
JOIN sysobjects sys2 ON sys1 . parent_obj = sys2 . id
WHERE sys1 . xtype = 'TR' AND sys2 . name = " .q( $Q ))as $K ) $J[$K["name"] ]=array( $K["Timing"] , $K["Event"] );return $J ;}function
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
get_schema (){ global $h ; if ( $_GET [ " ns " ] != " " ) return $_GET [ " ns " ]; return $h -> result ( " SELECT SCHEMA_NAME() " );} function
2015-04-01 06:36:56 +00:00
set_schema ( $og ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
use_sql ( $Gb ){ return " USE " . idf_escape ( $Gb );} 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
support ( $Fc ){ return
preg_match ( '~^(columns|database|drop_col|indexes|scheme|sql|table|trigger|view|view_trigger)$~' , $Fc );} $w = " mssql " ; $Bh = array (); $Lg = array (); foreach ( array ( lang ( 24 ) => array ( " tinyint " => 3 , " smallint " => 5 , " int " => 10 , " bigint " => 20 , " bit " => 1 , " decimal " => 0 , " real " => 12 , " float " => 53 , " smallmoney " => 10 , " money " => 20 ), lang ( 25 ) => array ( " date " => 10 , " smalldatetime " => 19 , " datetime " => 19 , " datetime2 " => 19 , " time " => 8 , " datetimeoffset " => 10 ), lang ( 26 ) => array ( " char " => 8000 , " varchar " => 8000 , " text " => 2147483647 , " nchar " => 4000 , " nvarchar " => 4000 , " ntext " => 1073741823 ), lang ( 27 ) => array ( " binary " => 8000 , " varbinary " => 8000 , " image " => 2147483647 ),) as $x => $X ){ $Bh += $X ; $Lg [ $x ] = array_keys ( $X );} $Ih = array (); $Se = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " ); $Uc = array ( " len " , " lower " , " round " , " upper " ); $Zc = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $fc = array ( array ( " date|time " => " getdate " ,), array ( " int|decimal|real|float|money|datetime " => " +/- " , " char|text " => " + " ,));} $Xb [ 'firebird' ] = 'Firebird (alpha)' ; if ( isset ( $_GET [ " firebird " ])){ $_f = array ( " interbase " ); define ( " DRIVER " , " firebird " ); if ( extension_loaded ( " interbase " )){ class
Min_DB { var $extension = " Firebird " , $server_info , $affected_rows , $errno , $error , $_link , $_result ; function
connect ( $N , $V , $G ){ $this -> _link = ibase_connect ( $N , $V , $G ); if ( $this -> _link ){ $Lh = explode ( ':' , $N ); $this -> service_link = ibase_service_attach ( $Lh [ 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 ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;} function
select_db ( $Gb ){ return ( $Gb == " domain " );} function
query ( $H , $Ch = false ){ $I = ibase_query ( $H , $this -> _link ); if ( ! $I ){ $this -> errno = ibase_errcode (); $this -> error = ibase_errmsg (); return
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
Min_Result ( $I ){ $this -> _result = $I ;} function
fetch_assoc (){ return
ibase_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
ibase_fetch_row ( $this -> _result );} function
fetch_field (){ $o = ibase_field_info ( $this -> _result , $this -> _offset ++ ); return ( object ) array ( 'name' => $o [ 'name' ], 'orgname' => $o [ 'name' ], 'type' => $o [ 'type' ], 'charsetnr' => $o [ 'length' ],);} function
__destruct (){ ibase_free_result ( $this -> _result );}}} class
Min_Driver
extends
Min_SQL {} function
idf_escape ( $t ){ return '"' . str_replace ( '"' , '""' , $t ) . '"' ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ global $b ; $h = new
Min_DB ; $k = $b -> credentials (); if ( $h -> connect ( $k [ 0 ], $k [ 1 ], $k [ 2 ])) return $h ; return $h -> error ;} function
get_databases ( $Lc ){ return
array ( " domain " );} function
limit ( $H , $Z , $z , $D = 0 , $vg = " " ){ $J = '' ; $J .= ( $z !== null ? $vg . " FIRST $z " . ( $D ? " SKIP $D " : " " ) : " " ); $J .= " $H $Z " ; return $J ;} function
limit1 ( $H , $Z ){ return
limit ( $H , $Z , 1 );} function
db_collation ( $m , $nb ){} function
engines (){ return
array ();} function
logged_user (){ global $b ; $k = $b -> credentials (); return $k [ 1 ];} function
tables_list (){ global $h ; $H = 'SELECT RDB$RELATION_NAME FROM rdb$relations WHERE rdb$system_flag = 0' ; $I = ibase_query ( $h -> _link , $H ); $J = array (); while ( $K = ibase_fetch_assoc ( $I )) $J [ $K [ 'RDB$RELATION_NAME' ]] = 'table' ; ksort ( $J ); return $J ;} function
count_tables ( $l ){ return
array ();} function
table_status ( $C = " " , $Ec = false ){ global $h ; $J = array (); $Eb = tables_list (); foreach ( $Eb
as $u => $X ){ $u = trim ( $u ); $J [ $u ] = array ( 'Name' => $u , 'Engine' => 'standard' ,); if ( $C == $u ) return $J [ $u ];} return $J ;} function
is_view ( $R ){ return
false ;} function
fk_support ( $R ){ return
preg_match ( '~InnoDB|IBMDB2I~i' , $R [ " Engine " ]);} function
fields ( $Q ){ global $h ; $J = array (); $H = ' SELECT r . RDB $FIELD_NAME AS field_name ,
r . RDB $DESCRIPTION AS field_description ,
r . RDB $DEFAULT_VALUE AS field_default_value ,
r . RDB $NULL_FLAG AS field_not_null_constraint ,
f . RDB $FIELD_LENGTH AS field_length ,
f . RDB $FIELD_PRECISION AS field_precision ,
f . RDB $FIELD_SCALE AS field_scale ,
CASE f . RDB $FIELD_TYPE
WHEN 261 THEN \ ' BLOB\ '
WHEN 14 THEN \ ' CHAR\ '
WHEN 40 THEN \ ' CSTRING\ '
WHEN 11 THEN \ ' D_FLOAT\ '
WHEN 27 THEN \ ' DOUBLE\ '
WHEN 10 THEN \ ' FLOAT\ '
WHEN 16 THEN \ ' INT64\ '
WHEN 8 THEN \ ' INTEGER\ '
WHEN 9 THEN \ ' QUAD\ '
WHEN 7 THEN \ ' SMALLINT\ '
WHEN 12 THEN \ ' DATE\ '
WHEN 13 THEN \ ' TIME\ '
WHEN 35 THEN \ ' TIMESTAMP\ '
WHEN 37 THEN \ ' VARCHAR\ '
ELSE \ ' UNKNOWN\ '
END AS field_type ,
f . RDB $FIELD_SUB_TYPE AS field_subtype ,
coll . RDB $COLLATION_NAME AS field_collation ,
cset . RDB $CHARACTER_SET_NAME AS field_charset
FROM RDB $RELATION_FIELDS r
LEFT JOIN RDB $FIELDS f ON r . RDB $FIELD_SOURCE = f . RDB $FIELD_NAME
LEFT JOIN RDB $COLLATIONS coll ON f . RDB $COLLATION_ID = coll . RDB $COLLATION_ID
LEFT JOIN RDB $CHARACTER_SETS cset ON f . RDB $CHARACTER_SET_ID = cset . RDB $CHARACTER_SET_ID
WHERE r . RDB $RELATION_NAME = '.q($Q).'
ORDER BY r . RDB $FIELD_POSITION ';$I=ibase_query($h->_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 ( $Q , $i = null ){ $J = array (); return $J ;} function
foreign_keys ( $Q ){ return
array ();} function
collations (){ return
array ();} function
information_schema ( $m ){ return
false ;} function
error (){ global $h ; return
h ( $h -> error );} function
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
set_schema ( $og ){ return
true ;} function
support ( $Fc ){ return
preg_match ( " ~^(columns|sql|status|table) $ ~ " , $Fc );} $w = " firebird " ; $Se = array ( " = " ); $Uc = array (); $Zc = array (); $fc = array ();} $Xb [ " simpledb " ] = " SimpleDB " ; if ( isset ( $_GET [ " simpledb " ])){ $_f = 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
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ return ( $Gb == " domain " );} function
query ( $H , $Ch = 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 )){ $Pg = 0 ; foreach ( $I
as $Ed ) $Pg += $Ed -> Attribute -> Value ; $I = array (( object ) array ( 'Attribute' => array (( object ) array ( 'Name' => 'Count' , 'Value' => $Pg ,))));} 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
quote ( $P ){ return " ' " . str_replace ( " ' " , " '' " , $P ) . " ' " ;}} class
Min_Result { var $num_rows , $_rows = array (), $_offset = 0 ; function
Min_Result ( $I ){ foreach ( $I
2015-04-01 06:36:56 +00:00
as $Ed ){ $K = array (); if ( $Ed -> Name != '' ) $K [ 'itemName()' ] = ( string ) $Ed -> Name ; foreach ( $Ed -> Attribute
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
2014-04-01 18:00:42 +00:00
as $x => $X ){ if ( ! isset ( $this -> _rows [ 0 ][ $x ])) $this -> _rows [ 0 ][ $x ] = null ;}} $this -> num_rows = count ( $this -> _rows );} function
2015-04-01 06:36:56 +00:00
_processValue ( $ic ){ return ( is_object ( $ic ) && $ic [ 'encoding' ] == 'base64' ? base64_decode ( $ic ) : ( string ) $ic );} function
2014-04-01 18:00:42 +00:00
fetch_assoc (){ $K = current ( $this -> _rows ); if ( ! $K ) return $K ; $J = array (); foreach ( $this -> _rows [ 0 ] as $x => $X ) $J [ $x ] = $K [ $x ]; next ( $this -> _rows ); return $J ;} function
fetch_row (){ $J = $this -> fetch_assoc (); if ( ! $J ) return $J ; return
array_values ( $J );} function
2015-04-01 06:36:56 +00:00
fetch_field (){ $Kd = array_keys ( $this -> _rows [ 0 ]); return ( object ) array ( 'name' => $Kd [ $this -> _offset ++ ]);}}} class
2014-04-01 18:00:42 +00:00
Min_Driver
extends
2015-04-01 06:36:56 +00:00
Min_SQL { public $Cf = " itemName() " ; function
_chunkRequest ( $ld , $va , $F , $yc = array ()){ global $h ; foreach ( array_chunk ( $ld , 25 ) as $gb ){ $kf = $F ; foreach ( $gb
as $s => $jd ){ $kf [ " Item. $s .ItemName " ] = $jd ; foreach ( $yc
as $x => $X ) $kf [ " Item. $s . $x " ] = $X ;} if ( ! sdb_request ( $va , $kf )) return
false ;} $h -> affected_rows = count ( $ld ); return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
_extractIds ( $Q , $Nf , $z ){ $J = array (); if ( preg_match_all ( " ~itemName \ ( \ ) = (('[^']*+')+)~ " , $Nf , $ee )) $J = array_map ( 'idf_unescape' , $ee [ 1 ]); else { foreach ( sdb_request_all ( 'Select' , 'Item' , array ( 'SelectExpression' => 'SELECT itemName() FROM ' . table ( $Q ) . $Nf . ( $z ? " LIMIT 1 " : " " ))) as $Ed ) $J [] = $Ed -> Name ;} return $J ;} function
select ( $Q , $M , $Z , $Xc , $Xe = array (), $z = 1 , $E = 0 , $Ef = false ){ global $h ; $h -> next = $_GET [ " next " ]; $J = parent :: select ( $Q , $M , $Z , $Xc , $Xe , $z , $E , $Ef ); $h -> next = 0 ; return $J ;} function
delete ( $Q , $Nf , $z = 0 ){ return $this -> _chunkRequest ( $this -> _extractIds ( $Q , $Nf , $z ), 'BatchDeleteAttributes' , array ( 'DomainName' => $Q ));} function
update ( $Q , $O , $Nf , $z = 0 , $vg = " \n " ){ $Mb = array (); $wd = array (); $s = 0 ; $ld = $this -> _extractIds ( $Q , $Nf , $z ); $jd = idf_unescape ( $O [ " `itemName()` " ]); unset ( $O [ " `itemName()` " ]); foreach ( $O
as $x => $X ){ $x = idf_unescape ( $x ); if ( $X == " NULL " || ( $jd != " " && array ( $jd ) != $ld )) $Mb [ " Attribute. " . count ( $Mb ) . " .Name " ] = $x ; if ( $X != " NULL " ){ foreach (( array ) $X
as $Gd => $W ){ $wd [ " Attribute. $s .Name " ] = $x ; $wd [ " Attribute. $s .Value " ] = ( is_array ( $X ) ? $W : idf_unescape ( $W )); if ( ! $Gd ) $wd [ " Attribute. $s .Replace " ] = " true " ; $s ++ ;}}} $F = array ( 'DomainName' => $Q ); return ( ! $wd || $this -> _chunkRequest (( $jd != " " ? array ( $jd ) : $ld ), 'BatchPutAttributes' , $F , $wd )) && ( ! $Mb || $this -> _chunkRequest ( $ld , 'BatchDeleteAttributes' , $F , $Mb ));} function
insert ( $Q , $O ){ $F = array ( " DomainName " => $Q ); $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
2015-04-01 06:36:56 +00:00
insertUpdate ( $Q , $L , $Cf ){ foreach ( $L
2014-04-01 18:00:42 +00:00
as $O ){ if ( ! $this -> update ( $Q , $O , " WHERE `itemName()` = " . q ( $O [ " `itemName()` " ]))) return
false ;} return
true ;} function
begin (){ return
false ;} function
commit (){ return
false ;} function
rollback (){ return
false ;}} function
connect (){ return
new
Min_DB ;} function
2015-04-01 06:36:56 +00:00
support ( $Fc ){ return
preg_match ( '~sql~' , $Fc );} function
logged_user (){ global $b ; $k = $b -> credentials (); return $k [ 1 ];} function
2014-04-01 18:00:42 +00:00
get_databases (){ return
array ( " domain " );} function
collations (){ return
array ();} function
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){} function
2014-04-01 18:00:42 +00:00
tables_list (){ global $h ; $J = array (); foreach ( sdb_request_all ( 'ListDomains' , 'DomainName' ) as $Q ) $J [( string ) $Q ] = 'table' ; if ( $h -> error && defined ( " PAGE_HEADER " )) echo " <p class='error'> " . error () . " \n " ; return $J ;} function
2015-04-01 06:36:56 +00:00
table_status ( $C = " " , $Ec = false ){ $J = array (); foreach (( $C != " " ? array ( $C => true ) : tables_list ()) as $Q => $U ){ $K = array ( " Name " => $Q , " Auto_increment " => " " ); if ( ! $Ec ){ $re = sdb_request ( 'DomainMetadata' , array ( 'DomainName' => $Q )); if ( $re ){ foreach ( array ( " Rows " => " ItemCount " , " Data_length " => " ItemNamesSizeBytes " , " Index_length " => " AttributeValuesSizeBytes " , " Data_free " => " AttributeNamesSizeBytes " ,) as $x => $X ) $K [ $x ] = ( string ) $re -> $X ;}} if ( $C != " " ) return $K ; $J [ $Q ] = $K ;} return $J ;} function
2014-04-01 18:00:42 +00:00
explain ( $h , $H ){} function
error (){ global $h ; return
h ( $h -> error );} function
information_schema (){} function
is_view ( $R ){} function
indexes ( $Q , $i = null ){ return
array ( array ( " type " => " PRIMARY " , " columns " => array ( " itemName() " )),);} function
fields ( $Q ){ return
fields_from_edit ();} function
foreign_keys ( $Q ){ return
array ();} function
table ( $t ){ return
idf_escape ( $t );} function
idf_escape ( $t ){ return " ` " . str_replace ( " ` " , " `` " , $t ) . " ` " ;} function
2015-04-01 06:36:56 +00:00
limit ( $H , $Z , $z , $D = 0 , $vg = " " ){ return " $H $Z " . ( $z !== null ? $vg . " LIMIT $z " : " " );} function
unconvert_field ( $o , $J ){ return $J ;} function
2014-04-01 18:00:42 +00:00
fk_support ( $R ){} function
engines (){ return
array ();} function
2015-04-01 06:36:56 +00:00
alter_table ( $Q , $C , $p , $Mc , $rb , $nc , $d , $La , $of ){ return ( $Q == " " && sdb_request ( 'CreateDomain' , array ( 'DomainName' => $C )));} function
2014-04-01 18:00:42 +00:00
drop_tables ( $S ){ foreach ( $S
as $Q ){ if ( ! sdb_request ( 'DeleteDomain' , array ( 'DomainName' => $Q ))) return
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
2014-04-01 18:00:42 +00:00
found_rows ( $R , $Z ){ return ( $Z ? null : $R [ " Rows " ]);} function
last_id (){} function
2015-04-01 06:36:56 +00:00
hmac ( $Ba , $Eb , $x , $Rf = false ){ $Ua = 64 ; if ( strlen ( $x ) > $Ua ) $x = pack ( " H* " , $Ba ( $x )); $x = str_pad ( $x , $Ua , " \0 " ); $Hd = $x ^ str_repeat ( " \x36 " , $Ua ); $Id = $x ^ str_repeat ( " \x5C " , $Ua ); $J = $Ba ( $Id . pack ( " H* " , $Ba ( $Hd . $Eb ))); if ( $Rf ) $J = pack ( " H* " , $J ); return $J ;} function
sdb_request ( $va , $F = array ()){ global $b , $h ; list ( $hd , $F [ 'AWSAccessKeyId' ], $rg ) = $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 $x => $X ) $H .= '&' . rawurlencode ( $x ) . '=' . rawurlencode ( $X ); $H = str_replace ( '%7E' , '~' , substr ( $H , 1 )); $H .= " &Signature= " . urlencode ( base64_encode ( hmac ( 'sha1' , " POST \n " . preg_replace ( '~^https?://~' , '' , $hd ) . " \n / \n $H " , $rg , true ))); @ ini_set ( 'track_errors' , 1 ); $Hc =@ file_get_contents (( preg_match ( '~^https?://~' , $hd ) ? $hd : " http:// $hd " ), false , stream_context_create ( array ( 'http' => array ( 'method' => 'POST' , 'content' => $H , 'ignore_errors' => 1 ,)))); if ( ! $Hc ){ $h -> error = $php_errormsg ; return
false ;} libxml_use_internal_errors ( true ); $ei = simplexml_load_string ( $Hc ); if ( ! $ei ){ $n = libxml_get_last_error (); $h -> error = $n -> message ; return
false ;} if ( $ei -> Errors ){ $n = $ei -> Errors -> Error ; $h -> error = " $n->Message ( $n->Code ) " ; return
false ;} $h -> error = '' ; $ah = $va . " Result " ; return ( $ei -> $ah ? $ei -> $ah : true );} function
sdb_request_all ( $va , $ah , $F = array (), $jh = 0 ){ $J = array (); $Hg = ( $jh ? microtime ( true ) : 0 ); $z = ( preg_match ( '~LIMIT\s+(\d+)\s*$~i' , $F [ 'SelectExpression' ], $B ) ? $B [ 1 ] : 0 ); do { $ei = sdb_request ( $va , $F ); if ( ! $ei ) break ; foreach ( $ei -> $ah
as $ic ) $J [] = $ic ; if ( $z && count ( $J ) >= $z ){ $_GET [ " next " ] = $ei -> NextToken ; break ;} if ( $jh && microtime ( true ) - $Hg > $jh ) return
false ; $F [ 'NextToken' ] = $ei -> NextToken ; if ( $z ) $F [ 'SelectExpression' ] = preg_replace ( '~\d+\s*$~' , $z - count ( $J ), $F [ 'SelectExpression' ]);} while ( $ei -> NextToken ); return $J ;} $w = " simpledb " ; $Se = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " IS NOT NULL " ); $Uc = array (); $Zc = array ( " count " ); $fc = array ( array ( " json " ));} $Xb [ " mongo " ] = " MongoDB (beta) " ; if ( isset ( $_GET [ " mongo " ])){ $_f = 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
2015-04-01 06:36:56 +00:00
connect ( $N , $V , $G ){ global $b ; $m = $b -> database (); $Ve = array (); if ( $V != " " ){ $Ve [ " username " ] = $V ; $Ve [ " password " ] = $G ;} if ( $m != " " ) $Ve [ " db " ] = $m ; try { $this -> _link =@ new
MongoClient ( " mongodb:// $N " , $Ve ); return
true ;} catch ( Exception $uc ){ $this -> error = $uc -> getMessage (); return
2014-04-01 18:00:42 +00:00
false ;}} function
query ( $H ){ return
false ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ try { $this -> _db = $this -> _link -> selectDB ( $Gb ); return
true ;} catch ( Exception $uc ){ $this -> error = $uc -> getMessage (); return
2014-04-01 18:00:42 +00:00
false ;}} function
quote ( $P ){ return $P ;}} class
Min_Result { var $num_rows , $_rows = array (), $_offset = 0 , $_charset = array (); function
Min_Result ( $I ){ foreach ( $I
2015-04-01 06:36:56 +00:00
as $Ed ){ $K = array (); foreach ( $Ed
2014-04-01 18:00:42 +00:00
as $x => $X ){ if ( is_a ( $X , 'MongoBinData' )) $this -> _charset [ $x ] = 63 ; $K [ $x ] = ( 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 $x => $X ){ if ( ! isset ( $this -> _rows [ 0 ][ $x ])) $this -> _rows [ 0 ][ $x ] = 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 $x => $X ) $J [ $x ] = $K [ $x ]; next ( $this -> _rows ); return $J ;} function
fetch_row (){ $J = $this -> fetch_assoc (); if ( ! $J ) return $J ; return
array_values ( $J );} function
2015-04-01 06:36:56 +00:00
fetch_field (){ $Kd = array_keys ( $this -> _rows [ 0 ]); $C = $Kd [ $this -> _offset ++ ]; return ( object ) array ( 'name' => $C , 'charsetnr' => $this -> _charset [ $C ],);}}} class
2014-04-01 18:00:42 +00:00
Min_Driver
extends
2015-04-01 06:36:56 +00:00
Min_SQL { public $Cf = " _id " ; function
select ( $Q , $M , $Z , $Xc , $Xe = array (), $z = 1 , $E = 0 , $Ef = false ){ $M = ( $M == array ( " * " ) ? array () : array_fill_keys ( $M , true )); $Cg = array (); foreach ( $Xe
as $X ){ $X = preg_replace ( '~ DESC$~' , '' , $X , 1 , $Ab ); $Cg [ $X ] = ( $Ab ? - 1 : 1 );} return
2014-04-01 18:00:42 +00:00
new
2015-04-01 06:36:56 +00:00
Min_Result ( $this -> _conn -> _db -> selectCollection ( $Q ) -> find ( array (), $M ) -> sort ( $Cg ) -> limit ( + $z ) -> skip ( $E * $z ));} function
insert ( $Q , $O ){ try { $J = $this -> _conn -> _db -> selectCollection ( $Q ) -> insert ( $O ); $this -> _conn -> errno = $J [ 'code' ]; $this -> _conn -> error = $J [ 'err' ]; $this -> _conn -> last_id = $O [ '_id' ]; return ! $J [ 'err' ];} catch ( Exception $uc ){ $this -> _conn -> error = $uc -> getMessage (); return
2014-04-01 18:00:42 +00:00
false ;}}} function
connect (){ global $b ; $h = new
2015-04-01 06:36:56 +00:00
Min_DB ; $k = $b -> credentials (); if ( $h -> connect ( $k [ 0 ], $k [ 1 ], $k [ 2 ])) return $h ; return $h -> error ;} function
2014-04-01 18:00:42 +00:00
error (){ global $h ; return
h ( $h -> error );} function
2015-04-01 06:36:56 +00:00
logged_user (){ global $b ; $k = $b -> credentials (); return $k [ 1 ];} function
get_databases ( $Lc ){ global $h ; $J = array (); $Jb = $h -> _link -> listDBs (); foreach ( $Jb [ 'databases' ] as $m ) $J [] = $m [ 'name' ]; return $J ;} function
2014-04-01 18:00:42 +00:00
collations (){ return
array ();} function
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){} function
count_tables ( $l ){ global $h ; $J = array (); foreach ( $l
as $m ) $J [ $m ] = count ( $h -> _link -> selectDB ( $m ) -> getCollectionNames ( true )); return $J ;} function
2014-04-01 18:00:42 +00:00
tables_list (){ global $h ; return
array_fill_keys ( $h -> _db -> getCollectionNames ( true ), 'table' );} function
2015-04-01 06:36:56 +00:00
table_status ( $C = " " , $Ec = false ){ $J = array (); foreach ( tables_list () as $Q => $U ){ $J [ $Q ] = array ( " Name " => $Q ); if ( $C == $Q ) return $J [ $Q ];} return $J ;} function
2014-04-01 18:00:42 +00:00
information_schema (){} function
is_view ( $R ){} function
2015-04-01 06:36:56 +00:00
drop_databases ( $l ){ global $h ; foreach ( $l
as $m ){ $cg = $h -> _link -> selectDB ( $m ) -> drop (); if ( ! $cg [ 'ok' ]) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
2015-04-01 06:36:56 +00:00
indexes ( $Q , $i = null ){ global $h ; $J = array (); foreach ( $h -> _db -> selectCollection ( $Q ) -> getIndexInfo () as $u ){ $Pb = array (); foreach ( $u [ " key " ] as $e => $U ) $Pb [] = ( $U ==- 1 ? '1' : null ); $J [ $u [ " name " ]] = array ( " type " => ( $u [ " name " ] == " _id_ " ? " PRIMARY " : ( $u [ " unique " ] ? " UNIQUE " : " INDEX " )), " columns " => array_keys ( $u [ " key " ]), " lengths " => array (), " descs " => $Pb ,);} return $J ;} function
2014-04-01 18:00:42 +00:00
fields ( $Q ){ return
fields_from_edit ();} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2014-04-01 18:00:42 +00:00
foreign_keys ( $Q ){ return
array ();} function
fk_support ( $R ){} function
engines (){ return
array ();} function
found_rows ( $R , $Z ){ global $h ; return $h -> _db -> selectCollection ( $_GET [ " select " ]) -> count ( $Z );} function
2015-04-01 06:36:56 +00:00
alter_table ( $Q , $C , $p , $Mc , $rb , $nc , $d , $La , $of ){ global $h ; if ( $Q == " " ){ $h -> _db -> createCollection ( $C ); return
2014-04-01 18:00:42 +00:00
true ;}} function
drop_tables ( $S ){ global $h ; foreach ( $S
2015-04-01 06:36:56 +00:00
as $Q ){ $cg = $h -> _db -> selectCollection ( $Q ) -> drop (); if ( ! $cg [ 'ok' ]) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
truncate_tables ( $S ){ global $h ; foreach ( $S
2015-04-01 06:36:56 +00:00
as $Q ){ $cg = $h -> _db -> selectCollection ( $Q ) -> remove (); if ( ! $cg [ 'ok' ]) return
2014-04-01 18:00:42 +00:00
false ;} return
true ;} function
alter_indexes ( $Q , $c ){ global $h ; foreach ( $c
as $X ){ list ( $U , $C , $O ) = $X ; if ( $O == " DROP " ) $J = $h -> _db -> command ( array ( " deleteIndexes " => $Q , " index " => $C )); else { $f = array (); foreach ( $O
2015-04-01 06:36:56 +00:00
as $e ){ $e = preg_replace ( '~ DESC$~' , '' , $e , 1 , $Ab ); $f [ $e ] = ( $Ab ? - 1 : 1 );} $J = $h -> _db -> selectCollection ( $Q ) -> ensureIndex ( $f , array ( " unique " => ( $U == " UNIQUE " ), " name " => $C ,));} if ( $J [ 'errmsg' ]){ $h -> error = $J [ 'errmsg' ]; return
2014-04-01 18:00:42 +00:00
false ;}} return
true ;} function
last_id (){ global $h ; return $h -> last_id ;} function
table ( $t ){ return $t ;} function
idf_escape ( $t ){ return $t ;} function
2015-04-01 06:36:56 +00:00
support ( $Fc ){ return
preg_match ( " ~database|indexes~ " , $Fc );} $w = " mongo " ; $Se = array ( " = " ); $Uc = array (); $Zc = array (); $fc = array ( array ( " json " ));} $Xb [ " elastic " ] = " Elasticsearch (beta) " ; if ( isset ( $_GET [ " elastic " ])){ $_f = 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
2015-04-01 06:36:56 +00:00
rootQuery ( $rf , $wb = array (), $se = 'GET' ){ @ ini_set ( 'track_errors' , 1 ); $Hc =@ file_get_contents ( $this -> _url . '/' . ltrim ( $rf , '/' ), false , stream_context_create ( array ( 'http' => array ( 'method' => $se , 'content' => json_encode ( $wb ), 'ignore_errors' => 1 ,)))); if ( ! $Hc ){ $this -> error = $php_errormsg ; return $Hc ;} if ( ! preg_match ( '~^HTTP/[0-9.]+ 2~i' , $http_response_header [ 0 ])){ $this -> error = $Hc ; return
false ;} $J = json_decode ( $Hc , true ); if ( $J === null ){ $this -> errno = json_last_error (); if ( function_exists ( 'json_last_error_msg' )) $this -> error = json_last_error_msg (); else { $vb = get_defined_constants ( true ); foreach ( $vb [ 'json' ] as $C => $Y ){ if ( $Y == $this -> errno && preg_match ( '~^JSON_ERROR_~' , $C )){ $this -> error = $C ; break ;}}}} return $J ;} function
query ( $rf , $wb = array (), $se = 'GET' ){ return $this -> rootQuery (( $this -> _db != " " ? " $this->_db / " : " / " ) . ltrim ( $rf , '/' ), $wb , $se );} function
2014-04-01 18:00:42 +00:00
connect ( $N , $V , $G ){ $this -> _url = " http:// $V : $G @ $N / " ; $J = $this -> query ( '' ); if ( $J ) $this -> server_info = $J [ 'version' ][ 'number' ]; return ( bool ) $J ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ $this -> _db = $Gb ; return
2014-04-01 18:00:42 +00:00
true ;} function
quote ( $P ){ return $P ;}} class
Min_Result { var $num_rows , $_rows ; function
Min_Result ( $L ){ $this -> num_rows = count ( $this -> _rows ); $this -> _rows = $L ; reset ( $this -> _rows );} function
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
2015-04-01 06:36:56 +00:00
select ( $Q , $M , $Z , $Xc , $Xe = array (), $z = 1 , $E = 0 , $Ef = false ){ global $b ; $Eb = array (); $H = " $Q /_search " ; if ( $M != array ( " * " )) $Eb [ " fields " ] = $M ; if ( $Xe ){ $Cg = array (); foreach ( $Xe
as $lb ){ $lb = preg_replace ( '~ DESC$~' , '' , $lb , 1 , $Ab ); $Cg [] = ( $Ab ? array ( $lb => " desc " ) : $lb );} $Eb [ " sort " ] = $Cg ;} if ( $z ){ $Eb [ " size " ] =+ $z ; if ( $E ) $Eb [ " from " ] = ( $E * $z );} foreach ( $Z
as $X ){ list ( $lb , $Qe , $X ) = explode ( " " , $X , 3 ); if ( $lb == " _id " ) $Eb [ " query " ][ " ids " ][ " values " ][] = $X ; elseif ( $lb . $X != " " ){ $eh = array ( " term " => array (( $lb != " " ? $lb : " _all " ) => $X )); if ( $Qe == " = " ) $Eb [ " query " ][ " filtered " ][ " filter " ][ " and " ][] = $eh ; else $Eb [ " query " ][ " filtered " ][ " query " ][ " bool " ][ " must " ][] = $eh ;}} if ( $Eb [ " query " ] &&! $Eb [ " query " ][ " filtered " ][ " query " ] &&! $Eb [ " query " ][ " ids " ]) $Eb [ " query " ][ " filtered " ][ " query " ] = array ( " match_all " => array ()); $Hg = microtime ( true ); $qg = $this -> _conn -> query ( $H , $Eb ); if ( $Ef ) echo $b -> selectQuery ( " $H : " . print_r ( $Eb , true ), format_time ( $Hg )); if ( ! $qg ) return
false ; $J = array (); foreach ( $qg [ 'hits' ][ 'hits' ] as $gd ){ $K = array (); if ( $M == array ( " * " )) $K [ " _id " ] = $gd [ " _id " ]; $p = $gd [ '_source' ]; if ( $M != array ( " * " )){ $p = array (); foreach ( $M
as $x ) $p [ $x ] = $gd [ 'fields' ][ $x ];} foreach ( $p
as $x => $X ){ if ( $Eb [ " fields " ]) $X = $X [ 0 ]; $K [ $x ] = ( is_array ( $X ) ? json_encode ( $X ) : $X );} $J [] = $K ;} return
2014-04-01 18:00:42 +00:00
new
Min_Result ( $J );}} function
connect (){ global $b ; $h = new
2015-04-01 06:36:56 +00:00
Min_DB ; $k = $b -> credentials (); if ( $h -> connect ( $k [ 0 ], $k [ 1 ], $k [ 2 ])) return $h ; return $h -> error ;} function
support ( $Fc ){ return
preg_match ( " ~database|table|columns~ " , $Fc );} function
logged_user (){ global $b ; $k = $b -> credentials (); return $k [ 1 ];} function
get_databases (){ global $h ; $J = $h -> 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
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){} function
engines (){ return
array ();} function
count_tables ( $l ){ global $h ; $J = $h -> query ( '_mapping' ); if ( $J ) $J = array_map ( 'count' , $J ); return $J ;} function
tables_list (){ global $h ; $J = $h -> query ( '_mapping' ); if ( $J ) $J = array_fill_keys ( array_keys ( $J [ $h -> _db ][ " mappings " ]), 'table' ); return $J ;} function
table_status ( $C = " " , $Ec = false ){ global $h ; $qg = $h -> query ( " _search?search_type=count " , array ( " facets " => array ( " count_by_type " => array ( " terms " => array ( " field " => " _type " ,)))), " POST " ); $J = array (); if ( $qg ){ foreach ( $qg [ " facets " ][ " count_by_type " ][ " terms " ] as $Q ) $J [ $Q [ " term " ]] = array ( " Name " => $Q [ " term " ], " Engine " => " table " , " Rows " => $Q [ " count " ],); if ( $C != " " && $C == $Q [ " term " ]) return $J [ $C ];} return $J ;} function
2014-04-01 18:00:42 +00:00
error (){ global $h ; return
h ( $h -> error );} function
information_schema (){} function
is_view ( $R ){} function
indexes ( $Q , $i = null ){ return
array ( array ( " type " => " PRIMARY " , " columns " => array ( " _id " )),);} function
2015-04-01 06:36:56 +00:00
fields ( $Q ){ global $h ; $I = $h -> query ( " $Q /_mapping " ); $J = array (); if ( $I ){ $ce = $I [ $Q ][ 'properties' ]; if ( ! $ce ) $ce = $I [ $h -> _db ][ 'mappings' ][ $Q ][ 'properties' ]; if ( $ce ){ foreach ( $ce
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
2014-04-01 18:00:42 +00:00
foreign_keys ( $Q ){ return
array ();} function
table ( $t ){ return $t ;} function
idf_escape ( $t ){ return $t ;} function
2015-04-01 06:36:56 +00:00
convert_field ( $o ){} function
unconvert_field ( $o , $J ){ return $J ;} function
2014-04-01 18:00:42 +00:00
fk_support ( $R ){} function
found_rows ( $R , $Z ){ return
null ;} function
2015-04-01 06:36:56 +00:00
create_database ( $m ){ global $h ; return $h -> rootQuery ( urlencode ( $m ), array (), 'PUT' );} function
drop_databases ( $l ){ global $h ; return $h -> rootQuery ( urlencode ( implode ( ',' , $l )), array (), 'DELETE' );} function
2014-04-01 18:00:42 +00:00
drop_tables ( $S ){ global $h ; $J = true ; foreach ( $S
2015-04-01 06:36:56 +00:00
as $Q ) $J = $J && $h -> query ( urlencode ( $Q ), array (), 'DELETE' ); return $J ;} $w = " elastic " ; $Se = array ( " = " , " query " ); $Uc = array (); $Zc = array (); $fc = array ( array ( " json " ));} $Xb = array ( " server " => " MySQL " ) + $Xb ; if ( ! defined ( " DRIVER " )){ $_f = 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
Min_DB (){ parent :: init ();} function
2015-04-01 06:36:56 +00:00
connect ( $N , $V , $G ){ mysqli_report ( MYSQLI_REPORT_OFF ); list ( $hd , $wf ) = explode ( " : " , $N , 2 ); $J =@ $this -> real_connect (( $N != " " ? $hd : ini_get ( " mysqli.default_host " )),( $N . $V != " " ? $V : ini_get ( " mysqli.default_user " )),( $N . $V . $G != " " ? $G : ini_get ( " mysqli.default_pw " )), null ,( is_numeric ( $wf ) ? $wf : ini_get ( " mysqli.default_port " )),( ! is_numeric ( $wf ) ? $wf : null )); return $J ;} function
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
2014-04-01 18:00:42 +00:00
quote ( $P ){ return " ' " . $this -> escape_string ( $P ) . " ' " ;}}} elseif ( extension_loaded ( " mysql " ) &&! ( ini_get ( " sql.safe_mode " ) && extension_loaded ( " pdo_mysql " ))){ class
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
2014-04-01 18:00:42 +00:00
quote ( $P ){ return " ' " . mysql_real_escape_string ( $P , $this -> _link ) . " ' " ;} function
2015-04-01 06:36:56 +00:00
select_db ( $Gb ){ return
mysql_select_db ( $Gb , $this -> _link );} function
query ( $H , $Ch = false ){ $I =@ ( $Ch ? 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
Min_Result ( $I ){ $this -> _result = $I ; $this -> num_rows = mysql_num_rows ( $I );} function
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
select_db ( $Gb ){ return $this -> query ( " USE " . idf_escape ( $Gb ));} function
query ( $H , $Ch = false ){ $this -> setAttribute ( 1000 , ! $Ch ); return
parent :: query ( $H , $Ch );}}} class
2014-04-01 18:00:42 +00:00
Min_Driver
extends
Min_SQL { function
insert ( $Q , $O ){ return ( $O ? parent :: insert ( $Q , $O ) : queries ( " INSERT INTO " . table ( $Q ) . " () \n VALUES () " ));} function
2015-04-01 06:36:56 +00:00
insertUpdate ( $Q , $L , $Cf ){ $f = array_keys ( reset ( $L )); $Af = " INSERT INTO " . table ( $Q ) . " ( " . implode ( " , " , $f ) . " ) VALUES \n " ; $Th = array (); foreach ( $f
as $x ) $Th [ $x ] = " $x = VALUES( $x ) " ; $Og = " \n ON DUPLICATE KEY UPDATE " . implode ( " , " , $Th ); $Th = array (); $y = 0 ; foreach ( $L
as $O ){ $Y = " ( " . implode ( " , " , $O ) . " ) " ; if ( $Th && ( strlen ( $Af ) + $y + strlen ( $Y ) + strlen ( $Og ) > 1e6 )){ if ( ! queries ( $Af . implode ( " , \n " , $Th ) . $Og )) return
false ; $Th = array (); $y = 0 ;} $Th [] = $Y ; $y += strlen ( $Y ) + 2 ;} return
queries ( $Af . implode ( " , \n " , $Th ) . $Og );}} function
2014-04-01 18:00:42 +00:00
idf_escape ( $t ){ return " ` " . str_replace ( " ` " , " `` " , $t ) . " ` " ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ global $b ; $h = new
2015-04-01 06:36:56 +00:00
Min_DB ; $k = $b -> credentials (); if ( $h -> connect ( $k [ 0 ], $k [ 1 ], $k [ 2 ])){ $h -> set_charset ( charset ( $h )); $h -> query ( " SET sql_quote_show_create = 1, autocommit = 1 " ); return $h ;} $J = $h -> error ; if ( function_exists ( 'iconv' ) &&! is_utf8 ( $J ) && strlen ( $mg = iconv ( " windows-1250 " , " utf-8 " , $J )) > strlen ( $J )) $J = $mg ; return $J ;} function
get_databases ( $Lc ){ global $h ; $J = get_session ( " dbs " ); if ( $J === null ){ $H = ( $h -> server_info >= 5 ? " SELECT SCHEMA_NAME FROM information_schema.SCHEMATA " : " SHOW DATABASES " ); $J = ( $Lc ? slow_query ( $H ) : get_vals ( $H )); restart_session (); set_session ( " dbs " , $J ); stop_session ();} return $J ;} function
limit ( $H , $Z , $z , $D = 0 , $vg = " " ){ return " $H $Z " . ( $z !== null ? $vg . " LIMIT $z " . ( $D ? " OFFSET $D " : " " ) : " " );} function
2014-04-01 18:00:42 +00:00
limit1 ( $H , $Z ){ return
limit ( $H , $Z , 1 );} function
2015-04-01 06:36:56 +00:00
db_collation ( $m , $nb ){ global $h ; $J = null ; $j = $h -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ); if ( preg_match ( '~ COLLATE ([^ ]+)~' , $j , $B )) $J = $B [ 1 ]; elseif ( preg_match ( '~ CHARACTER SET ([^ ]+)~' , $j , $B )) $J = $nb [ $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
logged_user (){ global $h ; return $h -> result ( " SELECT USER() " );} function
tables_list (){ global $h ; return
get_key_vals ( $h -> 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
table_status ( $C = " " , $Ec = false ){ global $h ; $J = array (); foreach ( get_rows ( $Ec && $h -> server_info >= 5 ? " SELECT TABLE_NAME AS Name, 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
2014-04-01 18:00:42 +00:00
is_view ( $R ){ return $R [ " Engine " ] === null ;} function
2015-04-01 06:36:56 +00:00
fk_support ( $R ){ global $h ; return
preg_match ( '~InnoDB|IBMDB2I~i' , $R [ " Engine " ]) || ( preg_match ( '~NDB~i' , $R [ " Engine " ]) && version_compare ( $h -> server_info , '5.6' ) >= 0 );} function
2014-04-01 18:00:42 +00:00
fields ( $Q ){ $J = array (); foreach ( get_rows ( " SHOW FULL COLUMNS FROM " . table ( $Q )) 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 ( $Q , $i = null ){ $J = array (); foreach ( get_rows ( " SHOW INDEX FROM " . table ( $Q ), $i ) as $K ){ $J [ $K [ " Key_name " ]][ " type " ] = ( $K [ " Key_name " ] == " PRIMARY " ? " PRIMARY " : ( $K [ " Index_type " ] == " FULLTEXT " ? " FULLTEXT " : ( $K [ " Non_unique " ] ? " INDEX " : " UNIQUE " ))); $J [ $K [ " Key_name " ]][ " columns " ][] = $K [ " Column_name " ]; $J [ $K [ " Key_name " ]][ " lengths " ][] = $K [ " Sub_part " ]; $J [ $K [ " Key_name " ]][ " descs " ][] = null ;} return $J ;} function
2015-04-01 06:36:56 +00:00
foreign_keys ( $Q ){ global $h , $Ne ; static $tf = '`(?:[^`]|``)+`' ; $J = array (); $Bb = $h -> result ( " SHOW CREATE TABLE " . table ( $Q ), 1 ); if ( $Bb ){ preg_match_all ( " ~CONSTRAINT ( $tf ) FOREIGN KEY ? \\ (((?: $tf ,? ?)+) \\ ) REFERENCES ( $tf )(?: \\ .( $tf ))? \\ (((?: $tf ,? ?)+) \\ )(?: ON DELETE ( $Ne ))?(?: ON UPDATE ( $Ne ))?~ " , $Bb , $ee , PREG_SET_ORDER ); foreach ( $ee
as $B ){ preg_match_all ( " ~ $tf ~ " , $B [ 2 ], $Dg ); preg_match_all ( " ~ $tf ~ " , $B [ 5 ], $bh ); $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' , $Dg [ 0 ]), " target " => array_map ( 'idf_unescape' , $bh [ 0 ]), " on_delete " => ( $B [ 6 ] ? $B [ 6 ] : " RESTRICT " ), " on_update " => ( $B [ 7 ] ? $B [ 7 ] : " RESTRICT " ),);}} return $J ;} function
2014-04-01 18:00:42 +00:00
view ( $C ){ global $h ; return
array ( " select " => preg_replace ( '~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU' , '' , $h -> result ( " SHOW CREATE VIEW " . table ( $C ), 1 )));} function
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
as $x => $X ) asort ( $J [ $x ]); return $J ;} function
2015-04-01 06:36:56 +00:00
information_schema ( $m ){ global $h ; return ( $h -> server_info >= 5 && $m == " information_schema " ) || ( $h -> server_info >= 5.5 && $m == " performance_schema " );} function
2014-04-01 18:00:42 +00:00
error (){ global $h ; return
h ( preg_replace ( '~^You have an error.*syntax to use~U' , " Syntax error " , $h -> error ));} function
2015-04-01 06:36:56 +00:00
error_line (){ global $h ; if ( preg_match ( '~ at line ([0-9]+)$~' , $h -> error , $Yf )) return $Yf [ 1 ] - 1 ;} function
create_database ( $m , $d ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $d ? " COLLATE " . q ( $d ) : " " ));} function
drop_databases ( $l ){ $J = apply_queries ( " DROP DATABASE " , $l , 'idf_escape' ); restart_session (); set_session ( " dbs " , null ); return $J ;} function
rename_database ( $C , $d ){ $J = false ; if ( create_database ( $C , $d )){ $ag = array (); foreach ( tables_list () as $Q => $U ) $ag [] = table ( $Q ) . " TO " . idf_escape ( $C ) . " . " . table ( $Q ); $J = ( ! $ag || queries ( " RENAME TABLE " . implode ( " , " , $ag ))); 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 $u ){ if ( in_array ( $_POST [ " fields " ][ $_POST [ " auto_increment_col " ]][ " orig " ], $u [ " columns " ], true )){ $Ma = " " ; break ;} if ( $u [ " type " ] == " PRIMARY " ) $Ma = " UNIQUE " ;}} return " AUTO_INCREMENT $Ma " ;} function
alter_table ( $Q , $C , $p , $Mc , $rb , $nc , $d , $La , $of ){ $c = array (); foreach ( $p
as $o ) $c [] = ( $o [ 1 ] ? ( $Q != " " ? ( $o [ 0 ] != " " ? " CHANGE " . idf_escape ( $o [ 0 ]) : " ADD " ) : " " ) . " " . implode ( $o [ 1 ]) . ( $Q != " " ? $o [ 2 ] : " " ) : " DROP " . idf_escape ( $o [ 0 ])); $c = array_merge ( $c , $Mc ); $Ig = ( $rb !== null ? " COMMENT= " . q ( $rb ) : " " ) . ( $nc ? " ENGINE= " . q ( $nc ) : " " ) . ( $d ? " COLLATE " . q ( $d ) : " " ) . ( $La != " " ? " AUTO_INCREMENT= $La " : " " ); if ( $Q == " " ) return
queries ( " CREATE TABLE " . table ( $C ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) $Ig $of " ); if ( $Q != $C ) $c [] = " RENAME TO " . table ( $C ); if ( $Ig ) $c [] = ltrim ( $Ig ); return ( $c || $of ? queries ( " ALTER TABLE " . table ( $Q ) . " \n " . implode ( " , \n " , $c ) . $of ) : true );} function
2014-04-01 18:00:42 +00:00
alter_indexes ( $Q , $c ){ foreach ( $c
as $x => $X ) $c [ $x ] = ( $X [ 2 ] == " DROP " ? " \n DROP INDEX " . idf_escape ( $X [ 1 ]) : " \n ADD $X[0] " . ( $X [ 0 ] == " PRIMARY " ? " KEY " : " " ) . ( $X [ 1 ] != " " ? idf_escape ( $X [ 1 ]) . " " : " " ) . " ( " . implode ( " , " , $X [ 2 ]) . " ) " ); return
queries ( " ALTER TABLE " . table ( $Q ) . implode ( " , " , $c ));} function
truncate_tables ( $S ){ return
apply_queries ( " TRUNCATE TABLE " , $S );} function
2015-04-01 06:36:56 +00:00
drop_views ( $Yh ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $Yh )));} function
2014-04-01 18:00:42 +00:00
drop_tables ( $S ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $S )));} function
2015-04-01 06:36:56 +00:00
move_tables ( $S , $Yh , $bh ){ $ag = array (); foreach ( array_merge ( $S , $Yh ) as $Q ) $ag [] = table ( $Q ) . " TO " . idf_escape ( $bh ) . " . " . table ( $Q ); return
queries ( " RENAME TABLE " . implode ( " , " , $ag ));} function
copy_tables ( $S , $Yh , $bh ){ queries ( " SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' " ); foreach ( $S
as $Q ){ $C = ( $bh == DB ? table ( " copy_ $Q " ) : idf_escape ( $bh ) . " . " . table ( $Q )); if ( ! queries ( " \n DROP TABLE IF EXISTS $C " ) ||! queries ( " CREATE TABLE $C LIKE " . table ( $Q )) ||! queries ( " INSERT INTO $C SELECT * FROM " . table ( $Q ))) return
false ;} foreach ( $Yh
as $Q ){ $C = ( $bh == DB ? table ( " copy_ $Q " ) : idf_escape ( $bh ) . " . " . table ( $Q )); $Xh = view ( $Q ); if ( ! queries ( " DROP VIEW IF EXISTS $C " ) ||! queries ( " CREATE VIEW $C AS $Xh[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
triggers ( $Q ){ $J = array (); foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $Q , " %_ \\ " ))) as $K ) $J [ $K [ " Trigger " ]] = array ( $K [ " Timing " ], $K [ " Event " ]); return $J ;} function
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
routine ( $C , $U ){ global $h , $pc , $ud , $Bh ; $Ca = array ( " bool " , " boolean " , " integer " , " double precision " , " real " , " dec " , " numeric " , " fixed " , " national char " , " national varchar " ); $Ah = " (( " . implode ( " | " , array_merge ( array_keys ( $Bh ), $Ca )) . " ) \\ b(?: \\ s* \\ (((?:[^' \" )]| $pc )++) \\ ))? \\ s*(zerofill \\ s*)?(unsigned(?: \\ s+zerofill)?)?)(?: \\ s*(?:CHARSET|CHARACTER \\ s+SET) \\ s*[' \" ]?([^' \" \\ s,]+)[' \" ]?)? " ; $tf = " \\ s*( " . ( $U == " FUNCTION " ? " " : $ud ) . " )? \\ s*(?:`((?:[^`]|``)*)` \\ s*| \\ b( \\ S+) \\ s+) $Ah " ; $j = $h -> result ( " SHOW CREATE $U " . idf_escape ( $C ), 2 ); preg_match ( " ~ \\ (((?: $tf\\s *,?)*) \\ ) \\ s* " . ( $U == " FUNCTION " ? " RETURNS \\ s+ $Ah\\s + " : " " ) . " (.*)~is " , $j , $B ); $p = array (); preg_match_all ( " ~ $tf\\s *,?~is " , $B [ 1 ], $ee , PREG_SET_ORDER ); foreach ( $ee
as $jf ){ $C = str_replace ( " `` " , " ` " , $jf [ 2 ]) . $jf [ 3 ]; $p [] = array ( " field " => $C , " type " => strtolower ( $jf [ 5 ]), " length " => preg_replace_callback ( " ~ $pc ~s " , 'normalize_enum' , $jf [ 6 ]), " unsigned " => strtolower ( preg_replace ( '~\\s+~' , ' ' , trim ( " $jf[8] $jf[7] " ))), " null " => 1 , " full_type " => $jf [ 4 ], " inout " => strtoupper ( $jf [ 1 ]), " collation " => strtolower ( $jf [ 9 ]),);} if ( $U != " FUNCTION " ) return
array ( " fields " => $p , " definition " => $B [ 11 ]); return
array ( " fields " => $p , " returns " => array ( " type " => $B [ 12 ], " length " => $B [ 13 ], " unsigned " => $B [ 15 ], " collation " => $B [ 16 ]), " definition " => $B [ 17 ], " language " => " SQL " ,);} function
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
last_id (){ global $h ; return $h -> result ( " SELECT LAST_INSERT_ID() " );} function
explain ( $h , $H ){ return $h -> query ( " EXPLAIN " . ( $h -> server_info >= 5.1 ? " PARTITIONS " : " " ) . $H );} function
found_rows ( $R , $Z ){ return ( $Z || $R [ " Engine " ] != " InnoDB " ? null : $R [ " Rows " ]);} function
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2015-04-01 06:36:56 +00:00
set_schema ( $og ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
create_sql ( $Q , $La ){ global $h ; $J = $h -> result ( " SHOW CREATE TABLE " . table ( $Q ), 1 ); if ( ! $La ) $J = preg_replace ( '~ AUTO_INCREMENT=\\d+~' , '' , $J ); return $J ;} function
2014-04-01 18:00:42 +00:00
truncate_sql ( $Q ){ return " TRUNCATE " . table ( $Q );} function
2015-04-01 06:36:56 +00:00
use_sql ( $Gb ){ return " USE " . idf_escape ( $Gb );} function
trigger_sql ( $Q , $Mg ){ $J = " " ; foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $Q , " %_ \\ " )), null , " -- " ) as $K ) $J .= " \n " . ( $Mg == '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
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
support ( $Fc ){ global $h ; return ! preg_match ( " ~scheme|sequence|type|view_trigger " . ( $h -> server_info < 5.1 ? " |event|partitioning " . ( $h -> server_info < 5 ? " |routine|trigger|view " : " " ) : " " ) . " ~ " , $Fc );} $w = " sql " ; $Bh = array (); $Lg = array (); foreach ( array ( lang ( 24 ) => array ( " tinyint " => 3 , " smallint " => 5 , " mediumint " => 8 , " int " => 10 , " bigint " => 20 , " decimal " => 66 , " float " => 12 , " double " => 21 ), lang ( 25 ) => array ( " date " => 10 , " datetime " => 19 , " timestamp " => 19 , " time " => 10 , " year " => 4 ), lang ( 26 ) => 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 $x => $X ){ $Bh += $X ; $Lg [ $x ] = array_keys ( $X );} $Ih = array ( " unsigned " , " zerofill " , " unsigned zerofill " ); $Se = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " REGEXP " , " IN " , " IS NULL " , " NOT LIKE " , " NOT REGEXP " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Uc = array ( " char_length " , " date " , " from_unixtime " , " lower " , " round " , " sec_to_time " , " time_to_sec " , " upper " ); $Zc = array ( " avg " , " count " , " count distinct " , " group_concat " , " max " , " min " , " sum " ); $fc = 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.2.1 " ; class
2014-04-01 18:00:42 +00:00
Adminer { var $operators ; function
name (){ return " <a href='http://www.adminer.org/' target='_blank' id='h1'>Adminer</a> " ;} function
credentials (){ return
array ( SERVER , $_GET [ " username " ], get_password ());} function
2015-04-01 06:36:56 +00:00
permanentLogin ( $j = false ){ return
password_file ( $j );} function
bruteForceKey (){ return $_SERVER [ " REMOTE_ADDR " ];} function
2014-04-01 18:00:42 +00:00
database (){ return
DB ;} function
2015-04-01 06:36:56 +00:00
databases ( $Lc = true ){ return
get_databases ( $Lc );} 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
2015-04-01 06:36:56 +00:00
loginForm (){ global $Xb ; echo ' < table cellspacing = " 0 " >
< tr >< th > ',lang(31),' < td > ',html_select("auth[driver]",$Xb,DRIVER,"loginDriver(this);"),' < tr >< th > ',lang(32),' < td >< input name = " auth[server] " value = " ',h(SERVER),' " title = " hostname[:port] " placeholder = " localhost " autocapitalize = " off " >
< 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] " >
< 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 " >
var username = document . getElementById ( 'username' );
focus ( username );
username . form [ 'auth[driver]' ] . onchange ();
</ script >
< ? php
2015-04-01 06:36:56 +00:00
echo " <p><input type='submit' value=' " . lang ( 36 ) . " '> \n " , checkbox ( " auth[permanent] " , 1 , $_COOKIE [ " adminer_permanent " ], lang ( 37 )) . " \n " ;} function
login ( $ae , $G ){ return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
tableName ( $Sg ){ return
h ( $Sg [ " Name " ]);} function
fieldName ( $o , $Xe = 0 ){ return '<span title="' . h ( $o [ " full_type " ]) . '">' . h ( $o [ " field " ]) . '</span>' ;} function
selectLinks ( $Sg , $O = " " ){ echo '<p class="links">' ; $Zd = array ( " select " => lang ( 38 )); if ( support ( " table " ) || support ( " indexes " )) $Zd [ " table " ] = lang ( 39 ); if ( support ( " table " )){ if ( is_view ( $Sg )) $Zd [ " view " ] = lang ( 40 ); else $Zd [ " create " ] = lang ( 41 );} if ( $O !== null ) $Zd [ " edit " ] = lang ( 42 ); foreach ( $Zd
as $x => $X ) echo " <a href=' " . h ( ME ) . " $x = " . urlencode ( $Sg [ " Name " ]) . ( $x == " edit " ? $O : " " ) . " ' " . bold ( isset ( $_GET [ $x ])) . " > $X </a> " ; echo " \n " ;} function
2014-04-01 18:00:42 +00:00
foreignKeys ( $Q ){ return
foreign_keys ( $Q );} function
2015-04-01 06:36:56 +00:00
backwardKeys ( $Q , $Rg ){ return
2014-04-01 18:00:42 +00:00
array ();} function
2015-04-01 06:36:56 +00:00
backwardKeysPrint ( $Oa , $K ){} function
selectQuery ( $H , $ih ){ global $w ; return " <p><code class='jush- $w '> " . h ( str_replace ( " \n " , " " , $H )) . " </code> <span class='time'>( $ih )</span> " . ( support ( " sql " ) ? " <a href=' " . h ( ME ) . " sql= " . urlencode ( $H ) . " '> " . lang ( 10 ) . " </a> " : " " ) . " </p> " ;} function
2014-04-01 18:00:42 +00:00
rowDescription ( $Q ){ return " " ;} function
2015-04-01 06:36:56 +00:00
rowDescriptions ( $L , $Nc ){ return $L ;} function
selectLink ( $X , $o ){} function
selectVal ( $X , $_ , $o , $ef ){ $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 = lang ( 43 , strlen ( $ef )); return ( $_ ? " <a href=' " . h ( $_ ) . " ' " . ( is_url ( $_ ) ? " rel='noreferrer' " : " " ) . " > $J </a> " : $J );} function
editVal ( $X , $o ){ return $X ;} function
selectColumnsPrint ( $M , $f ){ global $Uc , $Zc ; print_fieldset ( " select " , lang ( 44 ), $M ); $s = 0 ; $M [ " " ] = array (); foreach ( $M
as $x => $X ){ $X = $_GET [ " columns " ][ $x ]; $e = select_input ( " name='columns[ $s ][col]' onchange=' " . ( $x !== " " ? " selectFieldChange(this.form) " : " selectAddRow(this) " ) . " ;' " , $f , $X [ " col " ]); echo " <div> " . ( $Uc || $Zc ? " <select name='columns[ $s ][fun]' onchange='helpClose(); " . ( $x !== " " ? " " : " this.nextSibling.nextSibling.onchange(); " ) . " ' " . on_help ( " getTarget(event).value && getTarget(event).value.replace(/ | \$ /, '(') + ')' " , 1 ) . " > " . optionlist ( array ( - 1 => " " ) + array_filter ( array ( lang ( 45 ) => $Uc , lang ( 46 ) => $Zc )), $X [ " fun " ]) . " </select> " . " ( $e ) " : $e ) . " </div> \n " ; $s ++ ;} echo " </div></fieldset> \n " ;} function
selectSearchPrint ( $Z , $f , $v ){ print_fieldset ( " search " , lang ( 47 ), $Z ); foreach ( $v
as $s => $u ){ if ( $u [ " type " ] == " FULLTEXT " ){ echo " (<i> " . implode ( " </i>, <i> " , array_map ( 'h' , $u [ " 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 ' " , $f , $X [ " col " ], " ( " . lang ( 48 ) . " ) " ), 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 ( $Xe , $f , $v ){ print_fieldset ( " sort " , lang ( 49 ), $Xe ); $s = 0 ; foreach (( array ) $_GET [ " order " ] as $x => $X ){ if ( $X != " " ){ echo " <div> " . select_input ( " name='order[ $s ]' onchange='selectFieldChange(this.form);' " , $f , $X ), checkbox ( " desc[ $s ] " , 1 , isset ( $_GET [ " desc " ][ $x ]), lang ( 50 )) . " </div> \n " ; $s ++ ;}} echo " <div> " . select_input ( " name='order[ $s ]' onchange='selectAddRow(this);' " , $f ), checkbox ( " desc[ $s ] " , 1 , false , lang ( 50 )) . " </div> \n " , " </div></fieldset> \n " ;} function
selectLimitPrint ( $z ){ echo " <fieldset><legend> " . lang ( 51 ) . " </legend><div> " ; echo " <input type='number' name='limit' class='size' value=' " . h ( $z ) . " ' onchange='selectFieldChange(this.form);'> " , " </div></fieldset> \n " ;} function
selectLengthPrint ( $hh ){ if ( $hh !== null ){ echo " <fieldset><legend> " . lang ( 52 ) . " </legend><div> " , " <input type='number' name='text_length' class='size' value=' " . h ( $hh ) . " '> " , " </div></fieldset> \n " ;}} function
selectActionPrint ( $v ){ echo " <fieldset><legend> " . lang ( 53 ) . " </legend><div> " , " <input type='submit' value=' " . lang ( 44 ) . " '> " , " <span id='noindex' title=' " . lang ( 54 ) . " '></span> " , " <script type='text/javascript'> \n " , " var indexColumns = " ; $f = array (); foreach ( $v
2014-04-01 18:00:42 +00:00
as $u ){ if ( $u [ " type " ] != " FULLTEXT " ) $f [ reset ( $u [ " columns " ])] = 1 ;} $f [ " " ] = 1 ; foreach ( $f
as $x => $X ) json_row ( $x ); echo " ; \n " , " selectFieldChange(document.getElementById('form')); \n " , " </script> \n " , " </div></fieldset> \n " ;} function
selectCommandPrint (){ return ! information_schema ( DB );} function
selectImportPrint (){ return ! information_schema ( DB );} function
2015-04-01 06:36:56 +00:00
selectEmailPrint ( $kc , $f ){} function
selectColumnsProcess ( $f , $v ){ global $Uc , $Zc ; $M = array (); $Xc = array (); foreach (( array ) $_GET [ " columns " ] as $x => $X ){ if ( $X [ " fun " ] == " count " || ( $X [ " col " ] != " " && ( ! $X [ " fun " ] || in_array ( $X [ " fun " ], $Uc ) || in_array ( $X [ " fun " ], $Zc )))){ $M [ $x ] = apply_sql_function ( $X [ " fun " ],( $X [ " col " ] != " " ? idf_escape ( $X [ " col " ]) : " * " )); if ( ! in_array ( $X [ " fun " ], $Zc )) $Xc [] = $M [ $x ];}} return
array ( $M , $Xc );} function
selectSearchProcess ( $p , $v ){ global $h , $w ; $J = array (); foreach ( $v
as $s => $u ){ if ( $u [ " type " ] == " FULLTEXT " && $_GET [ " fulltext " ][ $s ] != " " ) $J [] = " MATCH ( " . implode ( " , " , array_map ( 'idf_escape' , $u [ " 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 )){ $tb = " $X[op] " ; if ( preg_match ( '~IN$~' , $X [ " op " ])){ $nd = process_length ( $X [ " val " ]); $tb .= " " . ( $nd != " " ? $nd : " (NULL) " );} elseif ( $X [ " op " ] == " SQL " ) $tb = " $X[val] " ; elseif ( $X [ " op " ] == " LIKE %% " ) $tb = " LIKE " . $this -> processInput ( $p [ $X [ " col " ]], " % $X[val] % " ); elseif ( $X [ " op " ] == " ILIKE %% " ) $tb = " ILIKE " . $this -> processInput ( $p [ $X [ " col " ]], " % $X[val] % " ); elseif ( ! preg_match ( '~NULL$~' , $X [ " op " ])) $tb .= " " . $this -> processInput ( $p [ $X [ " col " ]], $X [ " val " ]); if ( $X [ " col " ] != " " ) $J [] = idf_escape ( $X [ " col " ]) . $tb ; else { $ob = array (); foreach ( $p
as $C => $o ){ $Cd = 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 " ]) || $Cd )){ $C = idf_escape ( $C ); $ob [] = ( $w == " sql " && $Cd &&! preg_match ( " ~^utf8_~ " , $o [ " collation " ]) ? " CONVERT( $C USING " . charset ( $h ) . " ) " : $C );}} $J [] = ( $ob ? " ( " . implode ( " $tb OR " , $ob ) . " $tb ) " : " 0 " );}}} return $J ;} function
selectOrderProcess ( $p , $v ){ $J = array (); foreach (( array ) $_GET [ " order " ] as $x => $X ){ if ( $X != " " ) $J [] = ( preg_match ( '~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~' , $X ) ? $X : idf_escape ( $X )) . ( isset ( $_GET [ " desc " ][ $x ]) ? " 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
2015-04-01 06:36:56 +00:00
selectEmailProcess ( $Z , $Nc ){ return
2014-04-01 18:00:42 +00:00
false ;} function
2015-04-01 06:36:56 +00:00
selectQueryBuild ( $M , $Z , $Xc , $Xe , $z , $E ){ return " " ;} function
messageQuery ( $H , $ih ){ global $w ; restart_session (); $ed =& get_session ( " queries " ); $jd = " sql- " . count ( $ed [ $_GET [ " db " ]]); if ( strlen ( $H ) > 1e6 ) $H = preg_replace ( '~[\x80-\xFF]+$~' , '' , substr ( $H , 0 , 1e6 )) . " \n ... " ; $ed [ $_GET [ " db " ]][] = array ( $H , time (), $ih ); return " <span class='time'> " .@ date ( " H:i:s " ) . " </span> <a href='# $jd ' onclick= \" return !toggle(' $jd '); \" > " . lang ( 55 ) . " </a> " . " <div id=' $jd ' class='hidden'><pre><code class='jush- $w '> " . shorten_utf8 ( $H , 1000 ) . '</code></pre>' . ( $ih ? " <span class='time'>( $ih )</span> " : '' ) . ( support ( " sql " ) ? '<p><a href="' . h ( str_replace ( " db= " . urlencode ( DB ), " db= " . urlencode ( $_GET [ " db " ]), ME ) . 'sql=&history=' . ( count ( $ed [ $_GET [ " db " ]]) - 1 )) . '">' . lang ( 10 ) . '</a>' : '' ) . '</div>' ;} function
editFunctions ( $o ){ global $fc ; $J = ( $o [ " null " ] ? " NULL/ " : " " ); foreach ( $fc
as $x => $Uc ){ if ( ! $x || ( ! isset ( $_GET [ " call " ]) && ( isset ( $_GET [ " select " ]) || where ( $_GET )))){ foreach ( $Uc
as $tf => $X ){ if ( ! $tf || preg_match ( " ~ $tf ~ " , $o [ " type " ])) $J .= " / $X " ;} if ( $x &&! preg_match ( '~set|blob|bytea|raw|file~' , $o [ " type " ])) $J .= " /SQL " ;}} if ( $o [ " auto_increment " ] &&! isset ( $_GET [ " select " ]) &&! where ( $_GET )) $J = lang ( 56 ); return
2014-04-01 18:00:42 +00:00
explode ( " / " , $J );} function
2015-04-01 06:36:56 +00:00
editInput ( $Q , $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
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
dumpOutput (){ $J = array ( 'text' => lang ( 57 ), 'file' => lang ( 58 )); 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
dumpTable ( $Q , $Mg , $Dd = 0 ){ if ( $_POST [ " format " ] != " sql " ){ echo " \xef \xbb \xbf " ; if ( $Mg ) dump_csv ( array_keys ( fields ( $Q )));} else { if ( $Dd == 2 ){ $p = array (); foreach ( fields ( $Q ) as $C => $o ) $p [] = idf_escape ( $C ) . " $o[full_type] " ; $j = " CREATE TABLE " . table ( $Q ) . " ( " . implode ( " , " , $p ) . " ) " ;} else $j = create_sql ( $Q , $_POST [ " auto_increment " ]); set_utf8mb4 ( $j ); if ( $Mg && $j ){ if ( $Mg == " DROP+CREATE " || $Dd == 1 ) echo " DROP " . ( $Dd == 2 ? " VIEW " : " TABLE " ) . " IF EXISTS " . table ( $Q ) . " ; \n " ; if ( $Dd == 1 ) $j = remove_definer ( $j ); echo " $j ; \n \n " ;}}} function
dumpData ( $Q , $Mg , $H ){ global $h , $w ; $ge = ( $w == " sqlite " ? 0 : 1048576 ); if ( $Mg ){ if ( $_POST [ " format " ] == " sql " ){ if ( $Mg == " TRUNCATE+INSERT " ) echo
truncate_sql ( $Q ) . " ; \n " ; $p = fields ( $Q );} $I = $h -> query ( $H , 1 ); if ( $I ){ $wd = " " ; $Xa = " " ; $Kd = array (); $Og = " " ; $Gc = ( $Q != '' ? 'fetch_assoc' : 'fetch_row' ); while ( $K = $I -> $Gc ()){ if ( ! $Kd ){ $Th = array (); foreach ( $K
as $X ){ $o = $I -> fetch_field (); $Kd [] = $o -> name ; $x = idf_escape ( $o -> name ); $Th [] = " $x = VALUES( $x ) " ;} $Og = ( $Mg == " INSERT+UPDATE " ? " \n ON DUPLICATE KEY UPDATE " . implode ( " , " , $Th ) : " " ) . " ; \n " ;} if ( $_POST [ " format " ] != " sql " ){ if ( $Mg == " table " ){ dump_csv ( $Kd ); $Mg = " INSERT " ;} dump_csv ( $K );} else { if ( ! $wd ) $wd = " INSERT INTO " . table ( $Q ) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $Kd )) . " ) VALUES " ; foreach ( $K
as $x => $X ){ $o = $p [ $x ]; $K [ $x ] = ( $X !== null ? unconvert_field ( $o , preg_match ( '~(^|[^o])int|float|double|decimal~' , $o [ " type " ]) && $X != '' ? $X : q ( $X )) : " NULL " );} $mg = ( $ge ? " \n " : " " ) . " ( " . implode ( " , \t " , $K ) . " ) " ; if ( ! $Xa ) $Xa = $wd . $mg ; elseif ( strlen ( $Xa ) + 4 + strlen ( $mg ) + strlen ( $Og ) < $ge ) $Xa .= " , $mg " ; else { echo $Xa . $Og ; $Xa = $wd . $mg ;}}} if ( $Xa ) echo $Xa . $Og ;} elseif ( $_POST [ " format " ] == " sql " ) echo " -- " . str_replace ( " \n " , " " , $h -> error ) . " \n " ;}} function
dumpFilename ( $kd ){ return
friendly_url ( $kd != " " ? $kd : ( SERVER != " " ? SERVER : " localhost " ));} function
dumpHeaders ( $kd , $ve = false ){ $hf = $_POST [ " output " ]; $Ac = ( preg_match ( '~sql~' , $_POST [ " format " ]) ? " sql " : ( $ve ? " tar " : " csv " )); header ( " Content-Type: " . ( $hf == " gz " ? " application/x-gzip " : ( $Ac == " tar " ? " application/x-tar " : ( $Ac == " sql " || $hf != " file " ? " text/plain " : " text/csv " ) . " ; charset=utf-8 " ))); if ( $hf == " gz " ) ob_start ( 'ob_gzencode' , 1e6 ); return $Ac ;} function
homepage (){ echo '<p class="links">' . ( $_GET [ " ns " ] == " " && support ( " database " ) ? '<a href="' . h ( ME ) . 'database=">' . lang ( 59 ) . " </a> \n " : " " ),( support ( " scheme " ) ? " <a href=' " . h ( ME ) . " scheme='> " . ( $_GET [ " ns " ] != " " ? lang ( 60 ) : lang ( 61 )) . " </a> \n " : " " ),( $_GET [ " ns " ] !== " " ? '<a href="' . h ( ME ) . 'schema=">' . lang ( 62 ) . " </a> \n " : " " ),( support ( " privileges " ) ? " <a href=' " . h ( ME ) . " privileges='> " . lang ( 63 ) . " </a> \n " : " " ); return
2014-04-01 18:00:42 +00:00
true ;} function
2015-04-01 06:36:56 +00:00
navigation ( $ue ){ global $ia , $w , $Xb , $h ; echo ' < h1 >
2014-04-01 18:00:42 +00:00
',$this->name(),' < span class = " version " > ',$ia,' </ span >
< a href = " http://www.adminer.org/#download " target = " _blank " id = " version " > ',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),' </ a >
</ h1 >
2015-04-01 06:36:56 +00:00
' ; if ( $ue == " auth " ){ $Kc = true ; foreach (( array ) $_SESSION [ " pwds " ] as $Vh => $zg ){ foreach ( $zg
as $N => $Qh ){ foreach ( $Qh
as $V => $G ){ if ( $G !== null ){ if ( $Kc ){ echo " <p id='logins' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'> \n " ; $Kc = false ;} $Jb = $_SESSION [ " db " ][ $Vh ][ $N ][ $V ]; foreach (( $Jb ? array_keys ( $Jb ) : array ( " " )) as $m ) echo " <a href=' " . h ( auth_url ( $Vh , $N , $V , $m )) . " '>( $Xb[$Vh] ) " . h ( $V . ( $N != " " ? " @ $N " : " " ) . ( $m != " " ? " - $m " : " " )) . " </a><br> \n " ;}}}}} else { if ( $_GET [ " ns " ] !== " " &&! $ue && DB != " " ){ $h -> select_db ( DB ); $S = table_status ( '' , true );} if ( support ( " sql " )){ echo '<script type="text/javascript" src="' , h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME )) . " ?file=jush.js&version=4.2.1 " , ' " ></script>
2014-04-01 18:00:42 +00:00
< script type = " text/javascript " >
2015-04-01 06:36:56 +00:00
' ; if ( $S ){ $Zd = array (); foreach ( $S
as $Q => $U ) $Zd [] = preg_quote ( $Q , '/' ); echo " var jushLinks = { $w : [ ' " . js_escape ( ME ) . ( support ( " table " ) ? " table= " : " select= " ) . " \$ &', / \\ b( " . implode ( " | " , $Zd ) . " ) \\ b/g ] }; \n " ; foreach ( array ( " bac " , " bra " , " sqlite_quo " , " mssql_bra " ) as $X ) echo " jushLinks. $X = jushLinks. $w ; \n " ;} echo 'bodyLoad(\'' ,( is_object ( $h ) ? substr ( $h -> server_info , 0 , 3 ) : " " ), ' \ ' );
2014-04-01 18:00:42 +00:00
</ script >
2015-04-01 06:36:56 +00:00
';}$this->databasesPrint($ue);if(DB==""||!$ue){echo"<p class=' links '>".(support("sql")?"<a href=' " .h(ME). " sql = '".bold(isset($_GET["sql"])&&!isset($_GET["import"])).">".lang(55)."</a>\n<a href=' " .h(ME). " import = '".bold(isset($_GET["import"])).">".lang(64)."</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(65)."</a>\n";}if($_GET["ns"]!==""&&!$ue&&DB!=""){echo' < a href = " '.h(ME).'create= " '.bold($_GET["create"]==="").">".lang(66)."</a>\n";if(!$S)echo"<p class=' message ' > " .lang(9). " \n " ;else $this->tablesPrint ( $S );}}}function
databasesPrint ( $ue ){ global $b , $h ; $l = $this -> databases (); echo ' < form action = " " >
2014-04-01 18:00:42 +00:00
< p id = " dbs " >
2015-04-01 06:36:56 +00:00
';hidden_fields_get();$Hb=" onmousedown=' dbMouseDown ( event , this ); ' onchange=' dbChange ( this ); '";echo"<span title=' " .lang(67). " '>DB</span>: ".($l?"<select name=' db '$Hb>".optionlist(array(""=>"")+$l,DB)."</select>":' < input name = " db " value = " '.h(DB).' " autocapitalize = " off " > '),"<input type=' submit ' value=' " .lang(20). " '".($l?" class=' hidden '":"").">\n";if($ue!="db"&&DB!=""&&$h->select_db(DB)){if(support("scheme")){echo"<br>".lang(68).": <select name=' ns '$Hb>".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
2014-04-01 18:00:42 +00:00
tablesPrint ( $S ){ echo " <p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'> \n " ; foreach ( $S
2015-04-01 06:36:56 +00:00
as $Q => $Ig ){ echo '<a href="' . h ( ME ) . 'select=' . urlencode ( $Q ) . '"' . bold ( $_GET [ " select " ] == $Q || $_GET [ " edit " ] == $Q , " select " ) . " > " . lang ( 69 ) . " </a> " ; $C = $this -> tableName ( $Ig ); echo ( support ( " table " ) || support ( " indexes " ) ? '<a href="' . h ( ME ) . 'table=' . urlencode ( $Q ) . '"' . bold ( in_array ( $Q , array ( $_GET [ " table " ], $_GET [ " create " ], $_GET [ " indexes " ], $_GET [ " foreign " ], $_GET [ " trigger " ])),( is_view ( $Ig ) ? " view " : " " ), " structure " ) . " title=' " . lang ( 39 ) . " '> $C </a> " : " <span> $C </span> " ) . " <br> \n " ;}}} $b = ( function_exists ( 'adminer_object' ) ? adminer_object () : new
Adminer ); if ( $b -> operators === null ) $b -> operators = $Se ; function
page_header ( $lh , $n = " " , $Wa = array (), $mh = " " ){ global $ca , $ia , $b , $Xb , $w ; page_headers (); if ( is_ajax () && $n ){ page_messages ( $n ); exit ;} $nh = $lh . ( $mh != " " ? " : $mh " : " " ); $oh = strip_tags ( $nh . ( SERVER != " " && SERVER != " localhost " ? h ( " - " . SERVER ) : " " ) . " - " . $b -> name ()); echo ' <! DOCTYPE html >
< html lang = " ', $ca ,' " dir = " ',lang(70),' " >
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 " >
< title > ',$oh,' </ title >
< link rel = " stylesheet " type = " text/css " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = default . css & amp ; version = 4.2 . 1 " ,' " >
< script type = " text/javascript " src = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = functions . js & amp ; version = 4.2 . 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.2 . 1 " ,' " >
< link rel = " apple-touch-icon " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = favicon . ico & amp ; version = 4.2 . 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'
2015-04-01 06:36:56 +00:00
< body class = " ',lang(70),' 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
js_escape ( lang ( 71 )), ' \ ' ;
2014-04-01 18:00:42 +00:00
</ script >
< div id = " help " class = " jush-', $w ,' jsonly hidden " onmouseover = " helpOpen = 1; " onmouseout = " helpMouseout(this, event); " ></ div >
< div id = " content " >
2015-04-01 06:36:56 +00:00
';if($Wa!==null){$_=substr(preg_replace(' ~ \b ( username | db | ns ) = [ ^& ] *&~ ',' ',ME),0,-1);echo' < p id = " breadcrumb " >< a href = " '.h( $_ ? $_ : " . " ).' " > '.$Xb[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 $x => $X ){ $Ob = ( is_array ( $X ) ? $X [ 1 ] : h ( $X )); if ( $Ob != " " ) echo " <a href=' " . h ( ME . " $x = " ) . urlencode ( is_array ( $X ) ? $X [ 0 ] : $X ) . " '> $Ob </a> » " ;}} echo " $lh\n " ;}} echo " <h2> $nh </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
2014-04-01 18:00:42 +00:00
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
2015-04-01 06:36:56 +00:00
page_messages ( $n ){ $Kh = preg_replace ( '~^[^?]*~' , '' , $_SERVER [ " REQUEST_URI " ]); $qe = $_SESSION [ " messages " ][ $Kh ]; if ( $qe ){ echo " <div class='message'> " . implode ( " </div> \n <div class='message'> " , $qe ) . " </div> \n " ; unset ( $_SESSION [ " messages " ][ $Kh ]);} if ( $n ) echo " <div class='error'> $n </div> \n " ;} function
page_footer ( $ue = " " ){ global $b , $T ; echo ' </ div >
2014-04-01 18:00:42 +00:00
2015-04-01 06:36:56 +00:00
';switch_lang();if($ue!="auth"){echo' < form action = " " method = " post " >
2014-04-01 18:00:42 +00:00
< p class = " logout " >
2015-04-01 06:36:56 +00:00
< input type = " submit " name = " logout " value = " ',lang(72),' " id = " logout " >
2014-04-01 18:00:42 +00:00
< input type = " hidden " name = " token " value = " ', $T ,' " >
</ p >
</ form >
';}echo' < div id = " menu " >
2015-04-01 06:36:56 +00:00
';$b->navigation($ue);echo' </ div >
2014-04-01 18:00:42 +00:00
< script type = " text/javascript " > setupSubmitHighlight ( document ); </ script >
' ;} function
2015-04-01 06:36:56 +00:00
int32 ( $xe ){ while ( $xe >= 2147483648 ) $xe -= 4294967296 ; while ( $xe <=- 2147483649 ) $xe += 4294967296 ; return ( int ) $xe ;} function
long2str ( $W , $ai ){ $mg = '' ; foreach ( $W
as $X ) $mg .= pack ( 'V' , $X ); if ( $ai ) return
substr ( $mg , 0 , end ( $W )); return $mg ;} function
str2long ( $mg , $ai ){ $W = array_values ( unpack ( 'V*' , str_pad ( $mg , 4 * ceil ( strlen ( $mg ) / 4 ), " \0 " ))); if ( $ai ) $W [] = strlen ( $mg ); return $W ;} function
xxtea_mx ( $gi , $fi , $Pg , $Gd ){ return
int32 ((( $gi >> 5 & 0x7FFFFFF ) ^ $fi << 2 ) + (( $fi >> 3 & 0x1FFFFFFF ) ^ $gi << 4 )) ^ int32 (( $Pg ^ $fi ) + ( $Gd ^ $gi ));} function
encrypt_string ( $Kg , $x ){ if ( $Kg == " " ) return " " ; $x = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $x )))); $W = str2long ( $Kg , true ); $xe = count ( $W ) - 1 ; $gi = $W [ $xe ]; $fi = $W [ 0 ]; $Lf = floor ( 6 + 52 / ( $xe + 1 )); $Pg = 0 ; while ( $Lf --> 0 ){ $Pg = int32 ( $Pg + 0x9E3779B9 ); $ec = $Pg >> 2 & 3 ; for ( $if = 0 ; $if < $xe ; $if ++ ){ $fi = $W [ $if + 1 ]; $we = xxtea_mx ( $gi , $fi , $Pg , $x [ $if & 3 ^ $ec ]); $gi = int32 ( $W [ $if ] + $we ); $W [ $if ] = $gi ;} $fi = $W [ 0 ]; $we = xxtea_mx ( $gi , $fi , $Pg , $x [ $if & 3 ^ $ec ]); $gi = int32 ( $W [ $xe ] + $we ); $W [ $xe ] = $gi ;} return
2014-04-01 18:00:42 +00:00
long2str ( $W , false );} function
2015-04-01 06:36:56 +00:00
decrypt_string ( $Kg , $x ){ if ( $Kg == " " ) return " " ; if ( ! $x ) return
false ; $x = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $x )))); $W = str2long ( $Kg , false ); $xe = count ( $W ) - 1 ; $gi = $W [ $xe ]; $fi = $W [ 0 ]; $Lf = floor ( 6 + 52 / ( $xe + 1 )); $Pg = int32 ( $Lf * 0x9E3779B9 ); while ( $Pg ){ $ec = $Pg >> 2 & 3 ; for ( $if = $xe ; $if > 0 ; $if -- ){ $gi = $W [ $if - 1 ]; $we = xxtea_mx ( $gi , $fi , $Pg , $x [ $if & 3 ^ $ec ]); $fi = int32 ( $W [ $if ] - $we ); $W [ $if ] = $fi ;} $gi = $W [ $xe ]; $we = xxtea_mx ( $gi , $fi , $Pg , $x [ $if & 3 ^ $ec ]); $fi = int32 ( $W [ 0 ] - $we ); $W [ 0 ] = $fi ; $Pg = int32 ( $Pg - 0x9E3779B9 );} return
long2str ( $W , true );} $h = '' ; $dd = $_SESSION [ " token " ]; if ( ! $dd ) $_SESSION [ " token " ] = rand ( 1 , 1e6 ); $T = get_token (); $uf = array (); if ( $_COOKIE [ " adminer_permanent " ]){ foreach ( explode ( " " , $_COOKIE [ " adminer_permanent " ]) as $X ){ list ( $x ) = explode ( " : " , $X ); $uf [ $x ] = $X ;}} function
add_invalid_login (){ global $b ; $Ic = get_temp_dir () . " /adminer.invalid " ; $Sc =@ fopen ( $Ic , " r+ " ); if ( ! $Sc ){ $Sc =@ fopen ( $Ic , " w " ); if ( ! $Sc ) return ;} flock ( $Sc , LOCK_EX ); $zd = unserialize ( stream_get_contents ( $Sc )); $ih = time (); if ( $zd ){ foreach ( $zd
as $_d => $X ){ if ( $X [ 0 ] < $ih ) unset ( $zd [ $_d ]);}} $yd =& $zd [ $b -> bruteForceKey ()]; if ( ! $yd ) $yd = array ( $ih + 30 * 60 , 0 ); $yd [ 1 ] ++ ; $xg = serialize ( $zd ); rewind ( $Sc ); fwrite ( $Sc , $xg ); ftruncate ( $Sc , strlen ( $xg )); flock ( $Sc , LOCK_UN ); fclose ( $Sc );} $Ka = $_POST [ " auth " ]; if ( $Ka ){ $zd = unserialize ( @ file_get_contents ( get_temp_dir () . " /adminer.invalid " )); $yd = $zd [ $b -> bruteForceKey ()]; $Ce = ( $yd [ 1 ] > 30 ? $yd [ 0 ] - time () : 0 ); if ( $Ce > 0 ) auth_error ( lang ( 73 , ceil ( $Ce / 60 ))); session_regenerate_id (); $Vh = $Ka [ " driver " ]; $N = $Ka [ " server " ]; $V = $Ka [ " username " ]; $G = ( string ) $Ka [ " password " ]; $m = $Ka [ " db " ]; set_password ( $Vh , $N , $V , $G ); $_SESSION [ " db " ][ $Vh ][ $N ][ $V ][ $m ] = true ; if ( $Ka [ " permanent " ]){ $x = base64_encode ( $Vh ) . " - " . base64_encode ( $N ) . " - " . base64_encode ( $V ) . " - " . base64_encode ( $m ); $Ff = $b -> permanentLogin ( true ); $uf [ $x ] = " $x : " . base64_encode ( $Ff ? encrypt_string ( $G , $Ff ) : " " ); cookie ( " adminer_permanent " , implode ( " " , $uf ));} if ( count ( $_POST ) == 1 || DRIVER != $Vh || SERVER != $N || $_GET [ " username " ] !== $V || DB != $m ) redirect ( auth_url ( $Vh , $N , $V , $m ));} elseif ( $_POST [ " logout " ]){ if ( $dd &&! verify_token ()){ page_header ( lang ( 72 ), lang ( 74 )); page_footer ( " db " ); exit ;} else { foreach ( array ( " pwds " , " db " , " dbs " , " queries " ) as $x ) set_session ( $x , null ); unset_permanent (); redirect ( substr ( preg_replace ( '~\b(username|db|ns)=[^&]*&~' , '' , ME ), 0 , - 1 ), lang ( 75 ));}} elseif ( $uf &&! $_SESSION [ " pwds " ]){ session_regenerate_id (); $Ff = $b -> permanentLogin (); foreach ( $uf
as $x => $X ){ list (, $hb ) = explode ( " : " , $X ); list ( $Vh , $N , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $x )); set_password ( $Vh , $N , $V , decrypt_string ( base64_decode ( $hb ), $Ff )); $_SESSION [ " db " ][ $Vh ][ $N ][ $V ][ $m ] = true ;}} function
unset_permanent (){ global $uf ; foreach ( $uf
as $x => $X ){ list ( $Vh , $N , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $x )); if ( $Vh == DRIVER && $N == SERVER && $V == $_GET [ " username " ] && $m == DB ) unset ( $uf [ $x ]);} cookie ( " adminer_permanent " , implode ( " " , $uf ));} function
auth_error ( $n ){ global $b , $dd ; $n = h ( $n ); $_g = session_name (); if ( isset ( $_GET [ " username " ])){ header ( " HTTP/1.1 403 Forbidden " ); if (( $_COOKIE [ $_g ] || $_GET [ $_g ]) &&! $dd ) $n = lang ( 76 ); else { add_invalid_login (); $G = get_password (); if ( $G !== null ){ if ( $G === false ) $n .= '<br>' . lang ( 77 , '<code>permanentLogin()</code>' ); set_password ( DRIVER , SERVER , $_GET [ " username " ], null );} unset_permanent ();}} if ( ! $_COOKIE [ $_g ] && $_GET [ $_g ] && ini_bool ( " session.use_only_cookies " )) $n = lang ( 78 ); $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 ( 79 ), lang ( 80 , implode ( " , " , $_f )), false ); page_footer ( " auth " ); exit ;} $h = connect ();} $Wb = new
Min_Driver ( $h ); if ( ! is_object ( $h ) ||! $b -> login ( $_GET [ " username " ], get_password ())) auth_error (( is_string ( $h ) ? $h : lang ( 81 ))); if ( $Ka && $_POST [ " token " ]) $_POST [ " token " ] = $T ; $n = '' ; if ( $_POST ){ if ( ! verify_token ()){ $td = " max_input_vars " ; $ke = ini_get ( $td ); if ( extension_loaded ( " suhosin " )){ foreach ( array ( " suhosin.request.max_vars " , " suhosin.post.max_vars " ) as $x ){ $X = ini_get ( $x ); if ( $X && ( ! $ke || $X < $ke )){ $td = $x ; $ke = $X ;}}} $n = ( ! $_POST [ " token " ] && $ke ? lang ( 82 , " ' $td ' " ) : lang ( 74 ) . ' ' . lang ( 83 ));}} elseif ( $_SERVER [ " REQUEST_METHOD " ] == " POST " ){ $n = lang ( 84 , " 'post_max_size' " ); if ( isset ( $_GET [ " sql " ])) $n .= ' ' . lang ( 85 );} if ( ! ini_bool ( " session.use_cookies " ) ||@ ini_set ( " session.use_cookies " , false ) !== false ) session_write_close (); function
select ( $I , $i = null , $af = array (), $z = 0 ){ global $w ; $Zd = array (); $v = array (); $f = array (); $Ta = array (); $Bh = 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 ( $Fd = 0 ; $Fd < count ( $K ); $Fd ++ ){ $o = $I -> fetch_field (); $C = $o -> name ; $Ze = $o -> orgtable ; $Ye = $o -> orgname ; $J [ $o -> table ] = $Ze ; if ( $af && $w == " sql " ) $Zd [ $Fd ] = ( $C == " table " ? " table= " : ( $C == " possible_keys " ? " indexes= " : null )); elseif ( $Ze != " " ){ if ( ! isset ( $v [ $Ze ])){ $v [ $Ze ] = array (); foreach ( indexes ( $Ze , $i ) as $u ){ if ( $u [ " type " ] == " PRIMARY " ){ $v [ $Ze ] = array_flip ( $u [ " columns " ]); break ;}} $f [ $Ze ] = $v [ $Ze ];} if ( isset ( $f [ $Ze ][ $Ye ])){ unset ( $f [ $Ze ][ $Ye ]); $v [ $Ze ][ $Ye ] = $Fd ; $Zd [ $Fd ] = $Ze ;}} if ( $o -> charsetnr == 63 ) $Ta [ $Fd ] = true ; $Bh [ $Fd ] = $o -> type ; echo " <th " . ( $Ze != " " || $o -> name != $Ye ? " title=' " . h (( $Ze != " " ? " $Ze . " : " " ) . $Ye ) . " ' " : " " ) . " > " . h ( $C ) . ( $af ? doc_link ( array ( 'sql' => " explain-output.html#explain_ " . strtolower ( $C ))) : " " );} echo " </thead> \n " ;} echo " <tr " . odd () . " > " ; foreach ( $K
as $x => $X ){ if ( $X === null ) $X = " <i>NULL</i> " ; elseif ( $Ta [ $x ] &&! is_utf8 ( $X )) $X = " <i> " . lang ( 43 , strlen ( $X )) . " </i> " ; elseif ( ! strlen ( $X )) $X = " " ; else { $X = h ( $X ); if ( $Bh [ $x ] == 254 ) $X = " <code> $X </code> " ;} if ( isset ( $Zd [ $x ]) &&! $f [ $Zd [ $x ]]){ if ( $af && $w == " sql " ){ $Q = $K [ array_search ( " table= " , $Zd )]; $_ = $Zd [ $x ] . urlencode ( $af [ $Q ] != " " ? $af [ $Q ] : $Q );} else { $_ = " edit= " . urlencode ( $Zd [ $x ]); foreach ( $v [ $Zd [ $x ]] as $lb => $Fd ) $_ .= " &where " . urlencode ( " [ " . bracket_escape ( $lb ) . " ] " ) . " = " . urlencode ( $K [ $Fd ]);} $X = " <a href=' " . h ( ME . $_ ) . " '> $X </a> " ;} echo " <td> $X " ;}} echo ( $s ? " </table> " : " <p class='message'> " . lang ( 12 )) . " \n " ; return $J ;} function
referencable_primary ( $ug ){ $J = array (); foreach ( table_status ( '' , true ) as $Tg => $Q ){ if ( $Tg != $ug && fk_support ( $Q )){ foreach ( fields ( $Tg ) as $o ){ if ( $o [ " primary " ]){ if ( $J [ $Tg ]){ unset ( $J [ $Tg ]); break ;} $J [ $Tg ] = $o ;}}}} return $J ;} function
textarea ( $C , $Y , $L = 10 , $ob = 80 ){ global $w ; echo " <textarea name=' $C ' rows=' $L ' cols=' $ob ' class='sqlarea jush- $w ' 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
2015-04-01 06:36:56 +00:00
edit_type ( $x , $o , $nb , $Oc = array ()){ global $Lg , $Bh , $Ih , $Ne ; $U = $o [ " type " ]; echo '<td><select name="' , $x , '[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"' , on_help ( " getTarget(event).value " , 1 ), '>' ; if ( $U &&! isset ( $Bh [ $U ]) &&! isset ( $Oc [ $U ])) array_unshift ( $Lg , $U ); if ( $Oc ) $Lg [ lang ( 86 )] = $Oc ; echo
optionlist ( $Lg , $U ), ' </ select >
< td >< input name = " ', $x ,'[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(); " >< td class = " options " > ';echo"<select name=' $x " . " [ collation ] '".(preg_match(' ~ ( char | text | enum | set ) $ ~ ',$U)?"":" class=' hidden '").' >< option value = " " > ( '.lang(87).' ) '.optionlist($nb,$o["collation"]).' </ select > ',($Ih?"<select name=' $x " . " [ unsigned ] '".(!$U||preg_match(' ~ (( ^| [ ^ o ]) int | float | double | decimal ) $ ~ ',$U)?"":" class=' hidden '").' >< option > '.optionlist($Ih,$o["unsigned"]).' </ select > ':' '),(isset($o[' on_update '])?"<select name=' $x " . " [ on_update ] '".(preg_match(' ~ timestamp | datetime ~ ',$U)?"":" class=' hidden '").' > '.optionlist(array(""=>"(".lang(88).")","CURRENT_TIMESTAMP"),$o["on_update"]).' </ select > ':' '),($Oc?"<select name=' $x " . " [ on_delete ] '".(preg_match("~`~",$U)?"":" class=' hidden '")."><option value=' ' > ( " .lang(89). " ) " .optionlist(explode( " | " , $Ne ), $o["on_delete"] ). " </ select > " : " " );}function
process_length ( $y ){ global $pc ; return ( preg_match ( " ~^ \\ s* \\ (? \\ s* $pc (?: \\ s*, \\ s* $pc )*+ \\ s* \\ )? \\ s* \$ ~ " , $y ) && preg_match_all ( " ~ $pc ~ " , $y , $ee ) ? " ( " . implode ( " , " , $ee [ 0 ]) . " ) " : preg_replace ( '~^[0-9].*~' , '(\0)' , preg_replace ( '~[^-0-9,+()[\]]~' , '' , $y )));} function
process_type ( $o , $mb = " COLLATE " ){ global $Ih ; return " $o[type] " . process_length ( $o [ " length " ]) . ( preg_match ( '~(^|[^o])int|float|double|decimal~' , $o [ " type " ]) && in_array ( $o [ " unsigned " ], $Ih ) ? " $o[unsigned] " : " " ) . ( preg_match ( '~char|text|enum|set~' , $o [ " type " ]) && $o [ " collation " ] ? " $mb " . q ( $o [ " collation " ]) : " " );} function
process_field ( $o , $_h ){ global $w ; $Lb = $o [ " default " ]; return
array ( idf_escape ( trim ( $o [ " field " ])), process_type ( $_h ),( $o [ " null " ] ? " NULL " : " NOT NULL " ),( isset ( $Lb ) ? " DEFAULT " . (( preg_match ( '~time~' , $o [ " type " ]) && preg_match ( '~^CURRENT_TIMESTAMP$~i' , $Lb )) || ( $w == " sqlite " && preg_match ( '~^CURRENT_(TIME|TIMESTAMP|DATE)$~i' , $Lb )) || ( $o [ " type " ] == " bit " && preg_match ( " ~^([0-9]+|b'[0-1]+') \$ ~ " , $Lb )) || ( $w == " pgsql " && preg_match ( " ~^[a-z]+ \\ (('[^']*')+ \\ ) \$ ~ " , $Lb )) ? $Lb : q ( $Lb )) : " " ),( 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
2014-04-01 18:00:42 +00:00
type_class ( $U ){ foreach ( array ( 'char' => 'text' , 'date' => 'time|year' , 'binary' => 'blob' , 'enum' => 'set' ,) as $x => $X ){ if ( preg_match ( " ~ $x | $X ~ " , $U )) return " class=' $x ' " ;}} function
2015-04-01 06:36:56 +00:00
edit_fields ( $p , $nb , $U = " TABLE " , $Oc = array (), $sb = false ){ global $h , $ud ; echo ' < thead >< tr class = " wrap " >
';if($U=="PROCEDURE"){echo' < td >& nbsp ; ';}echo' < th > ',($U=="TABLE"?lang(90):lang(91)),' < td > ',lang(92),' < textarea id = " enum-edit " rows = " 4 " cols = " 12 " wrap = " off " style = " display: none; " onblur = " editingLengthBlur(this); " ></ textarea >
< td > ',lang(93),' < td > ',lang(94);if($U=="TABLE"){echo' < td > NULL
< td >< input type = " radio " name = " auto_increment_col " value = " " >< acronym title = " ',lang(56),' " > AI </ acronym > ',doc_link(array(' sql '=>"example-auto-increment.html",' sqlite '=>"autoinc.html",' pgsql '=>"datatype.html#DATATYPE-SERIAL",' mssql '=>"ms186775.aspx",)),' < td > ',lang(95),(support("comment")?"<td".($sb?"":" class=' hidden '").">".lang(96):"");}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.2 . 1 ' alt=' + ' title=' " .lang(97). " '>",' < 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
as $s => $o ){ $s ++ ; $bf = $o [( $_POST ? " orig " : " field " )]; $Sb = ( isset ( $_POST [ " add " ][ $s - 1 ]) || ( isset ( $o [ " field " ]) &&! $_POST [ " drop_col " ][ $s ])) && ( support ( " drop_col " ) || $bf == " " ); echo '<tr' ,( $Sb ? " " : " style='display: none;' " ), ' >
',($U=="PROCEDURE"?"<td>".html_select("fields[$s][inout]",explode("|",$ud),$o["inout"]):""),' < th > ';if($Sb){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 " > ';}echo' < input type = " hidden " name = " fields[', $s ,'][orig] " value = " ',h( $bf ),' " >
';edit_type("fields[$s]",$o,$nb,$Oc);if($U=="TABLE"){echo' < td > ',checkbox("fields[$s][null]",1,$o["null"],"","","block"),' < 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 (); } " ></label><td><?php
2014-04-01 18:00:42 +00:00
echo
2015-04-01 06:36:56 +00:00
checkbox ( " fields[ $s ][has_default] " , 1 , $o [ " has_default " ]), '<input name="fields[' , $s , '][default]" value="' , h ( $o [ " default " ]), ' " onkeyup= " keyupChange . call ( this ); " onchange= " this . previousSibling . checked = true ; " >
',(support("comment")?"<td".($sb?"":" class=' hidden '")."><input name=' fields [ $s ][ comment ] ' value=' " .h( $o["comment"] ). " ' maxlength=' " .( $h->server_info >=5.5?1024:255). " '>":"");}echo"<td>",(support("move_col")?"<input type=' image ' class=' icon ' name=' add [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = plus . gif & amp ; version = 4.2 . 1 ' alt=' + ' title=' " .lang(97). " ' onclick=' return ! editingAddRow ( this , 1 ); '> "."<input type=' image ' class=' icon ' name=' up [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = up . gif & amp ; version = 4.2 . 1 ' alt=' ^ ' title=' " .lang(98). " '> "."<input type=' image ' class=' icon ' name=' down [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = down . gif & amp ; version = 4.2 . 1 ' alt=' v ' title=' " .lang(99). " '> ":""),($bf==""||support("drop_col")?"<input type=' image ' class=' icon ' name=' drop_col [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = cross . gif & amp ; version = 4.2 . 1 ' alt=' x ' title=' " .lang(100). " ' onclick=\"return !editingRemoveRow(this, ' fields\ $ 1 [ field ] ' ); \ " > " : " " ), " \n " ;}} function
process_fields ( & $p ){ ksort ( $p ); $D = 0 ; if ( $_POST [ " up " ]){ $Qd = 0 ; foreach ( $p
as $x => $o ){ if ( key ( $_POST [ " up " ]) == $x ){ unset ( $p [ $x ]); array_splice ( $p , $Qd , 0 , array ( $o )); break ;} if ( isset ( $o [ " field " ])) $Qd = $D ; $D ++ ;}} elseif ( $_POST [ " down " ]){ $Qc = false ; foreach ( $p
as $x => $o ){ if ( isset ( $o [ " field " ]) && $Qc ){ unset ( $p [ key ( $_POST [ " down " ])]); array_splice ( $p , $D , 0 , array ( $Qc )); break ;} if ( key ( $_POST [ " down " ]) == $x ) $Qc = $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
2015-04-01 06:36:56 +00:00
grant ( $Vc , $Hf , $f , $Me ){ if ( ! $Hf ) return
true ; if ( $Hf == array ( " ALL PRIVILEGES " , " GRANT OPTION " )) return ( $Vc == " GRANT " ? queries ( " $Vc ALL PRIVILEGES $Me WITH GRANT OPTION " ) : queries ( " $Vc ALL PRIVILEGES $Me " ) && queries ( " $Vc GRANT OPTION $Me " )); return
queries ( " $Vc " . preg_replace ( '~(GRANT OPTION)\\([^)]*\\)~' , '\\1' , implode ( " $f , " , $Hf ) . $f ) . $Me );} function
drop_create ( $Yb , $j , $Zb , $fh , $bc , $A , $pe , $ne , $oe , $Je , $_e ){ if ( $_POST [ " drop " ]) query_redirect ( $Yb , $A , $pe ); elseif ( $Je == " " ) query_redirect ( $j , $A , $oe ); elseif ( $Je != $_e ){ $Cb = queries ( $j ); queries_redirect ( $A , $ne , $Cb && queries ( $Yb )); if ( $Cb ) queries ( $Zb );} else
queries_redirect ( $A , $ne , queries ( $fh ) && queries ( $bc ) && queries ( $Yb ) && queries ( $j ));} function
create_trigger ( $Me , $K ){ global $w ; $kh = " $K[Timing] $K[Event] " . ( $K [ " Event " ] == " UPDATE OF " ? " " . idf_escape ( $K [ " Of " ]) : " " ); return " CREATE TRIGGER " . idf_escape ( $K [ " Trigger " ]) . ( $w == " mssql " ? $Me . $kh : $kh . $Me ) . rtrim ( " $K[Type] \n $K[Statement] " , " ; " ) . " ; " ;} function
create_routine ( $ig , $K ){ global $ud ; $O = array (); $p = ( array ) $K [ " fields " ]; ksort ( $p ); foreach ( $p
as $o ){ if ( $o [ " field " ] != " " ) $O [] = ( preg_match ( " ~^( $ud ) \$ ~ " , $o [ " inout " ]) ? " $o[inout] " : " " ) . idf_escape ( $o [ " field " ]) . process_type ( $o , " CHARACTER SET " );} return " CREATE $ig " . 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
2015-04-01 06:36:56 +00:00
format_foreign_key ( $q ){ global $Ne ; return " FOREIGN KEY ( " . implode ( " , " , array_map ( 'idf_escape' , $q [ " source " ])) . " ) REFERENCES " . table ( $q [ " table " ]) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $q [ " target " ])) . " ) " . ( preg_match ( " ~^( $Ne ) \$ ~ " , $q [ " on_delete " ]) ? " ON DELETE $q[on_delete] " : " " ) . ( preg_match ( " ~^( $Ne ) \$ ~ " , $q [ " on_update " ]) ? " ON UPDATE $q[on_update] " : " " );} function
tar_file ( $Ic , $ph ){ $J = pack ( " a100a8a8a8a12a12 " , $Ic , 644 , 0 , 0 , decoct ( $ph -> 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 )); $ph -> send (); echo
str_repeat ( " \0 " , 511 - ( $ph -> size + 511 ) % 512 );} function
ini_bytes ( $td ){ $X = ini_get ( $td ); switch ( strtolower ( substr ( $X , - 1 ))){ case 'g' : $X *= 1024 ; case 'm' : $X *= 1024 ; case 'k' : $X *= 1024 ;} return $X ;} function
doc_link ( $sf ){ global $w , $h ; $Mh = array ( 'sql' => " http://dev.mysql.com/doc/refman/ " . substr ( $h -> server_info , 0 , 3 ) . " /en/ " , 'sqlite' => " http://www.sqlite.org/ " , 'pgsql' => " http://www.postgresql.org/docs/ " . substr ( $h -> server_info , 0 , 3 ) . " /static/ " , 'mssql' => " http://msdn.microsoft.com/library/ " , 'oracle' => " http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/ " ,); return ( $sf [ $w ] ? " <a href=' $Mh[$w] $sf[$w] ' target='_blank' rel='noreferrer'><sup>?</sup></a> " : " " );} function
ob_gzencode ( $P ){ return
gzencode ( $P );} function
db_size ( $m ){ global $h ; if ( ! $h -> select_db ( $m )) return " ? " ; $J = 0 ; foreach ( table_status () as $R ) $J += $R [ " Data_length " ] + $R [ " Index_length " ]; return
format_number ( $J );} function
set_utf8mb4 ( $j ){ global $h ; static $O = false ; if ( ! $O && preg_match ( '~\butf8mb4~i' , $j )){ $O = true ; echo " SET NAMES " . charset ( $h ) . " ; \n \n " ;}} function
connect_error (){ global $b , $h , $T , $n , $Xb ; if ( DB != " " ){ header ( " HTTP/1.1 404 Not Found " ); page_header ( lang ( 35 ) . " : " . h ( DB ), lang ( 101 ), true );} else { if ( $_POST [ " db " ] &&! $n ) queries_redirect ( substr ( ME , 0 , - 1 ), lang ( 102 ), drop_databases ( $_POST [ " db " ])); page_header ( lang ( 103 ), $n , false ); echo " <p class='links'> \n " ; foreach ( array ( 'database' => lang ( 104 ), 'privileges' => lang ( 63 ), 'processlist' => lang ( 105 ), 'variables' => lang ( 106 ), 'status' => lang ( 107 ),) as $x => $X ){ if ( support ( $x )) echo " <a href=' " . h ( ME ) . " $x ='> $X </a> \n " ;} echo " <p> " . lang ( 108 , $Xb [ DRIVER ], " <b> " . h ( $h -> server_info ) . " </b> " , " <b> $h->extension </b> " ) . " \n " , " <p> " . lang ( 109 , " <b> " . h ( logged_user ()) . " </b> " ) . " \n " ; $l = $b -> databases (); if ( $l ){ $pg = support ( " scheme " ); $nb = 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 ( 110 ) . " </a> " . " <td> " . lang ( 111 ) . " <td> " . lang ( 112 ) . " <td> " . lang ( 113 ) . " - <a href=' " . h ( ME ) . " dbsize=1' onclick= \" return !ajaxSetHtml(' " . js_escape ( ME ) . " script=connect'); \" > " . lang ( 114 ) . " </a> " . " </thead> \n " ; $l = ( $_GET [ " dbsize " ] ? count_tables ( $l ) : array_flip ( $l )); foreach ( $l
as $m => $S ){ $hg = h ( ME ) . " db= " . urlencode ( $m ); echo " <tr " . odd () . " > " . ( support ( " database " ) ? " <td> " . checkbox ( " db[] " , $m , in_array ( $m ,( array ) $_POST [ " db " ])) : " " ), " <th><a href=' $hg '> " . h ( $m ) . " </a> " ; $d = nbsp ( db_collation ( $m , $nb )); echo " <td> " . ( support ( " database " ) ? " <a href=' $hg " . ( $pg ? " &ns= " : " " ) . " &database=' title=' " . lang ( 59 ) . " '> $d </a> " : $d ), " <td align='right'><a href=' $hg &schema=' id='tables- " . h ( $m ) . " ' title=' " . lang ( 62 ) . " '> " . ( $_GET [ " dbsize " ] ? $S : " ? " ) . " </a> " , " <td align='right' id='size- " . h ( $m ) . " '> " . ( $_GET [ " dbsize " ] ? db_size ( $m ) : " ? " ), " \n " ;} echo " </table> \n " ,( support ( " database " ) ? " <fieldset><legend> " . lang ( 115 ) . " <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 ( 116 ) . " ' " . confirm () . " > \n " . " </div></fieldset> \n " : " " ), " <script type='text/javascript'>tableCheck();</script> \n " , " <input type='hidden' name='token' value=' $T '> \n " , " </form> \n " ;}} page_footer ( " db " );} if ( isset ( $_GET [ " status " ])) $_GET [ " variables " ] = $_GET [ " status " ]; if ( isset ( $_GET [ " import " ])) $_GET [ " sql " ] = $_GET [ " import " ]; if ( ! ( DB != " " ? $h -> select_db ( DB ) : isset ( $_GET [ " sql " ]) || isset ( $_GET [ " dump " ]) || isset ( $_GET [ " database " ]) || isset ( $_GET [ " processlist " ]) || isset ( $_GET [ " privileges " ]) || isset ( $_GET [ " user " ]) || isset ( $_GET [ " variables " ]) || $_GET [ " script " ] == " connect " || $_GET [ " script " ] == " kill " )){ if ( DB != " " || $_GET [ " refresh " ]){ restart_session (); set_session ( " dbs " , null );} connect_error (); exit ;} if ( support ( " scheme " ) && DB != " " && $_GET [ " ns " ] !== " " ){ if ( ! isset ( $_GET [ " ns " ])) redirect ( preg_replace ( '~ns=[^&]*&~' , '' , ME ) . " ns= " . get_schema ()); if ( ! set_schema ( $_GET [ " ns " ])){ header ( " HTTP/1.1 404 Not Found " ); page_header ( lang ( 68 ) . " : " . h ( $_GET [ " ns " ]), lang ( 117 ), true ); page_footer ( " ns " ); exit ;}} $Ne = " RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT " ; class
2014-04-01 18:00:42 +00:00
TmpFile { var $handler ; var $size ; function
TmpFile (){ $this -> handler = tmpfile ();} function
2015-04-01 06:36:56 +00:00
write ( $xb ){ $this -> size += strlen ( $xb ); fwrite ( $this -> handler , $xb );} function
send (){ fseek ( $this -> handler , 0 ); fpassthru ( $this -> handler ); fclose ( $this -> handler );}} $pc = " '(?:''|[^' \\ \\ ]| \\ \\ .)*' " ; $ud = " 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 = $Wb -> 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 (); $R = table_status1 ( $a , true ); page_header (( $p && is_view ( $R ) ? lang ( 118 ) : lang ( 119 )) . " : " . h ( $a ), $n ); $b -> selectLinks ( $R ); $rb = $R [ " Comment " ]; if ( $rb != " " ) echo " <p> " . lang ( 96 ) . " : " . h ( $rb ) . " \n " ; if ( $p ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 120 ) . " <td> " . lang ( 92 ) . ( support ( " comment " ) ? " <td> " . lang ( 96 ) : " " ) . " </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 ( 56 ) . " </i> " : " " ),( isset ( $o [ " default " ]) ? " <span title=' " . lang ( 95 ) . " '>[<b> " . h ( $o [ " default " ]) . " </b>]</span> " : " " ),( support ( " comment " ) ? " <td> " . nbsp ( $o [ " comment " ]) : " " ), " \n " ;} echo " </table> \n " ;} if ( ! is_view ( $R )){ if ( support ( " indexes " )){ echo " <h3 id='indexes'> " . lang ( 121 ) . " </h3> \n " ; $v = indexes ( $a ); if ( $v ){ echo " <table cellspacing='0'> \n " ; foreach ( $v
as $C => $u ){ ksort ( $u [ " columns " ]); $Ef = array (); foreach ( $u [ " columns " ] as $x => $X ) $Ef [] = " <i> " . h ( $X ) . " </i> " . ( $u [ " lengths " ][ $x ] ? " ( " . $u [ " lengths " ][ $x ] . " ) " : " " ) . ( $u [ " descs " ][ $x ] ? " DESC " : " " ); echo " <tr title=' " . h ( $C ) . " '><th> $u[type] <td> " . implode ( " , " , $Ef ) . " \n " ;} echo " </table> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'indexes=' . urlencode ( $a ) . '">' . lang ( 122 ) . " </a> \n " ;} if ( fk_support ( $R )){ echo " <h3 id='foreign-keys'> " . lang ( 86 ) . " </h3> \n " ; $Oc = foreign_keys ( $a ); if ( $Oc ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 123 ) . " <td> " . lang ( 124 ) . " <td> " . lang ( 89 ) . " <td> " . lang ( 88 ) . " <td> </thead> \n " ; foreach ( $Oc
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 ( 125 ) . '</a>' ;} echo " </table> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'foreign=' . urlencode ( $a ) . '">' . lang ( 126 ) . " </a> \n " ;}} if ( support ( is_view ( $R ) ? " view_trigger " : " trigger " )){ echo " <h3 id='triggers'> " . lang ( 127 ) . " </h3> \n " ; $zh = triggers ( $a ); if ( $zh ){ echo " <table cellspacing='0'> \n " ; foreach ( $zh
as $x => $X ) echo " <tr valign='top'><td> " . h ( $X [ 0 ]) . " <td> " . h ( $X [ 1 ]) . " <th> " . h ( $x ) . " <td><a href=' " . h ( ME . 'trigger=' . urlencode ( $a ) . '&name=' . urlencode ( $x )) . " '> " . lang ( 125 ) . " </a> \n " ; echo " </table> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'trigger=' . urlencode ( $a ) . '">' . lang ( 128 ) . " </a> \n " ;}} elseif ( isset ( $_GET [ " schema " ])){ page_header ( lang ( 62 ), " " , array (), h ( DB . ( $_GET [ " ns " ] ? " . $_GET[ns] " : " " ))); $Vg = array (); $Wg = array (); $ea = ( $_GET [ " schema " ] ? $_GET [ " schema " ] : $_COOKIE [ " adminer_schema- " . str_replace ( " . " , " _ " , DB )]); preg_match_all ( '~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~' , $ea , $ee , PREG_SET_ORDER ); foreach ( $ee
as $s => $B ){ $Vg [ $B [ 1 ]] = array ( $B [ 2 ], $B [ 3 ]); $Wg [] = " \n \t ' " . js_escape ( $B [ 1 ]) . " ': [ $B[2] , $B[3] ] " ;} $rh = 0 ; $Qa =- 1 ; $og = array (); $Wf = array (); $Ud = array (); foreach ( table_status ( '' , true ) as $Q => $R ){ if ( is_view ( $R )) continue ; $xf = 0 ; $og [ $Q ][ " fields " ] = array (); foreach ( fields ( $Q ) as $C => $o ){ $xf += 1.25 ; $o [ " pos " ] = $xf ; $og [ $Q ][ " fields " ][ $C ] = $o ;} $og [ $Q ][ " pos " ] = ( $Vg [ $Q ] ? $Vg [ $Q ] : array ( $rh , 0 )); foreach ( $b -> foreignKeys ( $Q ) as $X ){ if ( ! $X [ " db " ]){ $Sd = $Qa ; if ( $Vg [ $Q ][ 1 ] || $Vg [ $X [ " table " ]][ 1 ]) $Sd = min ( floatval ( $Vg [ $Q ][ 1 ]), floatval ( $Vg [ $X [ " table " ]][ 1 ])) - 1 ; else $Qa -=. 1 ; while ( $Ud [( string ) $Sd ]) $Sd -=. 0001 ; $og [ $Q ][ " references " ][ $X [ " table " ]][( string ) $Sd ] = array ( $X [ " source " ], $X [ " target " ]); $Wf [ $X [ " table " ]][ $Q ][( string ) $Sd ] = $X [ " target " ]; $Ud [( string ) $Sd ] = true ;}} $rh = max ( $rh , $og [ $Q ][ " pos " ][ 0 ] + 2.5 + $xf );} echo '<div id="schema" style="height: ' , $rh , ' em ; " onselectstart= " return false ; " >
2014-04-01 18:00:42 +00:00
< script type = " text/javascript " >
2015-04-01 06:36:56 +00:00
var tablePos = { ',implode(",",$Wg)."\n",' };
var em = document . getElementById ( \ 'schema\').offsetHeight / ' , $rh , ' ;
2014-04-01 18:00:42 +00:00
document . onmousemove = schemaMousemove ;
document . onmouseup = function ( ev ) {
schemaMouseup ( ev , \ '' , js_escape ( DB ), ' \ ' );
};
</ script >
2015-04-01 06:36:56 +00:00
' ; foreach ( $og
as $C => $Q ){ echo " <div class='table' style='top: " . $Q [ " pos " ][ 0 ] . " em; left: " . $Q [ " pos " ][ 1 ] . " em;' onmousedown='schemaMousedown(this, event);'> " , '<a href="' . h ( ME ) . 'table=' . urlencode ( $C ) . '"><b>' . h ( $C ) . " </b></a> " ; foreach ( $Q [ " fields " ] as $o ){ $X = '<span' . type_class ( $o [ " type " ]) . ' title="' . h ( $o [ " full_type " ] . ( $o [ " null " ] ? " NULL " : '' )) . '">' . h ( $o [ " field " ]) . '</span>' ; echo " <br> " . ( $o [ " primary " ] ? " <i> $X </i> " : $X );} foreach (( array ) $Q [ " references " ] as $ch => $Xf ){ foreach ( $Xf
as $Sd => $Tf ){ $Td = $Sd - $Vg [ $C ][ 1 ]; $s = 0 ; foreach ( $Tf [ 0 ] as $Dg ) echo " \n <div class='references' title=' " . h ( $ch ) . " ' id='refs $Sd - " . ( $s ++ ) . " ' style='left: $Td " . " em; top: " . $Q [ " fields " ][ $Dg ][ " pos " ] . " em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: " . ( - $Td ) . " em;'></div></div> " ;}} foreach (( array ) $Wf [ $C ] as $ch => $Xf ){ foreach ( $Xf
as $Sd => $f ){ $Td = $Sd - $Vg [ $C ][ 1 ]; $s = 0 ; foreach ( $f
as $bh ) echo " \n <div class='references' title=' " . h ( $ch ) . " ' id='refd $Sd - " . ( $s ++ ) . " ' style='left: $Td " . " em; top: " . $Q [ " fields " ][ $bh ][ " pos " ] . " em; height: 1.25em; background: url( " . h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME )) . " ?file=arrow.gif) no-repeat right center;&version=4.2.1'><div style='height: .5em; border-bottom: 1px solid Gray; width: " . ( - $Td ) . " em;'></div></div> " ;}} echo " \n </div> \n " ;} foreach ( $og
as $C => $Q ){ foreach (( array ) $Q [ " references " ] as $ch => $Xf ){ foreach ( $Xf
as $Sd => $Tf ){ $te = $rh ; $ie =- 10 ; foreach ( $Tf [ 0 ] as $x => $Dg ){ $yf = $Q [ " pos " ][ 0 ] + $Q [ " fields " ][ $Dg ][ " pos " ]; $zf = $og [ $ch ][ " pos " ][ 0 ] + $og [ $ch ][ " fields " ][ $Tf [ 1 ][ $x ]][ " pos " ]; $te = min ( $te , $yf , $zf ); $ie = max ( $ie , $yf , $zf );} echo " <div class='references' id='refl $Sd ' style='left: $Sd " . " em; top: $te " . " em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: " . ( $ie - $te ) . " em;'></div></div> \n " ;}}} echo ' </ div >
< p class = " links " >< a href = " ',h(ME. " schema = " .urlencode( $ea )),' " id = " schema-link " > ',lang(129),' </ a >
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$n){$_b="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$x)$_b.="&$x=".urlencode($_POST[$x]);cookie("adminer_export",substr($_b,1));$S=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Ac=dump_headers((count($S)==1?key($S):DB),(DB==""||count($S)>1));$Bd=preg_match(' ~ sql ~ ' , $_POST [ " format " ]); if ( $Bd ){ echo " -- Adminer $ia " . $Xb [ DRIVER ] . " dump \n \n " ; if ( $w == " sql " ){ echo " SET NAMES utf8;
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' ;
" : " " ). "
2015-04-01 06:36:56 +00:00
" ; $h->query ( " SET time_zone = '+00:00' ; " );}} $Mg = $_POST["db_style"] ; $l =array(DB);if(DB== " " ) { $l = $_POST [ " databases " ]; if ( is_string ( $l )) $l = explode ( " \n " , rtrim ( str_replace ( " \r " , " " , $l ), " \n " )); } foreach((array) $l
as $m ){ $b -> dumpDatabase ( $m ); if ( $h -> select_db ( $m )){ if ( $Bd && preg_match ( '~CREATE~' , $Mg ) && ( $j = $h -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ))){ set_utf8mb4 ( $j ); if ( $Mg == " DROP+CREATE " ) echo " DROP DATABASE IF EXISTS " . idf_escape ( $m ) . " ; \n " ; echo " $j ; \n " ;} if ( $Bd ){ if ( $Mg ) echo
use_sql ( $m ) . " ; \n \n " ; $gf = " " ; if ( $_POST [ " routines " ]){ foreach ( array ( " FUNCTION " , " PROCEDURE " ) as $ig ){ foreach ( get_rows ( " SHOW $ig STATUS WHERE Db = " . q ( $m ), null , " -- " ) as $K ){ $j = remove_definer ( $h -> result ( " SHOW CREATE $ig " . idf_escape ( $K [ " Name " ]), 2 )); set_utf8mb4 ( $j ); $gf .= ( $Mg != 'DROP+CREATE' ? " DROP $ig IF EXISTS " . idf_escape ( $K [ " Name " ]) . " ;; \n " : " " ) . " $j ;; \n \n " ;}}} if ( $_POST [ " events " ]){ foreach ( get_rows ( " SHOW EVENTS " , null , " -- " ) as $K ){ $j = remove_definer ( $h -> result ( " SHOW CREATE EVENT " . idf_escape ( $K [ " Name " ]), 3 )); set_utf8mb4 ( $j ); $gf .= ( $Mg != 'DROP+CREATE' ? " DROP EVENT IF EXISTS " . idf_escape ( $K [ " Name " ]) . " ;; \n " : " " ) . " $j ;; \n \n " ;}} if ( $gf ) echo " DELIMITER ;; \n \n $gf " . " DELIMITER ; \n \n " ;} if ( $_POST [ " table_style " ] || $_POST [ " data_style " ]){ $Yh = array (); foreach ( table_status ( '' , true ) as $C => $R ){ $Q = ( DB == " " || in_array ( $C ,( array ) $_POST [ " tables " ])); $Eb = ( DB == " " || in_array ( $C ,( array ) $_POST [ " data " ])); if ( $Q || $Eb ){ if ( $Ac == " tar " ){ $ph = new
TmpFile ; ob_start ( array ( $ph , 'write' ), 1e5 );} $b -> dumpTable ( $C ,( $Q ? $_POST [ " table_style " ] : " " ),( is_view ( $R ) ? 2 : 0 )); if ( is_view ( $R )) $Yh [] = $C ; elseif ( $Eb ){ $p = fields ( $C ); $b -> dumpData ( $C , $_POST [ " data_style " ], " SELECT * " . convert_fields ( $p , $p ) . " FROM " . table ( $C ));} if ( $Bd && $_POST [ " triggers " ] && $Q && ( $zh = trigger_sql ( $C , $_POST [ " table_style " ]))) echo " \n DELIMITER ;; \n $zh\nDELIMITER ; \n " ; if ( $Ac == " tar " ){ ob_end_flush (); tar_file (( DB != " " ? " " : " $m / " ) . " $C .csv " , $ph );} elseif ( $Bd ) echo " \n " ;}} foreach ( $Yh
as $Xh ) $b -> dumpTable ( $Xh , $_POST [ " table_style " ], 1 ); if ( $Ac == " tar " ) echo
pack ( " x512 " );}}} if ( $Bd ) echo " -- " . $h -> result ( " SELECT NOW() " ) . " \n " ; exit ;} page_header ( lang ( 65 ), $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 " >
2015-04-01 06:36:56 +00:00
';$Ib=array(' ',' USE ',' DROP + CREATE ',' CREATE ');$Xg=array(' ',' DROP + CREATE ',' CREATE ');$Fb=array(' ',' TRUNCATE + INSERT ',' INSERT ');if($w=="sql")$Fb[]=' 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(130)."<td>".html_select("output",$b->dumpOutput(),$K["output"],0)."\n";echo"<tr><th>".lang(131)."<td>".html_select("format",$b->dumpFormat(),$K["format"],0)."\n";echo($w=="sqlite"?"":"<tr><th>".lang(35)."<td>".html_select(' db_style ',$Ib,$K["db_style"]).(support("routine")?checkbox("routines",1,$K["routines"],lang(132)):"").(support("event")?checkbox("events",1,$K["events"],lang(133)):"")),"<tr><th>".lang(112)."<td>".html_select(' table_style ',$Xg,$K["table_style"]).checkbox("auto_increment",1,$K["auto_increment"],lang(56)).(support("trigger")?checkbox("triggers",1,$K["triggers"],lang(127)):""),"<tr><th>".lang(134)."<td>".html_select(' data_style ',$Fb,$K["data_style"]),' </ table >
< p >< input type = " submit " value = " ',lang(65),' " >
2014-04-01 18:00:42 +00:00
< input type = " hidden " name = " token " value = " ', $T ,' " >
< table cellspacing = " 0 " >
2015-04-01 06:36:56 +00:00
';$Bf=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(112)."</label>","<th style=' text - align : right ; '><label class=' block '>".lang(134)."<input type=' checkbox ' id=' check - data '$db onclick=' formCheck ( this , /^ data\\ [ / ); ' ></ label > " , " </ thead > \n " ; $Yh = " " ; $Yg =tables_list();foreach( $Yg
as $C => $U ){ $Af = preg_replace ( '~_.*~' , '' , $C ); $db = ( $a == " " || $a == ( substr ( $a , - 1 ) == " % " ? " $Af % " : $C )); $Ef = " <tr><td> " . checkbox ( " tables[] " , $C , $db , $C , " checkboxClick(event, this); formUncheck('check-tables'); " , " block " ); if ( $U !== null &&! preg_match ( '~table~i' , $U )) $Yh .= " $Ef\n " ; else
echo " $Ef <td align='right'><label class='block'><span id='Rows- " . h ( $C ) . " '></span> " . checkbox ( " data[] " , $C , $db , " " , " checkboxClick(event, this); formUncheck('check-data'); " ) . " </label> \n " ; $Bf [ $Af ] ++ ;} echo $Yh ; if ( $Yg ) 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 )){ $Af = preg_replace ( '~_.*~' , '' , $m ); echo " <tr><td> " . checkbox ( " databases[] " , $m , $a == " " || $a == " $Af % " , $m , " formUncheck('check-databases'); " , " block " ) . " \n " ; $Bf [ $Af ] ++ ;}}} else
2014-04-01 18:00:42 +00:00
echo " <tr><td><textarea name='databases' rows='10' cols='20'></textarea> " ;} echo ' </ table >
</ form >
2015-04-01 06:36:56 +00:00
' ; $Kc = true ; foreach ( $Bf
as $x => $X ){ if ( $x != " " && $X > 1 ){ echo ( $Kc ? " <p> " : " " ) . " <a href=' " . h ( ME ) . " dump= " . urlencode ( " $x % " ) . " '> " . h ( $x ) . " </a> " ; $Kc = false ;}}} elseif ( isset ( $_GET [ " privileges " ])){ page_header ( lang ( 63 )); $I = $h -> query ( " SELECT User, Host FROM mysql. " . ( DB == " " ? " user " : " db WHERE " . q ( DB ) . " LIKE Db " ) . " ORDER BY Host, User " ); $Vc = $I ; if ( ! $I ) $I = $h -> query ( " SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host " ); echo " <form action=''><p> \n " ; hidden_fields_get (); echo " <input type='hidden' name='db' value=' " . h ( DB ) . " '> \n " ,( $Vc ? " " : " <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 ( ! $Vc || 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 " , '<p class="links"><a href="' . h ( ME ) . 'user=">' . lang ( 135 ) . " </a> " ;} elseif ( isset ( $_GET [ " sql " ])){ if ( ! $n && $_POST [ " export " ]){ dump_headers ( " sql " ); $b -> dumpTable ( " " , " " ); $b -> dumpData ( " " , " table " , $_POST [ " query " ]); exit ;} restart_session (); $fd =& get_session ( " queries " ); $ed =& $fd [ DB ]; if ( ! $n && $_POST [ " clear " ]){ $ed = array (); redirect ( remove_from_uri ( " history " ));} page_header (( isset ( $_GET [ " import " ]) ? lang ( 64 ) : lang ( 55 )), $n ); if ( ! $n && $_POST ){ $Sc = false ; if ( ! isset ( $_GET [ " import " ])) $H = $_POST [ " query " ]; elseif ( $_POST [ " webfile " ]){ $Sc =@ fopen (( file_exists ( " adminer.sql " ) ? " adminer.sql " : " compress.zlib://adminer.sql.gz " ), " rb " ); $H = ( $Sc ? fread ( $Sc , 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 ){ $Lf = $H . ( preg_match ( " ~;[ \t \r \n ]* \$ ~ " , $H ) ? " " : " ; " ); if ( ! $ed || reset ( end ( $ed )) != $Lf ){ restart_session (); $ed [] = array ( $Lf , time ()); set_session ( " queries " , $fd ); stop_session ();}} $Eg = " (?: \\ s|/ \\ *.* \\ */|(?:#|-- )[^ \n ]* \n |-- \r ? \n ) " ; $Nb = " ; " ; $D = 0 ; $mc = true ; $i = connect (); if ( is_object ( $i ) && DB != " " ) $i -> select_db ( DB ); $qb = 0 ; $rc = array (); $Yd = 0 ; $lf = '[\'"' . ( $w == " sql " ? '`#' : ( $w == " sqlite " ? '`[' : ( $w == " mssql " ? '[' : '' ))) . ']|/\\*|-- |$' . ( $w == " pgsql " ? '|\\$[^$]*\\$' : '' ); $sh = microtime ( true ); parse_str ( $_COOKIE [ " adminer_export " ], $xa ); $dc = $b -> dumpFormat (); unset ( $dc [ " sql " ]); while ( $H != " " ){ if ( ! $D && preg_match ( " ~^ $Eg *DELIMITER \\ s+( \\ S+)~i " , $H , $B )){ $Nb = $B [ 1 ]; $H = substr ( $H , strlen ( $B [ 0 ]));} else { preg_match ( '(' . preg_quote ( $Nb ) . " \\ s*| $lf ) " , $H , $B , PREG_OFFSET_CAPTURE , $D ); list ( $Qc , $xf ) = $B [ 0 ]; if ( ! $Qc && $Sc &&! feof ( $Sc )) $H .= fread ( $Sc , 1e5 ); else { if ( ! $Qc && rtrim ( $H ) == " " ) break ; $D = $xf + strlen ( $Qc ); if ( $Qc && rtrim ( $Qc ) != $Nb ){ while ( preg_match ( '(' . ( $Qc == '/*' ? '\\*/' : ( $Qc == '[' ? ']' : ( preg_match ( '~^-- |^#~' , $Qc ) ? " \n " : preg_quote ( $Qc ) . " | \\ \\ . " ))) . '|$)s' , $H , $B , PREG_OFFSET_CAPTURE , $D )){ $mg = $B [ 0 ][ 0 ]; if ( ! $mg && $Sc &&! feof ( $Sc )) $H .= fread ( $Sc , 1e5 ); else { $D = $B [ 0 ][ 1 ] + strlen ( $mg ); if ( $mg [ 0 ] != " \\ " ) break ;}}} else { $mc = false ; $Lf = substr ( $H , 0 , $xf ); $qb ++ ; $Ef = " <pre id='sql- $qb '><code class='jush- $w '> " . shorten_utf8 ( trim ( $Lf ), 1000 ) . " </code></pre> \n " ; if ( ! $_POST [ " only_errors " ]){ echo $Ef ; ob_flush (); flush ();} $Hg = microtime ( true ); if ( $h -> multi_query ( $Lf ) && is_object ( $i ) && preg_match ( " ~^ $Eg *USE \\ b~isU " , $Lf )) $i -> query ( $Lf ); do { $I = $h -> store_result (); $ih = " <span class='time'>( " . format_time ( $Hg ) . " )</span> " . ( strlen ( $Lf ) < 1000 ? " <a href=' " . h ( ME ) . " sql= " . urlencode ( trim ( $Lf )) . " '> " . lang ( 10 ) . " </a> " : " " ); if ( $h -> error ){ echo ( $_POST [ " only_errors " ] ? $Ef : " " ), " <p class='error'> " . lang ( 136 ) . ( $h -> errno ? " ( $h->errno ) " : " " ) . " : " . error () . " \n " ; $rc [] = " <a href='#sql- $qb '> $qb </a> " ; if ( $_POST [ " error_stops " ]) break
2 ;} elseif ( is_object ( $I )){ $z = $_POST [ " limit " ]; $af = select ( $I , $i , array (), $z ); if ( ! $_POST [ " only_errors " ]){ echo " <form action='' method='post'> \n " ; $De = $I -> num_rows ; echo " <p> " . ( $De ? ( $z && $De > $z ? lang ( 137 , $z ) : " " ) . lang ( 138 , $De ) : " " ), $ih ; $jd = " export- $qb " ; $_c = " , <a href='# $jd ' onclick= \" return !toggle(' $jd '); \" > " . lang ( 65 ) . " </a><span id=' $jd ' class='hidden'>: " . html_select ( " output " , $b -> dumpOutput (), $xa [ " output " ]) . " " . html_select ( " format " , $dc , $xa [ " format " ]) . " <input type='hidden' name='query' value=' " . h ( $Lf ) . " '> " . " <input type='submit' name='export' value=' " . lang ( 65 ) . " '><input type='hidden' name='token' value=' $T '></span> \n " ; if ( $i && preg_match ( " ~^( $Eg | \\ ()*SELECT \\ b~isU " , $Lf ) && ( $zc = explain ( $i , $Lf ))){ $jd = " explain- $qb " ; echo " , <a href='# $jd ' onclick= \" return !toggle(' $jd '); \" >EXPLAIN</a> $_c " , " <div id=' $jd ' class='hidden'> \n " ; select ( $zc , $i , $af ); echo " </div> \n " ;} else
echo $_c ; echo " </form> \n " ;}} else { if ( preg_match ( " ~^ $Eg *(CREATE|DROP|ALTER) $Eg +(DATABASE|SCHEMA) \\ b~isU " , $Lf )){ restart_session (); set_session ( " dbs " , null ); stop_session ();} if ( ! $_POST [ " only_errors " ]) echo " <p class='message' title=' " . h ( $h -> info ) . " '> " . lang ( 139 , $h -> affected_rows ) . " $ih\n " ;} $Hg = microtime ( true );} while ( $h -> next_result ()); $Yd += substr_count ( $Lf . $Qc , " \n " ); $H = substr ( $H , $D ); $D = 0 ;}}}} if ( $mc ) echo " <p class='message'> " . lang ( 140 ) . " \n " ; elseif ( $_POST [ " only_errors " ]){ echo " <p class='message'> " . lang ( 141 , $qb - count ( $rc )), " <span class='time'>( " . format_time ( $sh ) . " )</span> \n " ;} elseif ( $rc && $qb > 1 ) echo " <p class='error'> " . lang ( 136 ) . " : " . implode ( " " , $rc ) . " \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 " >
2015-04-01 06:36:56 +00:00
';$wc="<input type=' submit ' value=' " .lang(142). " ' title=' Ctrl + Enter '>";if(!isset($_GET["import"])){$Lf=$_GET["sql"];if($_POST)$Lf=$_POST["query"];elseif($_GET["history"]=="all")$Lf=$ed;elseif($_GET["history"]!="")$Lf=$ed[$_GET["history"]][0];echo"<p>";textarea("query",$Lf,20);echo($_POST?"":"<script type=' text / javascript '>focus(document.getElementsByTagName(' textarea ')[0]);</script>\n"),"<p>$wc\n",lang(143).": <input type=' number ' name=' limit ' class=' size ' value=' " .h( $_POST ? $_POST["limit"] : $_GET["limit"] ). " '>\n";}else{echo"<fieldset><legend>".lang(144)."</legend><div>",(ini_bool("file_uploads")?"SQL (< ".ini_get("upload_max_filesize")."B): <input type=' file ' name=' sql_file [] ' multiple>\n$wc":lang(145)),"</div></fieldset>\n","<fieldset><legend>".lang(146)."</legend><div>",lang(147,"<code>adminer.sql".(extension_loaded("zlib")?"[.gz]":"")."</code>"),' < input type = " submit " name = " webfile " value = " '.lang(148).' " > ' , " </div></fieldset> \n " , " <p> " ;} echo
checkbox ( " error_stops " , 1 ,( $_POST ? $_POST [ " error_stops " ] : isset ( $_GET [ " import " ])), lang ( 149 )) . " \n " , checkbox ( " only_errors " , 1 ,( $_POST ? $_POST [ " only_errors " ] : isset ( $_GET [ " import " ])), lang ( 150 )) . " \n " , " <input type='hidden' name='token' value=' $T '> \n " ; if ( ! isset ( $_GET [ " import " ]) && $ed ){ print_fieldset ( " history " , lang ( 151 ), $_GET [ " history " ] != " " ); for ( $X = end ( $ed ); $X ; $X = prev ( $ed )){ $x = key ( $ed ); list ( $Lf , $ih , $hc ) = $X ; echo '<a href="' . h ( ME . " sql=&history= $x " ) . '">' . lang ( 10 ) . " </a> " . " <span class='time' title=' " .@ date ( 'Y-m-d' , $ih ) . " '> " .@ date ( " H:i:s " , $ih ) . " </span> " . " <code class='jush- $w '> " . shorten_utf8 ( ltrim ( str_replace ( " \n " , " " , str_replace ( " \r " , " " , preg_replace ( '~^(#|-- ).*~m' , '' , $Lf )))), 80 , " </code> " ) . ( $hc ? " <span class='time'>( $hc )</span> " : " " ) . " <br> \n " ;} echo " <input type='submit' name='clear' value=' " . lang ( 152 ) . " '> \n " , " <a href=' " . h ( ME . " sql=&history=all " ) . " '> " . lang ( 153 ) . " </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 )); $Jh = ( isset ( $_GET [ " select " ]) ? $_POST [ " edit " ] : $Z ); foreach ( $p
as $C => $o ){ if ( ! isset ( $o [ " privileges " ][ $Jh ? " update " : " insert " ]) || $b -> fieldName ( $o ) == " " ) unset ( $p [ $C ]);} if ( $_POST &&! $n &&! isset ( $_GET [ " select " ])){ $A = $_POST [ " referer " ]; if ( $_POST [ " insert " ]) $A = ( $Jh ? null : $_SERVER [ " REQUEST_URI " ]); elseif ( ! preg_match ( '~^.+&select=.+$~' , $A )) $A = ME . " select= " . urlencode ( $a ); $v = indexes ( $a ); $Eh = unique_array ( $_GET [ " where " ], $v ); $Of = " \n WHERE $Z " ; if ( isset ( $_POST [ " delete " ])) queries_redirect ( $A , lang ( 154 ), $Wb -> delete ( $a , $Of , ! $Eh )); else { $O = array (); foreach ( $p
as $C => $o ){ $X = process_input ( $o ); if ( $X !== false && $X !== null ) $O [ idf_escape ( $C )] = $X ;} if ( $Jh ){ if ( ! $O ) redirect ( $A ); queries_redirect ( $A , lang ( 155 ), $Wb -> update ( $a , $O , $Of , ! $Eh )); if ( is_ajax ()){ page_headers (); page_messages ( $n ); exit ;}} else { $I = $Wb -> insert ( $a , $O ); $Rd = ( $I ? last_id () : 0 ); queries_redirect ( $A , lang ( 156 ,( $Rd ? " $Rd " : " " )), $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 ( $w == " 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 = $Wb -> 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 = $Wb -> select ( $a , array ( " * " ), $Z , array ( " * " )); $K = ( $I ? $I -> fetch_assoc () : false ); if ( ! $K ) $K = array ( $Wb -> primary => " " );} if ( $K ){ foreach ( $K
as $x => $X ){ if ( ! $Z ) $K [ $x ] = null ; $p [ $x ] = array ( " field " => $x , " null " => ( $x != $Wb -> primary ), " auto_increment " => ( $x == $Wb -> primary ));}}} edit_form ( $a , $p , $K , $Jh );} elseif ( isset ( $_GET [ " create " ])){ $a = $_GET [ " create " ]; $mf = array (); foreach ( array ( 'HASH' , 'LINEAR HASH' , 'KEY' , 'LINEAR KEY' , 'RANGE' , 'LIST' ) as $x ) $mf [ $x ] = $x ; $Vf = referencable_primary ( $a ); $Oc = array (); foreach ( $Vf
as $Tg => $o ) $Oc [ str_replace ( " ` " , " `` " , $Tg ) . " ` " . str_replace ( " ` " , " `` " , $o [ " field " ])] = $Tg ; $df = array (); $R = array (); if ( $a != " " ){ $df = fields ( $a ); $R = table_status ( $a ); if ( ! $R ) $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 ( 157 ), drop_tables ( array ( $a ))); else { $p = array (); $Da = array (); $Nh = false ; $Mc = array (); ksort ( $K [ " fields " ]); $cf = reset ( $df ); $Aa = " FIRST " ; foreach ( $K [ " fields " ] as $x => $o ){ $q = $Oc [ $o [ " type " ]]; $_h = ( $q !== null ? $Vf [ $q ] : $o ); if ( $o [ " field " ] != " " ){ if ( ! $o [ " has_default " ]) $o [ " default " ] = null ; if ( $x == $K [ " auto_increment_col " ]) $o [ " auto_increment " ] = true ; $Jf = process_field ( $o , $_h ); $Da [] = array ( $o [ " orig " ], $Jf , $Aa ); if ( $Jf != process_field ( $cf , $cf )){ $p [] = array ( $o [ " orig " ], $Jf , $Aa ); if ( $o [ " orig " ] != " " || $Aa ) $Nh = true ;} if ( $q !== null ) $Mc [ idf_escape ( $o [ " field " ])] = ( $a != " " && $w != " sqlite " ? " ADD " : " " ) . format_foreign_key ( array ( 'table' => $Oc [ $o [ " type " ]], 'source' => array ( $o [ " field " ]), 'target' => array ( $_h [ " field " ]), 'on_delete' => $o [ " on_delete " ],)); $Aa = " AFTER " . idf_escape ( $o [ " field " ]);} elseif ( $o [ " orig " ] != " " ){ $Nh = true ; $p [] = array ( $o [ " orig " ]);} if ( $o [ " orig " ] != " " ){ $cf = next ( $df ); if ( ! $cf ) $Aa = " " ;}} $of = " " ; if ( $mf [ $K [ " partition_by " ]]){ $pf = array (); if ( $K [ " partition_by " ] == 'RANGE' || $K [ " partition_by " ] == 'LIST' ){ foreach ( array_filter ( $K [ " partition_names " ]) as $x => $X ){ $Y = $K [ " partition_values " ][ $x ]; $pf [] = " \n PARTITION " . idf_escape ( $X ) . " VALUES " . ( $K [ " partition_by " ] == 'RANGE' ? " LESS THAN " : " IN " ) . ( $Y != " " ? " ( $Y ) " : " MAXVALUE " );}} $of .= " \n PARTITION BY $K[partition_by] ( $K[partition] ) " . ( $pf ? " ( " . implode ( " , " , $pf ) . " \n ) " : ( $K [ " partitions " ] ? " PARTITIONS " . ( + $K [ " partitions " ]) : " " ));} elseif ( support ( " partitioning " ) && preg_match ( " ~partitioned~ " , $R [ " Create_options " ])) $of .= " \n REMOVE PARTITIONING " ; $me = lang ( 158 ); if ( $a == " " ){ cookie ( " adminer_engine " , $K [ " Engine " ]); $me = lang ( 159 );} $C = trim ( $K [ " name " ]); queries_redirect ( ME . ( support ( " table " ) ? " table= " : " select= " ) . urlencode ( $C ), $me , alter_table ( $a , $C ,( $w == " sqlite " && ( $Nh || $Mc ) ? $Da : $p ), $Mc ,( $K [ " Comment " ] != $R [ " Comment " ] ? $K [ " Comment " ] : null ),( $K [ " Engine " ] && $K [ " Engine " ] != $R [ " Engine " ] ? $K [ " Engine " ] : " " ),( $K [ " Collation " ] && $K [ " Collation " ] != $R [ " Collation " ] ? $K [ " Collation " ] : " " ),( $K [ " Auto_increment " ] != " " ? number ( $K [ " Auto_increment " ]) : " " ), $of ));}} page_header (( $a != " " ? lang ( 41 ) : lang ( 66 )), $n , array ( " table " => $a ), h ( $a )); if ( ! $_POST ){ $K = array ( " Engine " => $_COOKIE [ " adminer_engine " ], " fields " => array ( array ( " field " => " " , " type " => ( isset ( $Bh [ " int " ]) ? " int " : ( isset ( $Bh [ " integer " ]) ? " integer " : " " )))), " partition_names " => array ( " " ),); if ( $a != " " ){ $K = $R ; $K [ " name " ] = $a ; $K [ " fields " ] = array (); if ( ! $_GET [ " auto_increment " ]) $K [ " Auto_increment " ] = " " ; foreach ( $df
as $o ){ $o [ " has_default " ] = isset ( $o [ " default " ]); $K [ " fields " ][] = $o ;} if ( support ( " partitioning " )){ $Tc = " FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q ( DB ) . " AND TABLE_NAME = " . q ( $a ); $I = $h -> query ( " SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $Tc ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1 " ); list ( $K [ " partition_by " ], $K [ " partitions " ], $K [ " partition " ]) = $I -> fetch_row (); $pf = get_key_vals ( " SELECT PARTITION_NAME, PARTITION_DESCRIPTION $Tc AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION " ); $pf [ " " ] = " " ; $K [ " partition_names " ] = array_keys ( $pf ); $K [ " partition_values " ] = array_values ( $pf );}}} $nb = collations (); $oc = engines (); foreach ( $oc
as $nc ){ if ( ! strcasecmp ( $nc , $K [ " Engine " ])){ $K [ " Engine " ] = $nc ; break ;}} echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " id = " form " >
< p >
' ; if ( support ( " columns " ) || $a == " " ){ echo
2015-04-01 06:36:56 +00:00
lang ( 160 ), ': <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($oc?"<select name=' Engine ' onchange=' helpClose (); '".on_help("getTarget(event).value",1).">".optionlist(array(""=>"(".lang(161).")")+$oc,$K["Engine"])."</select>":""),' ',($nb&&!preg_match("~sqlite|mssql~",$w)?html_select("Collation",array(""=>"(".lang(87).")")+$nb,$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 " >
2015-04-01 06:36:56 +00:00
';$sb=($_POST?$_POST["comments"]:$K["Comment"]!="");if(!$_POST&&!$sb){foreach($K["fields"]as$o){if($o["comment"]!=""){$sb=true;break;}}}edit_fields($K["fields"],$nb,"TABLE",$Oc,$sb);echo' </ table >
2014-04-01 18:00:42 +00:00
< p >
2015-04-01 06:36:56 +00:00
',lang(56),' : < input type = " number " name = " Auto_increment " size = " 6 " value = " ',h( $K["Auto_increment"] ),' " >
',checkbox("defaults",1,true,lang(162),"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();\"".($sb?" checked":"").">".lang(96)."</label>".' < input name = " Comment " id = " Comment " value = " '.h( $K["Comment"] ).' " maxlength = " '.( $h->server_info >=5.5?2048:60).' " '.($sb?' ':' class = " hidden " ').' > ':' '),' < p >
< input type = " submit " value = " ',lang(14),' " >
2014-04-01 18:00:42 +00:00
';}echo'
2015-04-01 06:36:56 +00:00
';if($a!=""){echo' < input type = " submit " name = " drop " value = " ',lang(116),' " ',confirm(),' > ';}if(support("partitioning")){$nf=preg_match(' ~ RANGE | LIST ~ ',$K["partition_by"]);print_fieldset("partition",lang(163),$K["partition_by"]);echo' < p >
',"<select name=' partition_by ' onchange=' partitionByChange ( this ); '".on_help("getTarget(event).value.replace(/./, ' PARTITION BY \ $ & ')",1).">".optionlist(array(""=>"")+$mf,$K["partition_by"])."</select>",' ( < input name = " partition " value = " ',h( $K["partition"] ),' " > )
',lang(164),' : < input type = " number " name = " partitions " class = " size',( $nf ||! $K["partition_by"] ? " hidden " : " " ),' " value = " ',h( $K["partitions"] ),' " >
< table cellspacing = " 0 " id = " partition-table " ',($nf?"":" class=' hidden '"),' >
< thead >< tr >< th > ',lang(165),' < th > ',lang(166),' </ thead >
2014-04-01 18:00:42 +00:00
';foreach($K["partition_names"]as$x=>$X){echo' < tr > ',' < td >< input name = " partition_names[] " value = " '.h( $X ).' " '.($x==count($K["partition_names"])-1?' onchange = " partitionNameChange(this); " ':' ').' autocapitalize = " off " > ',' < td >< input name = " partition_values[] " value = " '.h( $K["partition_values"] [ $x ]).' " > ';}echo' </ table >
</ div ></ fieldset >
';}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$pd=array("PRIMARY","UNIQUE","INDEX");$R=table_status($a,true);if(preg_match(' ~ MyISAM | M ? aria '.($h->server_info>=5.6?' | InnoDB ':' ').' ~ i ' , $R [ " Engine " ])) $pd [] = " FULLTEXT " ; $v = indexes ( $a ); $Cf = array (); if ( $w == " mongo " ){ $Cf = $v [ " _id_ " ]; unset ( $pd [ 0 ]); unset ( $v [ " _id_ " ]);} $K = $_POST ; if ( $_POST &&! $n &&! $_POST [ " add " ] &&! $_POST [ " drop_col " ]){ $c = array (); foreach ( $K [ " indexes " ] as $u ){ $C = $u [ " name " ]; if ( in_array ( $u [ " type " ], $pd )){ $f = array (); $Wd = array (); $Pb = array (); $O = array (); ksort ( $u [ " columns " ]); foreach ( $u [ " columns " ] as $x => $e ){ if ( $e != " " ){ $y = $u [ " lengths " ][ $x ]; $Ob = $u [ " descs " ][ $x ]; $O [] = idf_escape ( $e ) . ( $y ? " ( " . ( + $y ) . " ) " : " " ) . ( $Ob ? " DESC " : " " ); $f [] = $e ; $Wd [] = ( $y ? $y : null ); $Pb [] = $Ob ;}} if ( $f ){ $xc = $v [ $C ]; if ( $xc ){ ksort ( $xc [ " columns " ]); ksort ( $xc [ " lengths " ]); ksort ( $xc [ " descs " ]); if ( $u [ " type " ] == $xc [ " type " ] && array_values ( $xc [ " columns " ]) === $f && ( ! $xc [ " lengths " ] || array_values ( $xc [ " lengths " ]) === $Wd ) && array_values ( $xc [ " descs " ]) === $Pb ){ unset ( $v [ $C ]); continue ;}} $c [] = array ( $u [ " type " ], $C , $O );}}} foreach ( $v
as $C => $xc ) $c [] = array ( $xc [ " type " ], $C , " DROP " ); if ( ! $c ) redirect ( ME . " table= " . urlencode ( $a )); queries_redirect ( ME . " table= " . urlencode ( $a ), lang ( 167 ), alter_indexes ( $a , $c ));} page_header ( lang ( 121 ), $n , array ( " table " => $a ), h ( $a )); $p = array_keys ( fields ( $a )); if ( $_POST [ " add " ]){ foreach ( $K [ " indexes " ] as $x => $u ){ if ( $u [ " columns " ][ count ( $u [ " columns " ])] != " " ) $K [ " indexes " ][ $x ][ " columns " ][] = " " ;} $u = end ( $K [ " indexes " ]); if ( $u [ " type " ] || array_filter ( $u [ " columns " ], 'strlen' )) $K [ " indexes " ][] = array ( " columns " => array ( 1 => " " ));} if ( ! $K ){ foreach ( $v
2014-04-01 18:00:42 +00:00
as $x => $u ){ $v [ $x ][ " name " ] = $x ; $v [ $x ][ " columns " ][] = " " ;} $v [] = array ( " columns " => array ( 1 => " " )); $K [ " indexes " ] = $v ;} echo '
< form action = " " method = " post " >
< table cellspacing = " 0 " class = " nowrap " >
< thead >< tr >
2015-04-01 06:36:56 +00:00
< th > ',lang(168),' < th >< input type = " submit " style = " left: -1000px; position: absolute; " > ',lang(169),' < th > ' , lang ( 170 ); ?>
< th >< noscript >< input type = 'image' class = 'icon' name = 'add[0]' src = '" . h(preg_replace("~\\?.*~", "", ME)) . "?file=plus.gif&version=4.2.1' alt = '+' title = ' < ? php echo
lang ( 97 ), ' \ ' ></ noscript >& nbsp ;
2014-04-01 18:00:42 +00:00
</ thead >
2015-04-01 06:36:56 +00:00
' ; if ( $Cf ){ echo " <tr><td>PRIMARY<td> " ; foreach ( $Cf [ " columns " ] as $x => $e ){ echo
select_input ( " disabled " , $p , $e ), " <label><input disabled type='checkbox'> " . lang ( 50 ) . " </label> " ;} echo " <td><td> \n " ;} $Fd = 1 ; foreach ( $K [ " indexes " ] as $u ){ if ( ! $_POST [ " drop_col " ] || $Fd != key ( $_POST [ " drop_col " ])){ echo " <tr><td> " . html_select ( " indexes[ $Fd ][type] " , array ( - 1 => " " ) + $pd , $u [ " type " ],( $Fd == count ( $K [ " indexes " ]) ? " indexesAddRow(this); " : 1 )), " <td> " ; ksort ( $u [ " columns " ]); $s = 1 ; foreach ( $u [ " columns " ] as $x => $e ){ echo " <span> " . select_input ( " name='indexes[ $Fd ][columns][ $s ]' onchange= \" " . ( $s == count ( $u [ " columns " ]) ? " indexesAddColumn " : " indexesChangeColumn " ) . " (this, ' " . js_escape ( $w == " sql " ? " " : $_GET [ " indexes " ] . " _ " ) . " '); \" " ,( $p ? array_combine ( $p , $p ) : $p ), $e ),( $w == " sql " || $w == " mssql " ? " <input type='number' name='indexes[ $Fd ][lengths][ $s ]' class='size' value=' " . h ( $u [ " lengths " ][ $x ]) . " '> " : " " ),( $w != " sql " ? checkbox ( " indexes[ $Fd ][descs][ $s ] " , 1 , $u [ " descs " ][ $x ], lang ( 50 )) : " " ), " </span> " ; $s ++ ;} echo " <td><input name='indexes[ $Fd ][name]' value=' " . h ( $u [ " name " ]) . " ' autocapitalize='off'> \n " , " <td><input type='image' class='icon' name='drop_col[ $Fd ]' src=' " . h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME )) . " ?file=cross.gif&version=4.2.1' alt='x' title=' " . lang ( 100 ) . " ' onclick= \" return !editingRemoveRow(this, 'indexes \$ 1[type]'); \" > \n " ;} $Fd ++ ;} 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),' " >
2014-04-01 18:00:42 +00:00
< input type = " hidden " name = " token " value = " ', $T ,' " >
</ form >
2015-04-01 06:36:56 +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(171),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace(' ~ \bdb = [ ^& ] *&~ ',' ' , ME ) . " db= " . urlencode ( $C ), lang ( 172 ), rename_database ( $C , $K [ " collation " ]));} else { $l = explode ( " \n " , str_replace ( " \r " , " " , $C )); $Ng = true ; $Qd = " " ; foreach ( $l
as $m ){ if ( count ( $l ) == 1 || $m != " " ){ if ( ! create_database ( $m , $K [ " collation " ])) $Ng = false ; $Qd = $m ;}} restart_session (); set_session ( " dbs " , null ); queries_redirect ( ME . " db= " . urlencode ( $Qd ), lang ( 173 ), $Ng );}} 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 ( 174 ));}} page_header ( DB != " " ? lang ( 59 ) : lang ( 175 ), $n , array (), h ( DB )); $nb = collations (); $C = DB ; if ( $_POST ) $C = $K [ " name " ]; elseif ( DB != " " ) $K [ " collation " ] = db_collation ( DB , $nb ); elseif ( $w == " sql " ){ foreach ( get_vals ( " SHOW GRANTS " ) as $Vc ){ if ( preg_match ( '~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~' , $Vc , $B ) && $B [ 1 ]){ $C = stripcslashes ( idf_unescape ( " ` $B[2] ` " )); break ;}}} echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< p >
2015-04-01 06:36:56 +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".($nb?html_select("collation",array(""=>"(".lang(87).")")+$nb,$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 ), ' " >
';if(DB!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(116). " '".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.2 . 1 ' alt=' + ' title=' " .lang(97). " '>\n";echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +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 ( 176 )); else { $C = trim ( $K [ " name " ]); $_ .= urlencode ( $C ); if ( $_GET [ " ns " ] == " " ) query_redirect ( " CREATE SCHEMA " . idf_escape ( $C ), $_ , lang ( 177 )); elseif ( $_GET [ " ns " ] != $C ) query_redirect ( " ALTER SCHEMA " . idf_escape ( $_GET [ " ns " ]) . " RENAME TO " . idf_escape ( $C ), $_ , lang ( 178 )); else
redirect ( $_ );}} page_header ( $_GET [ " ns " ] != " " ? lang ( 60 ) : lang ( 61 ), $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 ), ' " >
';if($_GET["ns"]!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(116). " '".confirm().">\n";echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header(lang(179).": ".h($da),$n);$ig=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$nd=array();$gf=array();foreach($ig["fields"]as$s=>$o){if(substr($o["inout"],-3)=="OUT")$gf[$s]="@".idf_escape($o["field"])." AS ".idf_escape($o["field"]);if(!$o["inout"]||substr($o["inout"],0,2)=="IN")$nd[]=$s;}if(!$n&&$_POST){$Ya=array();foreach($ig["fields"]as$x=>$o){if(in_array($x,$nd)){$X=process_input($o);if($X===false)$X="' '";if(isset($gf[$x]))$h->query("SET @".idf_escape($o["field"])." = $X");}$Ya[]=(isset($gf[$x])?"@".idf_escape($o["field"]):$X);}$H=(isset($_GET["callf"])?"SELECT":"CALL")." ".idf_escape($da)."(".implode(", ",$Ya).")";echo"<p><code class=' jush - $w '>".h($H)."</code> <a href=' " .h(ME). " sql = " .urlencode( $H ). " '>".lang(10)."</a>\n";if(!$h->multi_query($H))echo"<p class=' error ' > " .error(). " \n " ;else { $i =connect();if(is_object( $i )) $i->select_db (DB);do { $I = $h->store_result ();if(is_object( $I ))select( $I , $i );else
echo " <p class='message'> " . lang ( 180 , $h -> affected_rows ) . " \n " ;} while ( $h -> next_result ()); if ( $gf ) select ( $h -> query ( " SELECT " . implode ( " , " , $gf )));}} echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
2015-04-01 06:36:56 +00:00
';if($nd){echo"<table cellspacing=' 0 ' > \n " ;foreach( $nd
as $x ){ $o = $ig [ " fields " ][ $x ]; $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(179),' " >
2014-04-01 18:00:42 +00:00
< input type = " hidden " name = " token " value = " ', $T ,' " >
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$K=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$me=($_POST["drop"]?lang(181):($C!=""?lang(182):lang(183)));$A=ME."table=".urlencode($a);$K["source"]=array_filter($K["source"],' strlen ');ksort($K["source"]);$bh=array();foreach($K["source"]as$x=>$X)$bh[$x]=$K["target"][$x];$K["target"]=$bh;if($w=="sqlite")queries_redirect($A,$me,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($K)))));else{$c="ALTER TABLE ".table($a);$Yb="\nDROP ".($w=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$Yb,$A,$me);else{query_redirect($c.($C!=""?"$Yb,":"")."\nADD".format_foreign_key($K),$A,$me);$n=lang(184)."<br>$n";}}}page_header(lang(185),$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!=""){$Oc=foreign_keys($a);$K=$Oc[$C];$K["source"][]="";}else{$K["table"]=$a;$K["source"]=array("");}$Dg=array_keys(fields($a));$bh=($a===$K["table"]?$Dg:array_keys(fields($K["table"])));$Uf=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
2015-04-01 06:36:56 +00:00
lang ( 186 ), ' :
',html_select("table",$Uf,$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(187),' " ></ noscript >
2014-04-01 18:00:42 +00:00
< table cellspacing = " 0 " >
2015-04-01 06:36:56 +00:00
< thead >< tr >< th > ',lang(123),' < th > ',lang(124),' </ thead >
';$Fd=0;foreach($K["source"]as$x=>$X){echo"<tr>","<td>".html_select("source[".(+$x)."]",array(-1=>"")+$Dg,$X,($Fd==count($K["source"])-1?"foreignAddRow(this);":1)),"<td>".html_select("target[".(+$x)."]",$bh,$K["target"][$x]);$Fd++;}echo' </ table >
2014-04-01 18:00:42 +00:00
< p >
2015-04-01 06:36:56 +00:00
',lang(89),' : ',html_select("on_delete",array(-1=>"")+explode("|",$Ne),$K["on_delete"]),' ',lang(88),' : ',html_select("on_update",array(-1=>"")+explode("|",$Ne),$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 >
< input type = " submit " value = " ',lang(14),' " >
< noscript >< p >< input type = " submit " name = " add " value = " ',lang(188),' " ></ noscript >
';}if($C!=""){echo' < input type = " submit " name = " drop " value = " ',lang(116),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$K=$_POST;if($_POST&&!$n){$C=trim($K["name"]);$Ga=" AS\n$K[select]";$A=ME."table=".urlencode($C);$me=lang(189);if($_GET["materialized"])$U="MATERIALIZED VIEW";else{$U="VIEW";if($w=="pgsql"){$Ig=table_status($C);$U=($Ig?strtoupper($Ig["Engine"]):$U);}}if(!$_POST["drop"]&&$a==$C&&$w!="sqlite"&&$U!="MATERIALIZED VIEW")query_redirect(($w=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Ga,$A,$me);else{$dh=$C."_adminer_".uniqid();drop_create("DROP $U ".table($a),"CREATE $U ".table($C).$Ga,"DROP $U ".table($C),"CREATE $U ".table($dh).$Ga,"DROP $U ".table($dh),($_POST["drop"]?substr(ME,0,-1):$A),lang(190),$me,lang(191),$a,$C);}}if(!$_POST&&$a!=""){$K=view($a);$K["name"]=$a;if(!$n)$n=error();}page_header(($a!=""?lang(40):lang(192)),$n,array("table"=>$a),h($a));echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
2015-04-01 06:36:56 +00:00
< p > ',lang(170),' : < input name = " name " value = " ',h( $K["name"] ),' " maxlength = " 64 " autocapitalize = " off " >
2014-04-01 18:00:42 +00:00
< p > ';textarea("select",$K["select"]);echo' < p >
2015-04-01 06:36:56 +00:00
< input type = " submit " value = " ',lang(14),' " >
';if($_GET["view"]!=""){echo' < input type = " submit " name = " drop " value = " ',lang(116),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$xd=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Jg=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(193));elseif(in_array($K["INTERVAL_FIELD"],$xd)&&isset($Jg[$K["STATUS"]])){$ng="\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(194):lang(195)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$ng.($aa!=$K["EVENT_NAME"]?"\nRENAME TO ".idf_escape($K["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($K["EVENT_NAME"]).$ng)."\n".$Jg[$K["STATUS"]]." COMMENT ".q($K["EVENT_COMMENT"]).rtrim(" DO\n$K[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(196).": ".h($aa):lang(197)),$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 " >
2015-04-01 06:36:56 +00:00
< tr >< th > ',lang(170),' < td >< input name = " EVENT_NAME " value = " ',h( $K["EVENT_NAME"] ),' " maxlength = " 64 " autocapitalize = " off " >
< tr >< th title = " datetime " > ',lang(198),' < td >< input name = " STARTS " value = " ',h( " $K [ EXECUTE_AT ] $K [ STARTS ] " ),' " >
< tr >< th title = " datetime " > ',lang(199),' < td >< input name = " ENDS " value = " ',h( $K["ENDS"] ),' " >
< tr >< th > ',lang(200),' < td >< input type = " number " name = " INTERVAL_VALUE " value = " ',h( $K["INTERVAL_VALUE"] ),' " class = " size " > ',html_select("INTERVAL_FIELD",$xd,$K["INTERVAL_FIELD"]),' < tr >< th > ',lang(107),' < td > ',html_select("STATUS",$Jg,$K["STATUS"]),' < tr >< th > ',lang(96),' < 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(201)),' </ 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),' " >
';if($aa!=""){echo' < input type = " submit " name = " drop " value = " ',lang(116),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$ig=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$K=$_POST;$K["fields"]=(array)$K["fields"];if($_POST&&!process_fields($K["fields"])&&!$n){$dh="$K[name]_adminer_".uniqid();drop_create("DROP $ig ".idf_escape($da),create_routine($ig,$K),"DROP $ig ".idf_escape($K["name"]),create_routine($ig,array("name"=>$dh)+$K),"DROP $ig ".idf_escape($dh),substr(ME,0,-1),lang(202),lang(203),lang(204),$da,$K["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(205):lang(206)).": ".h($da):(isset($_GET["function"])?lang(207):lang(208))),$n);if(!$_POST&&$da!=""){$K=routine($da,$ig);$K["name"]=$da;}$nb=get_vals("SHOW CHARACTER SET");sort($nb);$jg=routine_languages();echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " id = " form " >
2015-04-01 06:36:56 +00:00
< p > ',lang(170),' : < input name = " name " value = " ',h( $K["name"] ),' " maxlength = " 64 " autocapitalize = " off " >
',($jg?lang(19).": ".html_select("language",$jg,$K["language"]):""),' < input type = " submit " value = " ',lang(14),' " >
2014-04-01 18:00:42 +00:00
< table cellspacing = " 0 " class = " nowrap " >
2015-04-01 06:36:56 +00:00
';edit_fields($K["fields"],$nb,$ig);if(isset($_GET["function"])){echo"<tr><td>".lang(209);edit_type("returns",$K["returns"],$nb);}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),' " >
';if($da!=""){echo' < input type = " submit " name = " drop " value = " ',lang(116),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +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 ( 210 )); elseif ( $fa == " " ) query_redirect ( " CREATE SEQUENCE " . idf_escape ( $C ), $_ , lang ( 211 )); elseif ( $fa != $C ) query_redirect ( " ALTER SEQUENCE " . idf_escape ( $fa ) . " RENAME TO " . idf_escape ( $C ), $_ , lang ( 212 )); else
redirect ( $_ );} page_header ( $fa != " " ? lang ( 213 ) . " : " . h ( $fa ) : lang ( 214 ), $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),' " >
';if($fa!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(116). " '".confirm().">\n";echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +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 ( 215 )); else
query_redirect ( " CREATE TYPE " . idf_escape ( trim ( $K [ " name " ])) . " $K[as] " , $_ , lang ( 216 ));} page_header ( $ga != " " ? lang ( 217 ) . " : " . h ( $ga ) : lang ( 218 ), $n ); if ( ! $K ) $K [ " as " ] = " AS " ; echo '
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " >
< p >
2015-04-01 06:36:56 +00:00
';if($ga!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(116). " '".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 = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$yh=trigger_options();$K=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$n&&in_array($_POST["Timing"],$yh["Timing"])&&in_array($_POST["Event"],$yh["Event"])&&in_array($_POST["Type"],$yh["Type"])){$Me=" ON ".table($a);$Yb="DROP TRIGGER ".idf_escape($C).($w=="pgsql"?$Me:"");$A=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($Yb,$A,lang(219));else{if($C!="")queries($Yb);queries_redirect($A,($C!=""?lang(220):lang(221)),queries(create_trigger($Me,$_POST)));if($C!="")queries(create_trigger($Me,$K+array("Type"=>reset($yh["Type"]))));}}$K=$_POST;}page_header(($C!=""?lang(222).": ".h($C):lang(223)),$n,array("table"=>$a));echo'
2014-04-01 18:00:42 +00:00
< form action = " " method = " post " id = " form " >
< table cellspacing = " 0 " >
2015-04-01 06:36:56 +00:00
< tr >< th > ',lang(224),' < td > ',html_select("Timing",$yh["Timing"],$K["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, ' " .js_escape( $a ). " ', this.form);"),' < tr >< th > ',lang(225),' < td > ',html_select("Event",$yh["Event"],$K["Event"],"this.form[' Timing '].onchange();"),(in_array("UPDATE OF",$yh["Event"])?" <input name=' Of ' value=' " .h( $K["Of"] ). " ' class=' hidden '>":""),' < tr >< th > ',lang(92),' < td > ',html_select("Type",$yh["Type"],$K["Type"]),' </ table >
< p > ',lang(170),' : < input name = " Trigger " value = " ',h( $K["Trigger"] );?> " maxlength = " 64 " autocapitalize = " off " >
< script type = " text/javascript " > document . getElementById ( 'form' )[ 'Timing' ] . onchange (); </ script >
< p >< ? php textarea ( " Statement " , $K [ " Statement " ]); echo ' < p >
< input type = " submit " value = " ',lang(14),' " >
';if($C!=""){echo' < input type = " submit " name = " drop " value = " ',lang(116),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$Hf=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$K){foreach(explode(",",($K["Privilege"]=="Grant option"?"":$K["Context"]))as$yb)$Hf[$yb][$K["Privilege"]]=$K["Comment"];}$Hf["Server Admin"]+=$Hf["File access on server"];$Hf["Databases"]["Create routine"]=$Hf["Procedures"]["Create routine"];unset($Hf["Procedures"]["Create routine"]);$Hf["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$Hf["Columns"][$X]=$Hf["Tables"][$X];unset($Hf["Server Admin"]["Usage"]);foreach($Hf["Tables"]as$x=>$X)unset($Hf["Databases"][$x]);$ze=array();if($_POST){foreach($_POST["objects"]as$x=>$X)$ze[$X]=(array)$ze[$X]+(array)$_POST["grants"][$x];}$Wc=array();$Ke="";if(isset($_GET["host"])&&($I=$h->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 ], $ee , PREG_SET_ORDER )){ foreach ( $ee
as $X ){ if ( $X [ 1 ] != " USAGE " ) $Wc [ " $B[2] $X[2] " ][ $X [ 1 ]] = true ; if ( preg_match ( '~ WITH GRANT OPTION~' , $K [ 0 ])) $Wc [ " $B[2] $X[2] " ][ " GRANT OPTION " ] = true ;}} if ( preg_match ( " ~ IDENTIFIED BY PASSWORD '([^']+)~ " , $K [ 0 ], $B )) $Ke = $B [ 1 ];}} if ( $_POST &&! $n ){ $Le = ( isset ( $_GET [ " host " ]) ? q ( $ha ) . " @ " . q ( $_GET [ " host " ]) : " '' " ); if ( $_POST [ " drop " ]) query_redirect ( " DROP USER $Le " , ME . " privileges= " , lang ( 226 )); else { $Ae = q ( $_POST [ " user " ]) . " @ " . q ( $_POST [ " host " ]); $qf = $_POST [ " pass " ]; if ( $qf != '' &&! $_POST [ " hashed " ]){ $qf = $h -> result ( " SELECT PASSWORD( " . q ( $qf ) . " ) " ); $n =! $qf ;} $Cb = false ; if ( ! $n ){ if ( $Le != $Ae ){ $Cb = queries (( $h -> server_info < 5 ? " GRANT USAGE ON *.* TO " : " CREATE USER " ) . " $Ae IDENTIFIED BY PASSWORD " . q ( $qf )); $n =! $Cb ;} elseif ( $qf != $Ke ) queries ( " SET PASSWORD FOR $Ae = " . q ( $qf ));} if ( ! $n ){ $fg = array (); foreach ( $ze
as $Fe => $Vc ){ if ( isset ( $_GET [ " grant " ])) $Vc = array_filter ( $Vc ); $Vc = array_keys ( $Vc ); if ( isset ( $_GET [ " grant " ])) $fg = array_diff ( array_keys ( array_filter ( $ze [ $Fe ], 'strlen' )), $Vc ); elseif ( $Le == $Ae ){ $Ie = array_keys (( array ) $Wc [ $Fe ]); $fg = array_diff ( $Ie , $Vc ); $Vc = array_diff ( $Vc , $Ie ); unset ( $Wc [ $Fe ]);} if ( preg_match ( '~^(.+)\\s*(\\(.*\\))?$~U' , $Fe , $B ) && ( ! grant ( " REVOKE " , $fg , $B [ 2 ], " ON $B[1] FROM $Ae " ) ||! grant ( " GRANT " , $Vc , $B [ 2 ], " ON $B[1] TO $Ae " ))){ $n = true ; break ;}}} if ( ! $n && isset ( $_GET [ " host " ])){ if ( $Le != $Ae ) queries ( " DROP USER $Le " ); elseif ( ! isset ( $_GET [ " grant " ])){ foreach ( $Wc
as $Fe => $fg ){ if ( preg_match ( '~^(.+)(\\(.*\\))?$~U' , $Fe , $B )) grant ( " REVOKE " , array_keys ( $fg ), $B [ 2 ], " ON $B[1] FROM $Ae " );}}} queries_redirect ( ME . " privileges= " ,( isset ( $_GET [ " host " ]) ? lang ( 227 ) : lang ( 228 )), ! $n ); if ( $Cb ) $h -> query ( " DROP USER $Ae " );}} page_header (( isset ( $_GET [ " host " ]) ? lang ( 33 ) . " : " . h ( " $ha @ $_GET[host] " ) : lang ( 135 )), $n , array ( " privileges " => array ( '' , lang ( 63 )))); if ( $_POST ){ $K = $_POST ; $Wc = $ze ;} else { $K = $_GET + array ( " host " => $h -> result ( " SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1) " )); $K [ " pass " ] = $Ke ; if ( $Ke != " " ) $K [ " hashed " ] = true ; $Wc [( DB == " " || $Wc ? " " : 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
2015-04-01 06:36:56 +00:00
checkbox ( " hashed " , 1 , $K [ " hashed " ], lang ( 229 ), " typePassword(this.form['pass'], this.checked); " ), ' </ table >
2014-04-01 18:00:42 +00:00
2015-04-01 06:36:56 +00:00
';echo"<table cellspacing=' 0 '>\n","<thead><tr><th colspan=' 2 '>".lang(63).doc_link(array(' sql ' => " grant.html#priv_level " )); $s = 0 ; foreach ( $Wc
as $Fe => $Vc ){ echo '<th>' . ( $Fe != " *.* " ? " <input name='objects[ $s ]' value=' " . h ( $Fe ) . " ' 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 ( 119 ), " Columns " => lang ( 120 ), " Procedures " => lang ( 230 ),) as $yb => $Ob ){ foreach (( array ) $Hf [ $yb ] as $Gf => $rb ){ echo " <tr " . odd () . " ><td " . ( $Ob ? " > $Ob <td " : " colspan='2' " ) . ' lang="en" title="' . h ( $rb ) . '">' . h ( $Gf ); $s = 0 ; foreach ( $Wc
as $Fe => $Vc ){ $C = " 'grants[ $s ][ " . h ( strtoupper ( $Gf )) . " ]' " ; $Y = $Vc [ strtoupper ( $Gf )]; if ( $yb == " Server Admin " && $Fe != ( isset ( $Wc [ " *.* " ]) ? " *.* " : " .* " )) echo " <td> " ; elseif ( isset ( $_GET [ " grant " ])) echo " <td><select name= $C ><option><option value='1' " . ( $Y ? " selected " : " " ) . " > " . lang ( 231 ) . " <option value='0' " . ( $Y == " 0 " ? " selected " : " " ) . " > " . lang ( 232 ) . " </select> " ; else
echo " <td align='center'><label class='block'><input type='checkbox' name= $C value='1' " . ( $Y ? " checked " : " " ) . ( $Gf == " All privileges " ? " id='grants- $s -all' " : ( $Gf == " Grant option " ? " " : " onclick= \" if (this.checked) formUncheck('grants- $s -all'); \" " )) . " ></label> " ; $s ++ ;}}} echo " </table> \n " , ' < p >
< input type = " submit " value = " ',lang(14),' " >
';if(isset($_GET["host"])){echo' < input type = " submit " name = " drop " value = " ',lang(116),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$n){$Md=0;foreach((array)$_POST["kill"]as$X){if(queries("KILL ".number($X)))$Md++;}queries_redirect(ME."processlist=",lang(233,$Md),$Md||!$_POST["kill"]);}page_header(lang(105),$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
2014-04-01 18:00:42 +00:00
as $x => $X ) echo " <th> $x " . doc_link ( array ( 'sql' => " show-processlist.html#processlist_ " . strtolower ( $x ), '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 [ " Id " ], 0 ) : " " ); foreach ( $K
2015-04-01 06:36:56 +00:00
as $x => $X ) echo " <td> " . (( $w == " sql " && $x == " Info " && preg_match ( " ~Query|Killed~ " , $K [ " Command " ]) && $X != " " ) || ( $w == " pgsql " && $x == " current_query " && $X != " <IDLE> " ) || ( $w == " oracle " && $x == " sql_text " && $X != " " ) ? " <code class='jush- $w '> " . shorten_utf8 ( $X , 100 , " </code> " ) . ' <a href="' . h ( ME . ( $K [ " db " ] != " " ? " db= " . urlencode ( $K [ " db " ]) . " & " : " " ) . " sql= " . urlencode ( $X )) . '">' . lang ( 234 ) . '</a>' : nbsp ( $X )); echo " \n " ;} echo ' </ table >
2014-04-01 18:00:42 +00:00
< script type = \ ' text / javascript\ ' > tableCheck (); </ script >
< p >
2015-04-01 06:36:56 +00:00
';if(support("kill")){echo($s+1)."/".lang(235,$h->result("SELECT @@max_connections")),"<p><input type=' submit ' value=' " .lang(236). " '>\n";}echo' < input type = " hidden " name = " token " value = " ', $T ,' " >
2014-04-01 18:00:42 +00:00
</ form >
2015-04-01 06:36:56 +00:00
' ;} elseif ( isset ( $_GET [ " select " ])){ $a = $_GET [ " select " ]; $R = table_status1 ( $a ); $v = indexes ( $a ); $p = fields ( $a ); $Oc = column_foreign_keys ( $a ); $He = " " ; if ( $R [ " Oid " ]){ $He = ( $w == " sqlite " ? " rowid " : " oid " ); $v [] = array ( " type " => " PRIMARY " , " columns " => array ( $He ));} parse_str ( $_COOKIE [ " adminer_import " ], $ya ); $gg = array (); $f = array (); $hh = null ; foreach ( $p
as $x => $o ){ $C = $b -> fieldName ( $o ); if ( isset ( $o [ " privileges " ][ " select " ]) && $C != " " ){ $f [ $x ] = html_entity_decode ( strip_tags ( $C ), ENT_QUOTES ); if ( is_shortable ( $o )) $hh = $b -> selectLengthProcess ();} $gg += $o [ " privileges " ];} list ( $M , $Xc ) = $b -> selectColumnsProcess ( $f , $v ); $Ad = count ( $Xc ) < count ( $M ); $Z = $b -> selectSearchProcess ( $p , $v ); $Xe = $b -> selectOrderProcess ( $p , $v ); $z = $b -> selectLimitProcess (); $Tc = ( $M ? implode ( " , " , $M ) : " * " . ( $He ? " , $He " : " " )) . convert_fields ( $f , $p , $M ) . " \n FROM " . table ( $a ); $Yc = ( $Xc && $Ad ? " \n GROUP BY " . implode ( " , " , $Xc ) : " " ) . ( $Xe ? " \n ORDER BY " . implode ( " , " , $Xe ) : " " ); if ( $_GET [ " val " ] && is_ajax ()){ header ( " Content-Type: text/plain; charset=utf-8 " ); foreach ( $_GET [ " val " ] as $Fh => $K ){ $Ga = convert_field ( $p [ key ( $K )]); $M = array ( $Ga ? $Ga : idf_escape ( key ( $K ))); $Z [] = where_check ( $Fh , $p ); $J = $Wb -> select ( $a , $M , $Z , $M ); if ( $J ) echo
reset ( $J -> fetch_row ());} exit ;} if ( $_POST &&! $n ){ $ci = $Z ; if ( ! $_POST [ " all " ] && is_array ( $_POST [ " check " ])){ $eb = array (); foreach ( $_POST [ " check " ] as $bb ) $eb [] = where_check ( $bb , $p ); $ci [] = " (( " . implode ( " ) OR ( " , $eb ) . " )) " ;} $ci = ( $ci ? " \n WHERE " . implode ( " AND " , $ci ) : " " ); $Cf = $Hh = null ; foreach ( $v
as $u ){ if ( $u [ " type " ] == " PRIMARY " ){ $Cf = array_flip ( $u [ " columns " ]); $Hh = ( $M ? $Cf : array ()); break ;}} foreach (( array ) $Hh
as $x => $X ){ if ( in_array ( idf_escape ( $x ), $M )) unset ( $Hh [ $x ]);} if ( $_POST [ " export " ]){ cookie ( " adminer_import " , " output= " . urlencode ( $_POST [ " output " ]) . " &format= " . urlencode ( $_POST [ " format " ])); dump_headers ( $a ); $b -> dumpTable ( $a , " " ); if ( ! is_array ( $_POST [ " check " ]) || $Hh === array ()) $H = " SELECT $Tc $ci $Yc " ; else { $Dh = array (); foreach ( $_POST [ " check " ] as $X ) $Dh [] = " (SELECT " . limit ( $Tc , " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $p ) . $Yc , 1 ) . " ) " ; $H = implode ( " UNION ALL " , $Dh );} $b -> dumpData ( $a , " table " , $H ); exit ;} if ( ! $b -> selectEmailProcess ( $Z , $Oc )){ if ( $_POST [ " save " ] || $_POST [ " delete " ]){ $I = true ; $za = 0 ; $O = array (); if ( ! $_POST [ " delete " ]){ foreach ( $f
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 " ] || ( $Hh === array () && is_array ( $_POST [ " check " ])) || $Ad ){ $I = ( $_POST [ " delete " ] ? $Wb -> delete ( $a , $ci ) : ( $_POST [ " clone " ] ? queries ( " INSERT $H $ci " ) : $Wb -> update ( $a , $O , $ci ))); $za = $h -> affected_rows ;} else { foreach (( array ) $_POST [ " check " ] as $X ){ $bi = " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $p ); $I = ( $_POST [ " delete " ] ? $Wb -> delete ( $a , $bi , 1 ) : ( $_POST [ " clone " ] ? queries ( " INSERT " . limit1 ( $H , $bi )) : $Wb -> update ( $a , $O , $bi ))); if ( ! $I ) break ; $za += $h -> affected_rows ;}}} $me = lang ( 237 , $za ); if ( $_POST [ " clone " ] && $I && $za == 1 ){ $Rd = last_id (); if ( $Rd ) $me = lang ( 156 , " $Rd " );} queries_redirect ( remove_from_uri ( $_POST [ " all " ] && $_POST [ " delete " ] ? " page " : " " ), $me , $I ); if ( ! $_POST [ " delete " ]){ edit_form ( $a , $p ,( array ) $_POST [ " fields " ], ! $_POST [ " clone " ]); page_footer (); exit ;}} elseif ( ! $_POST [ " import " ]){ if ( ! $_POST [ " val " ]) $n = lang ( 238 ); else { $I = true ; $za = 0 ; foreach ( $_POST [ " val " ] as $Fh => $K ){ $O = array (); foreach ( $K
as $x => $X ){ $x = bracket_escape ( $x , 1 ); $O [ idf_escape ( $x )] = ( preg_match ( '~char|text~' , $p [ $x ][ " type " ]) || $X != " " ? $b -> processInput ( $p [ $x ], $X ) : " NULL " );} $I = $Wb -> update ( $a , $O , " WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $Fh , $p ), ! ( $Ad || $Hh === array ()), " " ); if ( ! $I ) break ; $za += $h -> affected_rows ;} queries_redirect ( remove_from_uri (), lang ( 237 , $za ), $I );}} elseif ( ! is_string ( $Hc = get_file ( " csv_file " , true ))) $n = upload_error ( $Hc ); elseif ( ! preg_match ( '~~u' , $Hc )) $n = lang ( 239 ); else { cookie ( " adminer_import " , " output= " . urlencode ( $ya [ " output " ]) . " &format= " . urlencode ( $_POST [ " separator " ])); $I = true ; $ob = array_keys ( $p ); preg_match_all ( '~(?>"[^"]*"|[^"\\r\\n]+)+~' , $Hc , $ee ); $za = count ( $ee [ 0 ]); $Wb -> begin (); $vg = ( $_POST [ " separator " ] == " csv " ? " , " : ( $_POST [ " separator " ] == " tsv " ? " \t " : " ; " )); $L = array (); foreach ( $ee [ 0 ] as $x => $X ){ preg_match_all ( " ~((?> \" [^ \" ]* \" )+|[^ $vg ]*) $vg ~ " , $X . $vg , $fe ); if ( ! $x &&! array_diff ( $fe [ 1 ], $ob )){ $ob = $fe [ 1 ]; $za -- ;} else { $O = array (); foreach ( $fe [ 1 ] as $s => $lb ) $O [ idf_escape ( $ob [ $s ])] = ( $lb == " " && $p [ $ob [ $s ]][ " null " ] ? " NULL " : q ( str_replace ( '""' , '"' , preg_replace ( '~^"|"$~' , '' , $lb )))); $L [] = $O ;}} $I = ( ! $L || $Wb -> insertUpdate ( $a , $L , $Cf )); if ( $I ) $Wb -> commit (); queries_redirect ( remove_from_uri ( " page " ), lang ( 240 , $za ), $I ); $Wb -> rollback ();}}} $Tg = $b -> tableName ( $R ); if ( is_ajax ()){ page_headers (); ob_start ();} else
page_header ( lang ( 44 ) . " : $Tg " , $n ); $O = null ; if ( isset ( $gg [ " insert " ]) ||! support ( " table " )){ $O = " " ; foreach (( array ) $_GET [ " where " ] as $X ){ if ( count ( $Oc [ $X [ " col " ]]) == 1 && ( $X [ " op " ] == " = " || ( ! $X [ " op " ] &&! preg_match ( '~[_%]~' , $X [ " val " ])))) $O .= " &set " . urlencode ( " [ " . bracket_escape ( $X [ " col " ]) . " ] " ) . " = " . urlencode ( $X [ " val " ]);}} $b -> selectLinks ( $R , $O ); if ( ! $f && support ( " table " )) echo " <p class='error'> " . lang ( 241 ) . ( $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 , $f ); $b -> selectSearchPrint ( $Z , $f , $v ); $b -> selectOrderPrint ( $Xe , $f , $v ); $b -> selectLimitPrint ( $z ); $b -> selectLengthPrint ( $hh ); $b -> selectActionPrint ( $v ); echo " </form> \n " ; $E = $_GET [ " page " ]; if ( $E == " last " ){ $Rc = $h -> result ( count_rows ( $a , $Z , $Ad , $Xc )); $E = floor ( max ( 0 , $Rc - 1 ) / $z );} $sg = $M ; if ( ! $sg ){ $sg [] = " * " ; if ( $He ) $sg [] = $He ;} $zb = convert_fields ( $f , $p , $M ); if ( $zb ) $sg [] = substr ( $zb , 2 ); $I = $Wb -> select ( $a , $sg , $Z , $Xc , $Xe , $z , $E , true ); if ( ! $I ) echo " <p class='error'> " . error () . " \n " ; else { if ( $w == " mssql " && $E ) $I -> seek ( $z * $E ); $lc = array (); echo " <form action='' method='post' enctype='multipart/form-data'> \n " ; $L = array (); while ( $K = $I -> fetch_assoc ()){ if ( $E && $w == " oracle " ) unset ( $K [ " RNUM " ]); $L [] = $K ;} if ( $_GET [ " page " ] != " last " &&+ $z && $Xc && $Ad && $w == " sql " ) $Rc = $h -> result ( " SELECT FOUND_ROWS() " ); if ( ! $L ) echo " <p class='message'> " . lang ( 12 ) . " \n " ; else { $Pa = $b -> backwardKeys ( $a , $Tg ); echo " <table id='table' cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);' onkeydown='return editingKeydown(event);'> \n " , " <thead><tr> " . ( ! $Xc && $M ? " " : " <td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href=' " . h ( $_GET [ " modify " ] ? remove_from_uri ( " modify " ) : $_SERVER [ " REQUEST_URI " ] . " &modify=1 " ) . " '> " . lang ( 242 ) . " </a> " ); $ye = array (); $Uc = array (); reset ( $M ); $Qf = 1 ; foreach ( $L [ 0 ] as $x => $X ){ if ( $x != $He ){ $X = $_GET [ " columns " ][ key ( $M )]; $o = $p [ $M ? ( $X ? $X [ " col " ] : current ( $M )) : $x ]; $C = ( $o ? $b -> fieldName ( $o , $Qf ) : ( $X [ " fun " ] ? " * " : $x )); if ( $C != " " ){ $Qf ++ ; $ye [ $x ] = $C ; $e = idf_escape ( $x ); $id = remove_from_uri ( '(order|desc)[^=]*|page' ) . '&order%5B0%5D=' . urlencode ( $x ); $Ob = " &desc%5B0%5D=1 " ; echo '<th onmouseover="columnMouse(this);" onmouseout="columnMouse(this, \' hidden\');">' , '<a href="' . h ( $id . ( $Xe [ 0 ] == $e || $Xe [ 0 ] == $x || ( ! $Xe && $Ad && $Xc [ 0 ] == $e ) ? $Ob : '' )) . '">' ; echo
apply_sql_function ( $X [ " fun " ], $C ) . " </a> " ; echo " <span class='column hidden'> " , " <a href=' " . h ( $id . $Ob ) . " ' title=' " . lang ( 50 ) . " ' class='text'> ↓</a> " ; if ( ! $X [ " fun " ]) echo '<a href="#fieldset-search" onclick="selectSearch(\'' . h ( js_escape ( $x )) . '\'); return false;" title="' . lang ( 47 ) . '" class="text jsonly"> =</a>' ; echo " </span> " ;} $Uc [ $x ] = $X [ " fun " ]; next ( $M );}} $Wd = array (); if ( $_GET [ " modify " ]){ foreach ( $L
2014-04-01 18:00:42 +00:00
as $K ){ foreach ( $K
2015-04-01 06:36:56 +00:00
as $x => $X ) $Wd [ $x ] = max ( $Wd [ $x ], min ( 40 , strlen ( utf8_decode ( $X ))));}} echo ( $Pa ? " <th> " . lang ( 243 ) : " " ) . " </thead> \n " ; if ( is_ajax ()){ if ( $z % 2 == 1 && $E % 2 == 1 ) odd (); ob_end_clean ();} foreach ( $b -> rowDescriptions ( $L , $Oc ) as $xe => $K ){ $Eh = unique_array ( $L [ $xe ], $v ); if ( ! $Eh ){ $Eh = array (); foreach ( $L [ $xe ] as $x => $X ){ if ( ! preg_match ( '~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~' , $x )) $Eh [ $x ] = $X ;}} $Fh = " " ; foreach ( $Eh
as $x => $X ){ if (( $w == " sql " || $w == " pgsql " ) && strlen ( $X ) > 64 ){ $x = ( strpos ( $x , '(' ) ? $x : idf_escape ( $x )); $x = " MD5( " . ( $w == 'sql' && preg_match ( " ~^utf8_~ " , $p [ $x ][ " collation " ]) ? $x : " CONVERT( $x USING " . charset ( $h ) . " ) " ) . " ) " ; $X = md5 ( $X );} $Fh .= " & " . ( $X !== null ? urlencode ( " where[ " . bracket_escape ( $x ) . " ] " ) . " = " . urlencode ( $X ) : " null%5B%5D= " . urlencode ( $x ));} echo " <tr " . odd () . " > " . ( ! $Xc && $M ? " " : " <td> " . checkbox ( " check[] " , substr ( $Fh , 1 ), in_array ( substr ( $Fh , 1 ),( array ) $_POST [ " check " ]), " " , " this.form['all'].checked = false; formUncheck('all-page'); " ) . ( $Ad || information_schema ( DB ) ? " " : " <a href=' " . h ( ME . " edit= " . urlencode ( $a ) . $Fh ) . " '> " . lang ( 244 ) . " </a> " )); foreach ( $K
as $x => $X ){ if ( isset ( $ye [ $x ])){ $o = $p [ $x ]; if ( $X != " " && ( ! isset ( $lc [ $x ]) || $lc [ $x ] != " " )) $lc [ $x ] = ( is_mail ( $X ) ? $ye [ $x ] : " " ); $_ = " " ; if ( preg_match ( '~blob|bytea|raw|file~' , $o [ " type " ]) && $X != " " ) $_ = ME . 'download=' . urlencode ( $a ) . '&field=' . urlencode ( $x ) . $Fh ; if ( ! $_ && $X !== null ){ foreach (( array ) $Oc [ $x ] as $q ){ if ( count ( $Oc [ $x ]) == 1 || end ( $q [ " source " ]) == $x ){ $_ = " " ; foreach ( $q [ " source " ] as $s => $Dg ) $_ .= where_link ( $s , $q [ " target " ][ $s ], $L [ $xe ][ $Dg ]); $_ = ( $q [ " db " ] != " " ? preg_replace ( '~([?&]db=)[^&]+~' , '\\1' . urlencode ( $q [ " db " ]), ME ) : ME ) . 'select=' . urlencode ( $q [ " table " ]) . $_ ; if ( count ( $q [ " source " ]) == 1 ) break ;}}} if ( $x == " COUNT(*) " ){ $_ = ME . " select= " . urlencode ( $a ); $s = 0 ; foreach (( array ) $_GET [ " where " ] as $W ){ if ( ! array_key_exists ( $W [ " col " ], $Eh )) $_ .= where_link ( $s ++ , $W [ " col " ], $W [ " val " ], $W [ " op " ]);} foreach ( $Eh
as $Gd => $W ) $_ .= where_link ( $s ++ , $Gd , $W );} $X = select_value ( $X , $_ , $o , $hh ); $jd = h ( " val[ $Fh ][ " . bracket_escape ( $x ) . " ] " ); $Y = $_POST [ " val " ][ $Fh ][ bracket_escape ( $x )]; $gc =! is_array ( $K [ $x ]) && is_utf8 ( $X ) && $L [ $xe ][ $x ] == $K [ $x ] &&! $Uc [ $x ]; $gh = preg_match ( '~text|lob~' , $o [ " type " ]); if (( $_GET [ " modify " ] && $gc ) || $Y !== null ){ $ad = h ( $Y !== null ? $Y : $K [ $x ]); echo " <td> " . ( $gh ? " <textarea name=' $jd ' cols='30' rows=' " . ( substr_count ( $K [ $x ], " \n " ) + 1 ) . " '> $ad </textarea> " : " <input name=' $jd ' value=' $ad ' size=' $Wd[$x] '> " );} else { $be = strpos ( $X , " <i>...</i> " ); echo " <td id=' $jd ' onclick= \" selectClick(this, event, " . ( $be ? 2 : ( $gh ? 1 : 0 )) . ( $gc ? " " : " , ' " . h ( lang ( 245 )) . " ' " ) . " ); \" > $X " ;}}} if ( $Pa ) echo " <td> " ; $b -> backwardKeysPrint ( $Pa , $L [ $xe ]); echo " </tr> \n " ;} if ( is_ajax ()) exit ; echo " </table> \n " ;} if (( $L || $E ) &&! is_ajax ()){ $vc = true ; if ( $_GET [ " page " ] != " last " ){ if ( !+ $z ) $Rc = count ( $L ); elseif ( $w != " sql " ||! $Ad ){ $Rc = ( $Ad ? false : found_rows ( $R , $Z )); if ( $Rc < max ( 1e4 , 2 * ( $E + 1 ) * $z )) $Rc = reset ( slow_query ( count_rows ( $a , $Z , $Ad , $Xc ))); else $vc = false ;}} if ( + $z && ( $Rc === false || $Rc > $z || $E )){ echo " <p class='pages'> " ; $he = ( $Rc === false ? $E + ( count ( $L ) >= $z ? 2 : 1 ) : floor (( $Rc - 1 ) / $z )); if ( $w != " simpledb " ){ echo '<a href="' . h ( remove_from_uri ( " page " )) . " \" onclick= \" pageClick(this.href, +prompt(' " . lang ( 246 ) . " ', ' " . ( $E + 1 ) . " '), event); return false; \" > " . lang ( 246 ) . " </a>: " , pagination ( 0 , $E ) . ( $E > 5 ? " ... " : " " ); for ( $s = max ( 1 , $E - 4 ); $s < min ( $he , $E + 5 ); $s ++ ) echo
pagination ( $s , $E ); if ( $he > 0 ){ echo ( $E + 5 < $he ? " ... " : " " ),( $vc && $Rc !== false ? pagination ( $he , $E ) : " <a href=' " . h ( remove_from_uri ( " page " ) . " &page=last " ) . " ' title='~ $he '> " . lang ( 247 ) . " </a> " );} echo (( $Rc === false ? count ( $L ) + 1 : $Rc - $E * $z ) > $z ? ' <a href="' . h ( remove_from_uri ( " page " ) . " &page= " . ( $E + 1 )) . '" onclick="return !selectLoadMore(this, ' . ( + $z ) . ', \'' . lang ( 248 ) . '...\');" class="loadmore">' . lang ( 249 ) . '</a>' : '' );} else { echo
lang ( 246 ) . " : " , pagination ( 0 , $E ) . ( $E > 1 ? " ... " : " " ),( $E ? pagination ( $E , $E ) : " " ),( $he > $E ? pagination ( $E + 1 , $E ) . ( $he > $E + 1 ? " ... " : " " ) : " " );}} echo " <p class='count'> \n " ,( $Rc !== false ? " ( " . ( $vc ? " " : " ~ " ) . lang ( 138 , $Rc ) . " ) " : " " ); $Tb = ( $vc ? " " : " ~ " ) . $Rc ; echo
checkbox ( " all " , 1 , 0 , lang ( 250 ), " var checked = formChecked(this, /check/); selectCount('selected', this.checked ? ' $Tb ' : checked); selectCount('selected2', this.checked || !checked ? ' $Tb ' : checked); " ) . " \n " ; if ( $b -> selectCommandPrint ()){ echo '<fieldset' ,( $_GET [ " modify " ] ? '' : ' class="jsonly"' ), '><legend>' , lang ( 242 ), ' </ legend >< div >
< input type = " submit " value = " ',lang(14),' " ',($_GET["modify"]?' ':' title = " '.lang(238).' " '),' >
2014-04-01 18:00:42 +00:00
</ div ></ fieldset >
2015-04-01 06:36:56 +00:00
< fieldset >< legend > ',lang(115),' < span id = " selected " ></ span ></ legend >< div >
< input type = " submit " name = " edit " value = " ',lang(10),' " >
< input type = " submit " name = " clone " value = " ',lang(234),' " >
< input type = " submit " name = " delete " value = " ',lang(18),' " ',confirm(),' >
2014-04-01 18:00:42 +00:00
</ div ></ fieldset >
2015-04-01 06:36:56 +00:00
';}$Pc=$b->dumpFormat();foreach((array)$_GET["columns"]as$e){if($e["fun"]){unset($Pc[' sql ']);break;}}if($Pc){print_fieldset("export",lang(65)." <span id=' selected2 '></span>");$hf=$b->dumpOutput();echo($hf?html_select("output",$hf,$ya["output"])." ":""),html_select("format",$Pc,$ya["format"])," <input type=' submit ' name=' export ' value=' " .lang(65). " '>\n","</div></fieldset>\n";}echo(!$Xc&&$M?"":"<script type=' text / javascript '>tableCheck();</script>\n");}if($b->selectImportPrint()){print_fieldset("import",lang(64),!$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(64). " '>","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($lc,' strlen '),$f);echo"<p><input type=' hidden ' name=' token ' value=' $T '></p>\n","</form>\n";}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$Ig=isset($_GET["status"]);page_header($Ig?lang(107):lang(106));$Uh=($Ig?show_status():show_variables());if(!$Uh)echo"<p class=' message '>".lang(12)."\n";else{echo"<table cellspacing=' 0 ' > \n " ;foreach( $Uh
as $x => $X ){ echo " <tr> " , " <th><code class='jush- " . $w . ( $Ig ? " status " : " set " ) . " '> " . h ( $x ) . " </code> " , " <td> " . nbsp ( $X );} echo " </table> \n " ;}} elseif ( isset ( $_GET [ " script " ])){ header ( " Content-Type: text/javascript; charset=utf-8 " ); if ( $_GET [ " script " ] == " db " ){ $Qg = array ( " Data_length " => 0 , " Index_length " => 0 , " Data_free " => 0 ); foreach ( table_status () as $C => $R ){ json_row ( " Comment- $C " , nbsp ( $R [ " Comment " ])); if ( ! is_view ( $R )){ foreach ( array ( " Engine " , " Collation " ) as $x ) json_row ( " $x - $C " , nbsp ( $R [ $x ])); foreach ( $Qg + array ( " Auto_increment " => 0 , " Rows " => 0 ) as $x => $X ){ if ( $R [ $x ] != " " ){ $X = format_number ( $R [ $x ]); json_row ( " $x - $C " ,( $x == " Rows " && $X && $R [ " Engine " ] == ( $Fg == " pgsql " ? " table " : " InnoDB " ) ? " ~ $X " : $X )); if ( isset ( $Qg [ $x ])) $Qg [ $x ] += ( $R [ " Engine " ] != " InnoDB " || $x != " Data_free " ? $R [ $x ] : 0 );} elseif ( array_key_exists ( $x , $R )) json_row ( " $x - $C " );}}} foreach ( $Qg
as $x => $X ) json_row ( " sum- $x " , format_number ( $X )); json_row ( " " );} elseif ( $_GET [ " script " ] == " kill " ) $h -> query ( " KILL " . number ( $_POST [ " kill " ])); else { foreach ( count_tables ( $b -> databases ()) as $m => $X ){ json_row ( " tables- $m " , $X ); json_row ( " size- $m " , db_size ( $m ));} json_row ( " " );} exit ;} else { $Zg = array_merge (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ]); if ( $Zg &&! $n &&! $_POST [ " search " ]){ $I = true ; $me = " " ; if ( $w == " sql " && count ( $_POST [ " tables " ]) > 1 && ( $_POST [ " drop " ] || $_POST [ " truncate " ] || $_POST [ " copy " ])) queries ( " SET foreign_key_checks = 0 " ); if ( $_POST [ " truncate " ]){ if ( $_POST [ " tables " ]) $I = truncate_tables ( $_POST [ " tables " ]); $me = lang ( 251 );} elseif ( $_POST [ " move " ]){ $I = move_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $me = lang ( 252 );} elseif ( $_POST [ " copy " ]){ $I = copy_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $me = lang ( 253 );} elseif ( $_POST [ " drop " ]){ if ( $_POST [ " views " ]) $I = drop_views ( $_POST [ " views " ]); if ( $I && $_POST [ " tables " ]) $I = drop_tables ( $_POST [ " tables " ]); $me = lang ( 254 );} elseif ( $w != " sql " ){ $I = ( $w == " sqlite " ? queries ( " VACUUM " ) : apply_queries ( " VACUUM " . ( $_POST [ " optimize " ] ? " " : " ANALYZE " ), $_POST [ " tables " ])); $me = lang ( 255 );} elseif ( ! $_POST [ " tables " ]) $me = 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 ()) $me .= " <b> " . h ( $K [ " Table " ]) . " </b>: " . h ( $K [ " Msg_text " ]) . " <br> " ;} queries_redirect ( substr ( ME , 0 , - 1 ), $me , $I );} page_header (( $_GET [ " ns " ] == " " ? lang ( 35 ) . " : " . h ( DB ) : lang ( 68 ) . " : " . h ( $_GET [ " ns " ])), $n , true ); if ( $b -> homepage ()){ if ( $_GET [ " ns " ] !== " " ){ echo " <h3 id='tables-views'> " . lang ( 256 ) . " </h3> \n " ; $Yg = tables_list (); if ( ! $Yg ) echo " <p class='message'> " . lang ( 9 ) . " \n " ; else { echo " <form action='' method='post'> \n " ; if ( support ( " table " )){ echo " <fieldset><legend> " . lang ( 257 ) . " <span id='selected2'></span></legend><div> " , " <input type='search' name='query' value=' " . h ( $_POST [ " query " ]) . " '> <input type='submit' name='search' value=' " . lang ( 47 ) . " '> \n " , " </div></fieldset> \n " ; if ( $_POST [ " search " ] && $_POST [ " query " ] != " " ) search_tables ();} 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)\[/);">' ; $Ub = doc_link ( array ( 'sql' => 'show-table-status.html' )); echo '<th>' . lang ( 119 ), '<td>' . lang ( 258 ) . doc_link ( array ( 'sql' => 'storage-engines.html' )), '<td>' . lang ( 111 ) . doc_link ( array ( 'sql' => 'charset-mysql.html' )), '<td>' . lang ( 259 ) . $Ub , '<td>' . lang ( 260 ) . $Ub , '<td>' . lang ( 261 ) . $Ub , '<td>' . lang ( 56 ) . doc_link ( array ( 'sql' => 'example-auto-increment.html' )), '<td>' . lang ( 262 ) . $Ub ,( support ( " comment " ) ? '<td>' . lang ( 96 ) . $Ub : '' ), " </thead> \n " ; $S = 0 ; foreach ( $Yg
as $C => $U ){ $Xh = ( $U !== null &&! preg_match ( '~table~i' , $U )); echo '<tr' . odd () . '><td>' . checkbox (( $Xh ? " views[] " : " tables[] " ), $C , in_array ( $C , $Zg , true ), " " , " formUncheck('check-all'); " ), '<th>' . ( support ( " table " ) || support ( " indexes " ) ? '<a href="' . h ( ME ) . 'table=' . urlencode ( $C ) . '" title="' . lang ( 39 ) . '">' . h ( $C ) . '</a>' : h ( $C )); if ( $Xh ){ echo '<td colspan="6"><a href="' . h ( ME ) . " view= " . urlencode ( $C ) . '" title="' . lang ( 40 ) . '">' . ( preg_match ( '~materialized~i' , $U ) ? lang ( 263 ) : lang ( 118 )) . '</a>' , '<td align="right"><a href="' . h ( ME ) . " select= " . urlencode ( $C ) . '" title="' . lang ( 38 ) . '">?</a>' ;} else { foreach ( array ( " Engine " => array (), " Collation " => array (), " Data_length " => array ( " create " , lang ( 41 )), " Index_length " => array ( " indexes " , lang ( 122 )), " Data_free " => array ( " edit " , lang ( 42 )), " Auto_increment " => array ( " auto_increment=1&create " , lang ( 41 )), " Rows " => array ( " select " , lang ( 38 )),) as $x => $_ ){ $jd = " id=' $x - " . h ( $C ) . " ' " ; echo ( $_ ? " <td align='right'> " . ( support ( " table " ) || $x == " Rows " || ( support ( " indexes " ) && $x != " Data_length " ) ? " <a href=' " . h ( ME . " $_[0] = " ) . urlencode ( $C ) . " ' $jd title=' $_[1] '>?</a> " : " <span $jd >?</span> " ) : " <td id=' $x - " . h ( $C ) . " '> " );} $S ++ ;} echo ( support ( " comment " ) ? " <td id='Comment- " . h ( $C ) . " '> " : " " );} echo " <tr><td> <th> " . lang ( 235 , count ( $Yg )), " <td> " . nbsp ( $w == " sql " ? $h -> result ( " SELECT @@storage_engine " ) : " " ), " <td> " . nbsp ( db_collation ( DB , collations ())); foreach ( array ( " Data_length " , " Index_length " , " Data_free " ) as $x ) echo " <td align='right' id='sum- $x '> " ; echo " </table> \n " ; if ( ! information_schema ( DB )){ $Rh = " <input type='submit' value=' " . lang ( 264 ) . " ' " . on_help ( " 'VACUUM' " ) . " > " ; $Te = " <input type='submit' name='optimize' value=' " . lang ( 265 ) . " ' " . on_help ( $w == " sql " ? " 'OPTIMIZE TABLE' " : " 'VACUUM OPTIMIZE' " ) . " > " ; echo " <fieldset><legend> " . lang ( 115 ) . " <span id='selected'></span></legend><div> " . ( $w == " sqlite " ? $Rh : ( $w == " pgsql " ? $Rh . $Te : ( $w == " sql " ? " <input type='submit' value=' " . lang ( 266 ) . " ' " . on_help ( " 'ANALYZE TABLE' " ) . " > " . $Te . " <input type='submit' name='check' value=' " . lang ( 267 ) . " ' " . on_help ( " 'CHECK TABLE' " ) . " > " . " <input type='submit' name='repair' value=' " . lang ( 268 ) . " ' " . on_help ( " 'REPAIR TABLE' " ) . " > " : " " ))) . " <input type='submit' name='truncate' value=' " . lang ( 269 ) . " ' " . confirm () . on_help ( $w == " sqlite " ? " 'DELETE' " : " 'TRUNCATE " . ( $w == " pgsql " ? " ' " : " TABLE' " )) . " > " . " <input type='submit' name='drop' value=' " . lang ( 116 ) . " ' " . confirm () . on_help ( " 'DROP TABLE' " ) . " > \n " ; $l = ( support ( " scheme " ) ? $b -> schemas () : $b -> databases ()); if ( count ( $l ) != 1 && $w != " sqlite " ){ $m = ( isset ( $_POST [ " target " ]) ? $_POST [ " target " ] : ( support ( " scheme " ) ? $_GET [ " ns " ] : DB )); echo " <p> " . lang ( 270 ) . " : " ,( $l ? html_select ( " target " , $l , $m ) : '<input name="target" value="' . h ( $m ) . '" autocapitalize="off">' ), " <input type='submit' name='move' value=' " . lang ( 271 ) . " '> " ,( support ( " copy " ) ? " <input type='submit' name='copy' value=' " . lang ( 272 ) . " '> " : " " ), " \n " ;} echo " <input type='hidden' name='all' value='' onclick= \" selectCount('selected', formChecked(this, /^(tables|views) \ [/)); " . ( support ( " table " ) ? " selectCount('selected2', formChecked(this, /^tables \ [/) || $S ); " : " " ) . " \" > \n " ; echo " <input type='hidden' name='token' value=' $T '> \n " , " </div></fieldset> \n " ;} echo " </form> \n " , " <script type='text/javascript'>tableCheck();</script> \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'create=">' . lang ( 66 ) . " </a> \n " ,( support ( " view " ) ? '<a href="' . h ( ME ) . 'view=">' . lang ( 192 ) . " </a> \n " : " " ),( support ( " materializedview " ) ? '<a href="' . h ( ME ) . 'view=&materialized=1">' . lang ( 273 ) . " </a> \n " : " " ); if ( support ( " routine " )){ echo " <h3 id='routines'> " . lang ( 132 ) . " </h3> \n " ; $kg = routines (); if ( $kg ){ echo " <table cellspacing='0'> \n " , '<thead><tr><th>' . lang ( 170 ) . '<td>' . lang ( 92 ) . '<td>' . lang ( 209 ) . " <td> </thead> \n " ; odd ( '' ); foreach ( $kg
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 ( 125 ) . " </a> " ;} echo " </table> \n " ;} echo '<p class="links">' . ( support ( " procedure " ) ? '<a href="' . h ( ME ) . 'procedure=">' . lang ( 208 ) . '</a>' : '' ) . '<a href="' . h ( ME ) . 'function=">' . lang ( 207 ) . " </a> \n " ;} if ( support ( " sequence " )){ echo " <h3 id='sequences'> " . lang ( 274 ) . " </h3> \n " ; $wg = get_vals ( " SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name " ); if ( $wg ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 170 ) . " </thead> \n " ; odd ( '' ); foreach ( $wg
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 ( 214 ) . " </a> \n " ;} if ( support ( " type " )){ echo " <h3 id='user-types'> " . lang ( 23 ) . " </h3> \n " ; $Ph = types (); if ( $Ph ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 170 ) . " </thead> \n " ; odd ( '' ); foreach ( $Ph
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 ( 218 ) . " </a> \n " ;} if ( support ( " event " )){ echo " <h3 id='events'> " . lang ( 133 ) . " </h3> \n " ; $L = get_rows ( " SHOW EVENTS " ); if ( $L ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 170 ) . " <td> " . lang ( 275 ) . " <td> " . lang ( 198 ) . " <td> " . lang ( 199 ) . " <td></thead> \n " ; foreach ( $L
as $K ){ echo " <tr> " , " <th> " . h ( $K [ " Name " ]), " <td> " . ( $K [ " Execute at " ] ? lang ( 276 ) . " <td> " . $K [ " Execute at " ] : lang ( 200 ) . " " . $K [ " Interval value " ] . " " . $K [ " Interval field " ] . " <td> $K[Starts] " ), " <td> $K[Ends] " , '<td><a href="' . h ( ME ) . 'event=' . urlencode ( $K [ " Name " ]) . '">' . lang ( 125 ) . '</a>' ;} echo " </table> \n " ; $tc = $h -> result ( " SELECT @@event_scheduler " ); if ( $tc && $tc != " ON " ) echo " <p class='error'><code class='jush-sqlset'>event_scheduler</code>: " . h ( $tc ) . " \n " ;} echo '<p class="links"><a href="' . h ( ME ) . 'event=">' . lang ( 197 ) . " </a> \n " ;} if ( $Yg ) echo " <script type='text/javascript'>ajaxSetHtml(' " . js_escape ( ME ) . " script=db');</script> \n " ;}}} page_footer ();