2012-06-04 16:58:40 +02:00
< ? php
//customization - begin
//includes
include " root.php " ;
2013-07-06 08:03:27 +02:00
require_once " resources/require.php " ;
2013-07-06 07:50:55 +02:00
require_once " resources/check_auth.php " ;
2012-06-04 16:58:40 +02:00
//only allow users in the superadmin group to use this feature
if ( if_group ( " superadmin " )) {
//echo "access granted";
}
else {
echo " access denied " ;
exit ;
}
//customization - end
/** 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 )
2013-07-27 17:43:34 +02:00
* @ version 3.7 . 1
*/ error_reporting ( 6135 ); $qc =! ereg ( '^(unsafe_raw)?$' , ini_get ( " filter.default " )); if ( $qc || ini_get ( " filter.default_flags " )){ foreach ( array ( '_GET' , '_POST' , '_COOKIE' , '_SERVER' ) as $X ){ $Ig = filter_input_array ( constant ( " INPUT $X " ), FILTER_UNSAFE_RAW ); if ( $Ig ) $$X = $Ig ;}} 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
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
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> <C3A9> a<1D> '3I<33> <49> d<EFBFBD> <64> !S<13> <> <EFBFBD> :4<1B> <> +Md<4D> g<EFBFBD> <67> <EFBFBD> ǃ <EFBFBD> <C783> <EFBFBD> t<16> <0C> c<EFBFBD> <63> <1B> <> <EFBFBD> <EFBFBD> <EFBFBD> b { <EFBFBD> H(Ɠєt1<1A> )t<> }F<> p0<70> <0C> 8<> \\ 82<EFBFBD> D L><13> 9 `'C<> <43> ۗ8 89<38> <39> <11> xQ<78> <51> \0 <EFBFBD> e4<EFBFBD> <EFBFBD> Qʘl<1D> <> P<EFBFBD> <50> V<11> <> b<EFBFBD> <62> <19> <> T4<0C> \\ <EFBFBD> W/<2F> <12> <> <EFBFBD> \n <EFBFBD> <EFBFBD> ` 7\" h<> q<EFBFBD> <1D> 4ZM6<4D> T<EFBFBD> \r <EFBFBD> r\\ <EFBFBD> <EFBFBD> C{ h<EFBFBD> 7 \r <EFBFBD> x67<EFBFBD> <1A> <> J<EFBFBD> <18> 2.3<EFBFBD> <EFBFBD> 9<EFBFBD> K<EFBFBD> <EFBFBD> <EFBFBD> H<EFBFBD> ,<2C> !m<12> Ɔo\$ <EFBFBD> <EFBFBD> .[\r &<26> # \$ <EFBFBD> <<3C> <> f<EFBFBD> )<29> Z<EFBFBD> \0 =<3D> r<EFBFBD> <72> 9<EFBFBD> <39> jΪJ<CEAA> <4A> 0<EFBFBD> c,|<7C> =<3D> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <01> Rs_ 6<> <36> ݷ<> <DDB7> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> Z6<0C> 2B<18> p \\ -<2D> 1s 2<> <1B> ><3E> <> X:\r ܺ<> <DCBA> 3<EFBFBD> b<EFBFBD> <62> <12> <> -8SL<53> <02> <> <EFBFBD> <EFBFBD> K.<02> <> -<18> ҥ\r H@ ml<6D> :<3A> <10> <> ;<3B> <> <EFBFBD> <16> <> J<EFBFBD> 0LR<10> 2<EFBFBD> !<04> <> <0C> <> A<0C> <> <EFBFBD> 2<EFBFBD> m<18> <> <EFBFBD> 0eI<05> <> -:U \r <EFBFBD> <EFBFBD> 9<EFBFBD> <EFBFBD> MWL<EFBFBD> 0<EFBFBD> <EFBFBD> GcJv2(<28> <> F9<46> `<60> <<3C> J<EFBFBD> 7+˚~<7E> <> <EFBFBD> }D J<> <4A> HW<48> SN<53> <4E> <EFBFBD> e<EFBFBD> u]1̥(O<> LЪ <l<> <6C> R[u&<26> <> H<EFBFBD> 3<EFBFBD> v<EFBFBD> <76> <EFBFBD> <EFBFBD> U<EFBFBD> t6<74> <36> \$ <EFBFBD> 6<0C> <> <EFBFBD> X\" <EFBFBD> <<05> <> }: O<> <4F> <3x<33> O<14> 8<EFBFBD> <38> ><3E> <> <14> <> C<EFBFBD> <43> <16> 1<EFBFBD> <31> <02> <> HR<48> <52> <EFBFBD> S<EFBFBD> d<EFBFBD> 9<> <39> <EFBFBD> %<25> U1<55> Sn<53> a|.<2E> ԁ `<03> <> 8<0E> <> <EFBFBD> : #<23> <> <1E> C<08> 2<EFBFBD> <32> *[o<> <15> 4X~<7E> 7j<03> \\ <EFBFBD> <0C> <08> 6/<2F> 09<30> \r <08> ;<3B> <> ;V<> <56> n<EFBFBD> n<EFBFBD> <05> <> މ v<> <76> k<EFBFBD> HB%<25> .k\" ><3E> <> [<5B> <> \n <EFBFBD> <EFBFBD> <EFBFBD> l<1B> <> p<EFBFBD> 9<EFBFBD> cF Z<05> s<15> <> |<7C> >6 <20> 5<EFBFBD> l1V<31> <01> ΐ<> 6<EFBFBD> <36> <EFBFBD> <EFBFBD> 7<EFBFBD> <37> :<3A> \" Az<EFBFBD> <EFBFBD> de<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \\ <EFBFBD> 5*<2A> մ<EFBFBD> <D5B4> ]<5D> p[*<2A> Am)Kt[<5B> \n 8g= ;<3B> <> <14> 2z<32> <7A> <EFBFBD> |<7C> <> <EFBFBD> ̣4<15> t8.<2E> <07> <> N#<23> ʲ<EFBFBD> <CAB2> B \" <EFBFBD> 9<EFBFBD> <EFBFBD> <EFBFBD> %<25> <> <EFBFBD> <EFBFBD> HQw<0C> qd<71> <64> F<19> <> <EFBFBD> <EFBFBD> \$ &V<> <56> Q #<23> Q '<27> <> <EFBFBD> _<EFBFBD> m<0C> ̡<EFBFBD> <CCA1> <0E> <> <EFBFBD> \r <EFBFBD> <11> <> h<10> Xrt0j 5<> <35> <EFBFBD> <0F> <> W<EFBFBD> <57> <EFBFBD> 4<EFBFBD> <34> <EFBFBD> ד<EFBFBD> m<> <6D> <EFBFBD> <EFBFBD> \" CA<EFBFBD> F!<21> 엖h><3E> b 0<> 0<EFBFBD> 7;8<> 4K a<7F> <61> <14> \0 <01> p a<16> <> <EFBFBD> HXF<06> <> 1:<3A> 8<EFBFBD> U9 H<> <48> Ió<1A> ;<3B> sQ<73> 7F<37> <46> cLpXM @e<> <65> <EFBFBD> <EFBFBD> <1A> 吞+g(<28> <01> 73O<33> 3 p<> <70> <EFBFBD> b<EFBFBD> lEE><1C> Chb%<25> D<EFBFBD> I8<49> <38> E'<27> #)<29> =%C<> <43> j<EFBFBD> Y<EFBFBD> 1<EFBFBD> <31> y<EFBFBD> h;cA<63> <41> 6<EFBFBD> j K<> \r <EFBFBD> <EFBFBD> <EFBFBD> 9 <EFBFBD> \$ |<7C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> g-Z<> o<EFBFBD> \0 <EFBFBD> <EFBFBD> <EFBFBD> z<EFBFBD> <EFBFBD> <EFBFBD> \$ +D<01> <> <EFBFBD> V<> w*<2A> W<> <57> p<EFBFBD> J<03> <> <EFBFBD> \\ <EFBFBD> <EFBFBD> F<> O<EFBFBD> ' ɲa1<61> m,_ڧ\r <EFBFBD> <EFBFBD> 1<EFBFBD> P<EFBFBD> o<19> ;\0 <EFBFBD> 5<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> e\r & 3<06> <> ^ \r <EFBFBD> <EFBFBD> 6<EFBFBD> MR2T\0 <EFBFBD> <EFBFBD> <EFBFBD> 5? ~<08> 5<EFBFBD> <35> <EFBFBD> <EFBFBD> P ><3E> 85 h<03> <> n<EFBFBD> 1;<3B> <> \r RL8`<10> \\ <EFBFBD> <EFBFBD> @<40> <> `;z\n <EFBFBD> \0 <EFBFBD> ԃ8<EFBFBD> <EFBFBD> 9R<EFBFBD> yZ P@<40> ib<69> ?ƭv\$ <EFBFBD> <<3C> % A\r <EFBFBD> ?<3F> \0 <EFBFBD> Sʥ<16> <> <EFBFBD> <EFBFBD> <20> B Þ4JҨ<4A> <D2A8> :<1C> `#Hi <> 7ε<1F> +}<7D> <> <EFBFBD> <EFBFBD> v<EFBFBD> <0E> <> o<EFBFBD> J<EFBFBD> <4A> Vڰ<0E> <> <05> 9<EFBFBD> <39> <EFBFBD> W<EFBFBD> 2<> Q<EFBFBD> \r <EFBFBD> T<> D`<60> <> f<> <66> <20> <> w<EFBFBD> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <0F> I]MKd7*rk*j\n AS<EFBFBD> <08> jF<0E> <> -[ezz<7A> r<EFBFBD> <72> ʁf U<> 3<EFBFBD> <33> ~ \\ <EFBFBD> <EFBFBD> Z<EFBFBD> <EFBFBD> Z<> <06> { )<29> <> > >Ѓ p<> <70> <EFBFBD> *<2A> <> <EFBFBD> <EFBFBD> ;zDb<1D> w<> <77> ]<5D> mC \n <EFBFBD> <EFBFBD> <EFBFBD> 訓<EFBFBD> KB<EFBFBD> <EFBFBD> B<01> <> <EFBFBD> m @<40> <1C> <> <0E> <> ִ><3E> <> <EFBFBD> <EFBFBD> <EFBFBD> wU <55> *N<> (ba<62> ƶ<EFBFBD> @f<> v<EFBFBD> )<29> <> `<60> \0 u<> D)mD@/4<> <34> <EFBFBD> <EFBFBD> 9j<39> <6A> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> HBm1<6D> <31> I<EFBFBD> <49> 5D<35> <44> R uE<75> <45> 9<EFBFBD> <39> Aӗ=1b<31> 0<> <1B> e<EFBFBD> y<EFBFBD> <79> 1<> <31> s<EFBFBD> <73> ;<3B> <> <EFBFBD> <1D> <> <EFBFBD> <1B> <> -<0E> <1C> <> <EFBFBD> <06> ]s<0C> <> 5<EFBFBD> \\ <EFBFBD> <EFBFBD> \n 1;<3B> <> <EFBFBD> <EFBFBD> Q<EFBFBD> ^<5E> <> b<EFBFBD> <62> i<EFBFBD> ;YJ2<4A> d!s<> <06> <> <EFBFBD> #<23> kg<6B> h ށ]<0B> W)>V<> <01> I<EFBFBD> x ]<5D> r<EFBFBD> <72> <EFBFBD> ;6<> JLc pr<0E> <> d { py<EFBFBD> <EFBFBD> M<> <4D> -<0E> UV H<> 5' \n t<EFBFBD> <EFBFBD> в<0E> l<18> <11> <> p H<11> <> <EFBFBD> o<EFBFBD> e<EFBFBD> Z<> Ϩ <EFBFBD> <CFA8> q<EFBFBD> e<EFBFBD> <65> X<EFBFBD> F<EFBFBD> `Gy \r <EFBFBD> <EFBFBD> !<21> <> W w*<18> <0F> <> <EFBFBD> D<EFBFBD> <44> u<EFBFBD> t%<25> <> <EFBFBD> d<EFBFBD> Q<EFBFBD> <51> <EFBFBD> /<2F> p<EFBFBD> :<3A> ih<69> <68> <06> t&<26> <10> <1B> P<EFBFBD> <50> e,J͌<4A> <CD8C> t<01> !<21> O<> 7<EFBFBD> <16> 6<EFBFBD> GgR<1C> <0E> <> C[<5B> <> sk<73> vqU<71> }y<> h<7F> AGV<47> <56> <EFBFBD> <EFBFBD> <EFBFBD> |<7C> lF<6C> ޅL^<5E> .<2E> <> ]u&w<> !<21> <> [jn<03> <> n<EFBFBD> <6E> ڏ[k<> C<EFBFBD> <43> v<EFBFBD> <76> <EFBFBD> <EFBFBD> k<EFBFBD> rmOɭ<4F> <C9AD> J><3E> <> WT<57> 0<EFBFBD> <30> <EFBFBD> <EFBFBD> \n <EFBFBD> pM<EFBFBD> C<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> b<> t<07> <> V G|oy8<79> <38> <EFBFBD> <EFBFBD> <EFBFBD> c<EFBFBD> <08> <> <07> <> " );} elseif ( $_GET [ " file " ] == " functions.js " ){ header ( " Content-Type: text/javascript; charset=utf-8 " ); echo
lzw_decompress ( " f:<3A> <> gCI<43> <49> \n :<1B> <> sa<73> Pi2 \n Ogc <09> e6 L<> <4C> <19> <> e7<05> s)Ћ \r <EFBFBD> <EFBFBD> HG<EFBFBD> I<EFBFBD> <1D> <05> 3a<33> <61> s' c<> <63> D<EFBFBD> i6<69> N<EFBFBD> <4E> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 2H<04> <> 8<EFBFBD> uF<75> R<EFBFBD> #<23> <> <EFBFBD> <EFBFBD> r7<0E> #<23> <> v}<7D> @<40> <> `Q<> <51> o5<6F> a<EFBFBD> I<> <49> ,2 O'8<> R-q:P<> <50> S<EFBFBD> (<28> a<EFBFBD> <61> *w<> (<28> <> %<25> <> p<EFBFBD> <F )<15> nx8<78> zA\" <EFBFBD> Z-C<> e<EFBFBD> V'<1D> <0C> <> <EFBFBD> <EFBFBD> <EFBFBD> s<EFBFBD> <73> q<EFBFBD> <71> ; NF<4E> 1䭲9<E4ADB2> <39> G<EFBFBD> ͦ '0<> \r <EFBFBD> <EFBFBD> <EFBFBD> ȿ<EFBFBD> 9n`<60> р <EFBFBD> X1<58> ݁G3<1E> <> t<EFBFBD> ee9<65> <39> :Ne<4E> <65> <04> N<EFBFBD> <4E> OS<4F> z<> c<EFBFBD> <63> zl<7A> `5<> <35> <EFBFBD> <EFBFBD> <EFBFBD> <09> 3<> <33> y<EFBFBD> <79> 8.<1B> \r <EFBFBD> <EFBFBD> <EFBFBD> <17> P<> <50> \r <03> @<40> <> <EFBFBD> <EFBFBD> \\ 1 \r <EFBFBD> <20> \0 <03> @2 j8ؗ=.<2E> <> <EFBFBD> -r<> á<EFBFBD> <18> 0<EFBFBD> <30> <EFBFBD> Q<0C> ꊺh<EA8ABA> b<EFBFBD> <62> <EFBFBD> <EFBFBD> `<60> <> <EFBFBD> <EFBFBD> ^9<> q<EFBFBD> E!<0C> <20> 7)#<23> <> <EFBFBD> *<2A> <> Q<17> <> <1C> \0 <0E> <> <EFBFBD> 1<0E> <> <EFBFBD> \" <EFBFBD> h<EFBFBD> ><0F> <> <EFBFBD> <14> <> <EFBFBD> <EFBFBD> <EFBFBD> -C \" <0C> <> X<EFBFBD> <58> S`\\ <EFBFBD> <EFBFBD> <03> F֬h8<68> <38> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 3<EFBFBD> <33> `X:O<> <4F> ,<2C> <> <EFBFBD> <EFBFBD> <EFBFBD> )<0C> 8<EFBFBD> <38> <B<> N Ѓ;> 9<> 8<EFBFBD> <38> <EFBFBD> c<EFBFBD> <<3C> # 0L<10> <> <EFBFBD> <EFBFBD> 9<EFBFBD> <39> <0C> ?<3F> (<28> R<EFBFBD> #<01> e=<3D> <> <08> \n <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> :*<2A> <> 0<EFBFBD> D<EFBFBD> <44> 9C<39> <43> <EFBFBD> @<40> <> { ZO<EFBFBD> <EFBFBD> <04> <> 8<EFBFBD> <38> i<EFBFBD> oV<6F> v<EFBFBD> k<7F> Ar<41> 8&<26> <17> <02> <> ..<2E> <18> cH<63> E<EFBFBD> ><04> H_h<04> <> <EFBFBD> <15> WU<57> 5<04> <05> 1<EFBFBD> r*<2A> <> <EFBFBD> <EFBFBD> ^<0C> (<28> b<EFBFBD> xܡY1<59> <31> <EFBFBD> &XH<58> 6<EFBFBD> ؓ.9<EFBFBD> x<EFBFBD> P<EFBFBD> \r .`v4<76> <34> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 8<EFBFBD> 4daXV<58> 6<EFBFBD> F<1E> <> <EFBFBD> E<02> H H<> fc-^=<3D> <> <EFBFBD> t<EFBFBD> <74> x<04> Y \r <EFBFBD> %<25> <1D> xe<78> <65> <EFBFBD> Q<18> ,X= 1!<21> sv<73> j<EFBFBD> kQ 2<> <18> %<18> W?<0C> <> Ů<EFBFBD> <C5AE> <EFBFBD> =<3D> dY&ٓ<> VX4<58> ـ<EFBFBD> \\ <EFBFBD> 5<EFBFBD> <14> <> Xì!<21> }<7D> <17> <> N<EFBFBD> <4E> gvڃWY*<2A> Q<EFBFBD> <51> i&<26> <> l<EFBFBD> <6C> ѵ Z#<23> <> <02> <> <EFBFBD> Ց\r A<EFBFBD> \$ e<1B> v5o#ޛ<> <DE9B> <EFBFBD> <EFBFBD> <EFBFBD> 5gc3MTC<54> L> v<> H<EFBFBD> <48> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <`<60> <> <EFBFBD> *<2A> ]<5D> _<EFBFBD> <5F> ; %<25> ;<3B> <> V<EFBFBD> <56> i<EFBFBD> <69> <EFBFBD> <EFBFBD> <EFBFBD> 4X<34> <58> <EFBFBD> '<27> <> `<60> <> <EFBFBD> <EFBFBD> i<EFBFBD> j0 g<> O<EFBFBD> <1C> ۥ<> i<1D> <15> <> <EFBFBD> 9<> ƙ ےd<DB92> F<EFBFBD> <46> <EFBFBD> k/ lŞ<6C> <C59E> n<EFBFBD> <6E> c<b\n <EFBFBD> <EFBFBD> 8<EFBFBD> `<60> H<EFBFBD> <48> e<EFBFBD> }]\$ Ҳ<EFBFBD> <EFBFBD> <03> <20> <> !<21> <> <EFBFBD> <EFBFBD> C)<29> \$ <20> <> A<EFBFBD> <41> `<60> \0 '<27> <> <EFBFBD> & \0 B<1D> !<0E> <> )<29> <14> <> <1C> 5E)<29> <> <02> <> <1C> o \r <EFBFBD> <EFBFBD> 8 r`<60> <> <EFBFBD> !2<> <32> T<> <12> s=<3D> D˩<44> >\n /<0B> l<02> <> <01> <> <EFBFBD> [<0C> <> ŠP<C5A0> <03> a<0F> 8%<25> <> <EFBFBD> !<21> 1v/<2F> <> S Uc oJ<6F> :<07> 4 J+<2B> B<EFBFBD> <42> <EFBFBD> <EFBFBD> <EFBFBD> v<EFBFBD> J<EFBFBD> <4A> \r <EFBFBD> <EFBFBD> <0E> b{ <08> <> ,|\0 <EFBFBD> <06> z<EFBFBD> <7A> c<EFBFBD> <0F> <> Y<EFBFBD> <59> l<EFBFBD> \n <EFBFBD> <EFBFBD> i.<2E> <> !<21> <> )<1D> <> dm<64> J<EFBFBD> <07> <03> <> !'<27> <> <EFBFBD> B\n C \\ i\$ J<> \" <EFBFBD> <EFBFBD> <EFBFBD> 2<EFBFBD> +<2B> IkJ<6B> <4A> <EFBFBD> \$ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> G<EFBFBD> y\$ #ܲi/<2F> CAb<41> <62> b<EFBFBD> C(<28> <> :<04> <> U X<> <58> <EFBFBD> 2& <09> , Q;~/<2F> <> K y9<79> <39> ?<3F> \r 6<> <36> tV<74> <56> <EFBFBD> !<21> 6<EFBFBD> CP<43> hY<68> E<EFBFBD> <45> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> l<EFBFBD> 䏞(ؖT<D896> <54> p' 3<> <33> C<<3C> dc<64> <63> <EFBFBD> ?<3F> yC<79> <43> <EFBFBD> e0<01> @&A?<12> =<3D> <0C> %<25> A:J D&SQ<53> <51> 6R<36> )A<> <41> <EFBFBD> b`0<> @<40> <> u9(<28> !0R\n <EFBFBD> F <20> <03> <> <20> wC\\ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> υ r<CF85> <72> ܙ<0C> <> <EFBFBD> #<23> ~<7E> <> 2'\$ <EFBFBD> :<06> <> K<EFBFBD> `h<> <68> @<40> <> Eb<45> <62> [<5B> ~<7E> <> <EFBFBD> <EFBFBD> <EFBFBD> T<> <54> lf5<66> <35> B R]<5D> { \" -<01> <> \0 <EFBFBD> <EFBFBD> <EFBFBD> L>\r <EFBFBD> \$ @<40> \n (& \r <EFBFBD> <EFBFBD> 9<EFBFBD> \0 vh*ɇ<> <C987> *<2A> X<EFBFBD> !_ d j<> <6A> <EFBFBD> <EFBFBD> <EFBFBD> p y<> <79> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> `<60> jY<12> wJ<77> \$ <EFBFBD> R<EFBFBD> <1D> (u aM+<2B> <> n<1E> xs<78> pU^<15> Ap`ͤ I<> <49> H<EFBFBD> \n <EFBFBD> f<05> 02<30> )!4a<34> 9 <09> <> <EFBFBD> <02> EwC<77> <43> <0C> <> <15> ˩ <01> L<04> P<EFBFBD> <50> <EFBFBD> <EFBFBD> Ai<41> )<29> p<EFBFBD> 3<> A<EFBFBD> u<EFBFBD> <0C> <> <EFBFBD> AI<41> A<EFBFBD> Hu <09> !g͕<67> U<> <55> <EFBFBD> <EFBFBD> ZU<5A> <55> <EFBFBD> c<> *<2A> <> <EFBFBD> <EFBFBD> M<EFBFBD> <4D> xf<0C> :<04> <> ^<18> Xp+<2B> V<0F> <> <EFBFBD> <EFBFBD> <0C> <> K<EFBFBD> C#+<2B> <20> W h<> CP!<21> <0C> <> ;<3B> [pn\\ %<25> <> k \0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ,ڨ 8<> 7<EFBFBD> <37> xQC\n Y \r <EFBFBD> b<EFBFBD> <EFBFBD> Xv C d\n A<EFBFBD> ;<3B> <> lF, _wr<77> 4 RP<52> <50> <EFBFBD> HA<18> !<21> ;<3B> <> &^Ͳ<> <CDB2> \" 6;<3B> <> <EFBFBD> <EFBFBD> <EFBFBD> =<3D> #C<> <43> I<EFBFBD> <0C> <> 9f<03> '<27> :<3A> <> DY!<1A> <> B+<2B> s<EFBFBD> xV<78> <56> 8l<38> Ó<EFBFBD> \" <EFBFBD> 鑃<EFBFBD> H<> U%\" Z6<04> <> u \r <EFBFBD> e0[<5B> <> p<15> <> <02> a<05> <> .<2E> <> <EFBFBD> +^`<60> `b<> 5#CM<43> \$ <EFBFBD> <20> I<EFBFBD> <49> <EFBFBD> ˚A<CB9A> P<EFBFBD> 5C\r <EFBFBD> S<> d<> WN6H[<0C> SR<53> <52> <EFBFBD> <16> <> \\ +<2B> X<EFBFBD> =k<> <6B> λ<CEBB> <D7BA> S<EFBFBD> <53> <EFBFBD> <EFBFBD> r^(<28> <> oo<1C> 7<EFBFBD> <37> <EFBFBD> <18> \\ huk<EFBFBD> lHaC(m<> <12> <> <EFBFBD> nRB<52> <42> Uup<75> <70> 2C1<43> [<5B> |ٽ<> beG 0<> <30> \" <EFBFBD> CG<EFBFBD> <EFBFBD> ?\$ x7<04> <> n<EFBFBD> <6E> \$ Z<EFBFBD> =<3D> ZӦ<5A> <D3A6> s i5<69> f<EFBFBD> <66> &<26> ,<2C> f<EFBFBD> h i<> I<EFBFBD> y<EFBFBD> <79> n<EFBFBD> <6E> 2<EFBFBD> 0<EFBFBD> <1B> DvE<76> <45> T<EFBFBD> x<EFBFBD> <1E> M<> { <EFBFBD> <13> `ܤ<> GN#遂Z,<2C> /<0C> R\$ <1D> #\\ I- <09> <> <EFBFBD> <EFBFBD> |<7C> 0<> -0<> <30> N<13> <> P<EFBFBD> <50> <EFBFBD> <0C> <> ;s-<2D> v<EFBFBD> <76> <EFBFBD> ҆<EFBFBD> <D286> <EFBFBD> nwGt<47> <74> n<EFBFBD> <6E> <EFBFBD> <EFBFBD> di<64> H<EFBFBD> |<7C> <> 4<17> (<28> <01> +<2B> v<EFBFBD> <76> <EFBFBD> &<26> Ņ<EFBFBD> +K<> <4B> <EFBFBD> <EFBFBD> <EFBFBD> L \n J \$ ԩ<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> : \\ Q<WB \" ^<5E> <> <EFBFBD> <EFBFBD> <EFBFBD> WTIB ~<7E> <> q<EFBFBD> ɞ<EFBFBD> <C99E> }<7D> 3<EFBFBD> ο \" :<1C> U<> <55> <0C> <> | \r 5n(n<> <6E> <EFBFBD> <EFBFBD> <EFBFBD> <20> 7<EFBFBD> <37> O<EFBFBD> D}B}<7D> <> <EFBFBD> <EFBFBD> <EFBFBD> \0 \r <EFBFBD> voܕ<EFBFBD> <EFBFBD> <10> ؆_Jl<4A> İ<EFBFBD> H3<48> \" <EFBFBD> [ ĸ<> <C4B8> <EFBFBD> <EFBFBD> K<EFBFBD> A<EFBFBD> <41> `ߖ<> <DF96> <EFBFBD> N<EFBFBD> <4E> <EFBFBD> & (<28> )\" <EFBFBD> f<> &<26> \0 <EFBFBD> <0E> b<0F> <> <EFBFBD> l<EFBFBD> <6C> F<EFBFBD> . jr<6A> <72> <EFBFBD> <EFBFBD> <EFBFBD> J <4A> \" P< \$ F<EFBFBD> *<2A> |f/<2F> ! <20> O<> <03> <> pR <20> <1A> <> F# 5 g<> b<EFBFBD> <0E> <> 8eRDi<0E> <> 0<EFBFBD> P<EFBFBD> +*<2A> <> <EFBFBD> <0E> <0C> <> <EFBFBD> k<EFBFBD> Z;<0F> p Hh<48> <68> l !<21> <> \0 \r \n c<0C> o<EFBFBD> /<2F> <08> CB<43> <py<07> NTH<54> h<> T<EFBFBD> <09> @<40> <> px<70> \$ <EFBFBD> <EFBFBD> <0B> <> <EFBFBD> <EFBFBD> <EFBFBD> 4 8\n <EFBFBD> <EFBFBD> #<23> NU,<2C> <05> <> \$ P<EFBFBD> m<> <0F> Y K<> <4B> \" H<> <48> <20> R<EFBFBD> L<EFBFBD> <4C> <EFBFBD> <EFBFBD> <EFBFBD> D<EFBFBD> \0 <EFBFBD> <EFBFBD> <01> <> <06> a<0B> W<02> `p<> <70> <EFBFBD> <EFBFBD> <EFBFBD> g<> <67> <10> <> lP<6C> <0F> <> <EFBFBD> o<EFBFBD> :L<> <4C> <EFBFBD> +\0 ] 0<07> <)<29> <> N<EFBFBD> xk \n (`c<> <63> +r<> k { m\" <EFBFBD> 3 .0<EFBFBD> <EFBFBD> H1<EFBFBD> e*ZoeB<04> <1C> <> 9\r <EFBFBD> <EFBFBD> <EFBFBD> \0 RL i<11> Q<> U<EFBFBD> ԋ`<60> <> .<2E> <> <06> <> o:<3A> d<EFBFBD> <64> <EFBFBD> T7Q<37> <51> V <20> <1D> Dh<44> <68> W<11> <> <EFBFBD> S 1<> <09> <> g<EFBFBD> *2<> <32> ,<10> W)<29> <> @<40> ϰT@C Q(<0E> ,<2C> <> 4<EFBFBD> #d<<3C> <14> \0 <EFBFBD> ! <20> \$ <EFBFBD> <EFBFBD> 2 { es<08> <> +<2B> rʫ<72> <CAAB> <EFBFBD> <EFBFBD> J vY*<2A> HPr \r <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> T<EFBFBD> M\\ \\ `<60> <> <EFBFBD> v<EFBFBD> <76> <EFBFBD> <<3C> <> &<26> n<EFBFBD> D \\ HH<EFBFBD> oj^@<40> <> <09> <> <<> <F18A86AF> 8<EFBFBD> <38> *#f<0C> <> *<2A> <> \r \n T<EFBFBD> \\ \r <EFBFBD> <EFBFBD> *<2A> T<0F> ^*<2A> <> ɠ<EFBFBD> \$ <EFBFBD> 6o<EFBFBD> 7<EFBFBD> <EFBFBD> Ree8<65> <20> 粡,ҥ,<12> ,`|9<> <39> K2<4B> 0r<30> +ҧ1R<31> <52> \" <EFBFBD> <20> *<2A> P*<2A> <04> Ȇ M\\ \r b<EFBFBD> 0 \0 <EFBFBD> Y\" <EFBFBD> \" <EFBFBD> U x<> <04> <> `<60> <> <EFBFBD> <EFBFBD> <0E> <> Q<EFBFBD> E\r <EFBFBD> ~Q@ 5 <20> 5sZ<0C> ^f<> R @Q4<51> d<05> <> 5<EFBFBD> b\0 <EFBFBD> @<40> F<EFBFBD> b/<2F> 8\" 8s<38> 8<EFBFBD> <@<40> <> <EFBFBD> <EFBFBD> l2 \$ Sh<EFBFBD> <EFBFBD> <EFBFBD> \n <03> R\" U<EFBFBD> 43FNɫ7 \" D \r <EFBFBD> 4<EFBFBD> OI3 \n \0 <EFBFBD> \n `<60> ``<60> <08> <> Y2<59> <32> ob<6F> 3<EFBFBD> <33> <n6<0E> ]<`<60> <> \" <EFBFBD> <EFBFBD> N<> \" B2<EFBFBD> Z \n <EFBFBD> <EFBFBD> m<EFBFBD> <EFBFBD> <EFBFBD> E<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \0 <EFBFBD> <05> <> <0E> Zx<5A> [2<> @, <0C> <> <P<> ?<3F> \r <EFBFBD> 8#d<@<40> <05> JU<04> <05> K/E<> ;\$ <EFBFBD> 6<EFBFBD> <EFBFBD> S<EFBFBD> DU l;<3B> ,U<1C> LΒ <4C> 7fcG\" EG<EFBFBD> <EFBFBD> \$ <EFBFBD> <13> \" E<EFBFBD> <EFBFBD> 3F HƤI<C6A4> <49> <EFBFBD> d<EFBFBD> =e !<21> UHБ23& j<0E> Ȭ<EFBFBD> *<2A> <> %%<25> %2<> ,<05> <> JQ1H<31> l0 tY3<59> <33> \$ X<C<> t<> 4<EFBFBD> _ \$ \0 <EFBFBD> <02> > / F<> \n <EFBFBD> <EFBFBD> ?mF<6D> j<EFBFBD> 3<> p<1F> D<EFBFBD> <05> HK<48> v Ⱥɜ<C8BA> \0 X<0E> * \r ʚ<EFBFBD> <EFBFBD> \n 0<EFBFBD> <0B> e \n <EFBFBD> % <> <EF9CBA> \r i<EFBFBD> <02> <> O<EFBFBD> <4F> fl<0E> N<EFBFBD> <4E> M %]U<> Q<> Q<> L<EFBFBD> <4C> -<2D> <> S±T4<54> !<21> <> U5<55> T \n n<EFBFBD> di0#<23> E<EFBFBD> <45> M<EFBFBD> <4D> <EFBFBD> <EFBFBD> i<> .<2E> <> /U<> <55> <EFBFBD> \r ZF<1E> <0C> <> j<EFBFBD> <6A> <0F> ;<3B> <> <EFBFBD> H<EFBFBD> ☎ d`m<> ݩ<EFBFBD> <DDA9> <EFBFBD> \n <EFBFBD> t<EFBFBD> <EFBFBD> QS e<12> <> <07> |<7C> i<EFBFBD> <69> <EFBFBD> <EFBFBD> <EFBFBD> Qt<51> d<06> 1 2,<2C> <> <16> DY<0B> 1UQS U<> <55> cd<63> <64> <07> <> E<EFBFBD> )\\ <EFBFBD> <EFBFBD> <EFBFBD> <0F> L<> <09> F\$ <EFBFBD> @<40> <> <EFBFBD> V<EFBFBD> { W6 \" L lT<6C> <54> A<02> \$ 6ab<EFBFBD> <EFBFBD> O<EFBFBD> <EFBFBD> dr<EFBFBD> <EFBFBD> Lp<EFBFBD> c,<2C> <> es Ξ<> <2<> `<60> @b<06> X P \$ 3<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <1A> @˃ P ,<2C> K<EFBFBD> Vխ^<05> <> <05> <> M<EFBFBD> <4D> L<EFBFBD> <4C> <EFBFBD> u<EFBFBD> 1<0C> <> @<40> c<EFBFBD> <63> t-<2D> (<28> <> <0E> ` \0 <EFBFBD> 9<EFBFBD> n<EFBFBD> <EFBFBD> 2sb<EFBFBD> <EFBFBD> <EFBFBD> / <20> Fm<46> )<29> <08> <> <EFBFBD> <EFBFBD> Hl5<6C> @<40> n<EFBFBD> l\$ <EFBFBD> q+<2B> :<3A> <> / <20> <> <02> d<EFBFBD> <64> ,<2C> <> \n <EFBFBD> <03> <> <EFBFBD> <14> <> . 4<> <34> <EFBFBD> \$ <20> w0 \$ <EFBFBD> d<07> V0<56> <30> <0E> \" <EFBFBD> <EFBFBD> r<> <72> W4678<37> VtqBau<61> pÀ<70> I <\$ #<23> x`<60> wd<77> 9<EFBFBD> ^*k<> u<EFBFBD> ofBEp g 2<> <32> <EFBFBD> f4 <20> <> L!<21> r=<02> \0 <EFBFBD> <0C> \" <02> \r <<0C> <> h<EFBFBD> <68> <10> <04> <> <EFBFBD> <02> U<> %T<> h<EFBFBD> <68> Bk<42> <6B> #><04> 'C<> p\n <EFBFBD> <EFBFBD> (<28> \r <EFBFBD> <EFBFBD> 2<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \" 3<EFBFBD> <EFBFBD> l<EFBFBD> <EFBFBD> Mԋ7<13> G<EFBFBD> x.<2E> ,<2C> Uu<55> %Dt<44> <20>
connection (){ global $i ; return $i ;} function
adminer (){ global $b ; return $b ;} function
idf_unescape ( $t ){ $pd = substr ( $t , - 1 ); return
str_replace ( $pd . $pd , $pd , substr ( $t , 1 , - 1 ));} function
escape_string ( $X ){ return
substr ( q ( $X ), 1 , - 1 );} function
remove_slashes ( $We , $qc = false ){ if ( get_magic_quotes_gpc ()){ while ( list ( $x , $X ) = each ( $We )){ foreach ( $X
as $hd => $W ){ unset ( $We [ $x ][ $hd ]); if ( is_array ( $W )){ $We [ $x ][ stripslashes ( $hd )] = $W ; $We [] =& $We [ $x ][ stripslashes ( $hd )];} else $We [ $x ][ stripslashes ( $hd )] = ( $qc ? $W : stripslashes ( $W ));}}}} function
bracket_escape ( $t , $Ca = false ){ static $vg = array ( ':' => ':1' , ']' => ':2' , '[' => ':3' ); return
strtr ( $t ,( $Ca ? array_flip ( $vg ) : $vg ));} function
h ( $O ){ return
htmlspecialchars ( str_replace ( " \0 " , " " , $O ), ENT_QUOTES );} function
nbsp ( $O ){ return ( trim ( $O ) != " " ? h ( $O ) : " " );} function
nl_br ( $O ){ return
str_replace ( " \n " , " <br> " , $O );} function
checkbox ( $B , $Y , $Pa , $md = " " , $je = " " , $Sa = " " ){ $I = " <input type='checkbox' name=' $B ' value=' " . h ( $Y ) . " ' " . ( $Pa ? " checked " : " " ) . ( $je ? ' onclick="' . h ( $je ) . '"' : '' ) . " > " ; return ( $md != " " || $Sa ? " <label " . ( $Sa ? " class=' $Sa ' " : " " ) . " > $I " . h ( $md ) . " </label> " : $I );} function
optionlist ( $ne , $Af = null , $Og = false ){ $I = " " ; foreach ( $ne
as $hd => $W ){ $oe = array ( $hd => $W ); if ( is_array ( $W )){ $I .= '<optgroup label="' . h ( $hd ) . '">' ; $oe = $W ;} foreach ( $oe
as $x => $X ) $I .= '<option' . ( $Og || is_string ( $x ) ? ' value="' . h ( $x ) . '"' : '' ) . (( $Og || is_string ( $x ) ? ( string ) $x : $X ) === $Af ? ' selected' : '' ) . '>' . h ( $X ); if ( is_array ( $W )) $I .= '</optgroup>' ;} return $I ;} function
2013-07-27 17:52:25 +02:00
adminer_html_select ( $B , $ne , $Y = " " , $ie = true ){ if ( $ie ) return " <select name=' " . h ( $B ) . " ' " . ( is_string ( $ie ) ? ' onchange="' . h ( $ie ) . '"' : " " ) . " > " . optionlist ( $ne , $Y ) . " </select> " ; $I = " " ; foreach ( $ne
2013-07-27 17:43:34 +02:00
as $x => $X ) $I .= " <label><input type='radio' name=' " . h ( $B ) . " ' value=' " . h ( $x ) . " ' " . ( $x == $Y ? " checked " : " " ) . " > " . h ( $X ) . " </label> " ; return $I ;} function
confirm ( $jb = " " ){ return " onclick= \" return confirm(' " . lang ( 0 ) . ( $jb ? " (' + $jb + ') " : " " ) . " '); \" " ;} function
print_fieldset ( $Oc , $ud , $Xg = false , $je = " " ){ echo " <fieldset><legend><a href='#fieldset- $Oc ' onclick= \" " . h ( $je ) . " return !toggle('fieldset- $Oc '); \" > $ud </a></legend><div id='fieldset- $Oc ' " . ( $Xg ? " " : " class='hidden' " ) . " > \n " ;} function
bold ( $Ja ){ return ( $Ja ? " class='active' " : " " );} function
odd ( $I = ' class="odd"' ){ static $s = 0 ; if ( ! $I ) $s =- 1 ; return ( $s ++% 2 ? $I : '' );} function
js_escape ( $O ){ return
addcslashes ( $O , " \r \n ' \\ / " );} function
json_row ( $x , $X = null ){ static $rc = true ; if ( $rc ) echo " { " ; if ( $x != " " ){ echo ( $rc ? " " : " , " ) . " \n \t \" " . addcslashes ( $x , " \r \n \" \\ " ) . '": ' . ( $X !== null ? '"' . addcslashes ( $X , " \r \n \" \\ " ) . '"' : 'undefined' ); $rc = false ;} else { echo " \n } \n " ; $rc = true ;}} function
ini_bool ( $Xc ){ $X = ini_get ( $Xc ); return ( eregi ( '^(on|true|yes)$' , $X ) || ( int ) $X );} function
sid (){ static $I ; if ( $I === null ) $I = ( SID &&! ( $_COOKIE && ini_bool ( " session.use_cookies " ))); return $I ;} function
q ( $O ){ global $i ; return $i -> quote ( $O );} function
get_vals ( $G , $f = 0 ){ global $i ; $I = array (); $H = $i -> query ( $G ); if ( is_object ( $H )){ while ( $J = $H -> fetch_row ()) $I [] = $J [ $f ];} return $I ;} function
get_key_vals ( $G , $j = null ){ global $i ; if ( ! is_object ( $j )) $j = $i ; $I = array (); $H = $j -> query ( $G ); if ( is_object ( $H )){ while ( $J = $H -> fetch_row ()) $I [ $J [ 0 ]] = $J [ 1 ];} return $I ;} function
get_rows ( $G , $j = null , $n = " <p class='error'> " ){ global $i ; $eb = ( is_object ( $j ) ? $j : $i ); $I = array (); $H = $eb -> query ( $G ); if ( is_object ( $H )){ while ( $J = $H -> fetch_assoc ()) $I [] = $J ;} elseif ( ! $H &&! is_object ( $j ) && $n && defined ( " PAGE_HEADER " )) echo $n . error () . " \n " ; return $I ;} function
unique_array ( $J , $v ){ foreach ( $v
as $u ){ if ( ereg ( " PRIMARY|UNIQUE " , $u [ " type " ])){ $I = array (); foreach ( $u [ " columns " ] as $x ){ if ( ! isset ( $J [ $x ])) continue
2 ; $I [ $x ] = $J [ $x ];} return $I ;}}} function
where ( $Z , $p = array ()){ global $w ; $I = array (); $Bc = '(^[\w\(]+' . str_replace ( " _ " , " .* " , preg_quote ( idf_escape ( " _ " ))) . '\)+$)' ; foreach (( array ) $Z [ " where " ] as $x => $X ){ $x = bracket_escape ( $x , 1 ); $f = ( preg_match ( $Bc , $x ) ? $x : idf_escape ( $x )); $I [] = $f . (( $w == " sql " && ereg ( '^[0-9]*\\.[0-9]*$' , $X )) || $w == " mssql " ? " LIKE " . q ( addcslashes ( $X , " %_ \\ " )) : " = " . unconvert_field ( $p [ $x ], q ( $X ))); if ( $w == " sql " && ereg ( " [^ -@] " , $X )) $I [] = " $f = " . q ( $X ) . " COLLATE utf8_bin " ;} foreach (( array ) $Z [ " null " ] as $x ) $I [] = ( preg_match ( $Bc , $x ) ? $x : idf_escape ( $x )) . " IS NULL " ; return
implode ( " AND " , $I );} function
where_check ( $X , $p = array ()){ parse_str ( $X , $Oa ); remove_slashes ( array ( & $Oa )); return
where ( $Oa , $p );} function
where_link ( $s , $f , $Y , $ke = " = " ){ return " &where%5B $s %5D%5Bcol%5D= " . urlencode ( $f ) . " &where%5B $s %5D%5Bop%5D= " . urlencode (( $Y !== null ? $ke : " IS NULL " )) . " &where%5B $s %5D%5Bval%5D= " . urlencode ( $Y );} function
convert_fields ( $g , $p , $L = array ()){ $I = " " ; foreach ( $g
as $x => $X ){ if ( $L &&! in_array ( idf_escape ( $x ), $L )) continue ; $ya = convert_field ( $p [ $x ]); if ( $ya ) $I .= " , $ya AS " . idf_escape ( $x );} return $I ;} function
cookie ( $B , $Y ){ global $ba ; $Ae = array ( $B ,( ereg ( " \n " , $Y ) ? " " : $Y ), time () + 2592000 , preg_replace ( '~\\?.*~' , '' , $_SERVER [ " REQUEST_URI " ]), " " , $ba ); if ( version_compare ( PHP_VERSION , '5.2.0' ) >= 0 ) $Ae [] = true ; return
call_user_func_array ( 'setcookie' , $Ae );} 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
auth_url ( $Db , $M , $V , $m = null ){ global $Eb ; preg_match ( '~([^?]*)\\??(.*)~' , remove_from_uri ( implode ( " | " , array_keys ( $Eb )) . " |username| " . ( $m !== null ? " db| " : " " ) . session_name ()), $A ); return " $A[1] ? " . ( sid () ? SID . " & " : " " ) . ( $Db != " server " || $M != " " ? urlencode ( $Db ) . " = " . urlencode ( $M ) . " & " : " " ) . " username= " . urlencode ( $V ) . ( $m != " " ? " &db= " . urlencode ( $m ) : " " ) . ( $A [ 2 ] ? " & $A[2] " : " " );} function
2012-06-04 16:58:40 +02:00
is_ajax (){ return ( $_SERVER [ " HTTP_X_REQUESTED_WITH " ] == " XMLHttpRequest " );} function
2013-07-27 17:43:34 +02:00
redirect ( $_ , $Jd = null ){ if ( $Jd !== null ){ restart_session (); $_SESSION [ " messages " ][ preg_replace ( '~^[^?]*~' , '' ,( $_ !== null ? $_ : $_SERVER [ " REQUEST_URI " ]))][] = $Jd ;} if ( $_ !== null ){ if ( $_ == " " ) $_ = " . " ; header ( " Location: $_ " ); exit ;}} function
query_redirect ( $G , $_ , $Jd , $cf = true , $dc = true , $kc = false ){ global $i , $n , $b ; $lg = " " ; if ( $dc ){ $Mf = microtime (); $kc =! $i -> query ( $G ); $lg = " ; -- " . format_time ( $Mf , microtime ());} $Kf = " " ; if ( $G ) $Kf = $b -> messageQuery ( $G . $lg ); if ( $kc ){ $n = error () . $Kf ; return
false ;} if ( $cf ) redirect ( $_ , $Jd . $Kf ); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
queries ( $G = null ){ global $i ; static $Ze = array (); if ( $G === null ) return
implode ( " \n " , $Ze ); $Mf = microtime (); $I = $i -> query ( $G ); $Ze [] = ( ereg ( ';$' , $G ) ? " DELIMITER ;; \n $G ; \n DELIMITER " : $G ) . " ; -- " . format_time ( $Mf , microtime ()); return $I ;} function
apply_queries ( $G , $R , $Yb = 'table' ){ foreach ( $R
as $P ){ if ( ! queries ( " $G " . $Yb ( $P ))) return
false ;} return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
queries_redirect ( $_ , $Jd , $cf ){ return
query_redirect ( queries (), $_ , $Jd , $cf , false , ! $cf );} function
format_time ( $Mf , $Sb ){ return
lang ( 1 , max ( 0 , array_sum ( explode ( " " , $Sb )) - array_sum ( explode ( " " , $Mf ))));} function
remove_from_uri ( $_e = " " ){ return
substr ( preg_replace ( " ~(?<=[?&])( $_e " . ( SID ? " " : " | " . session_name ()) . " )=[^&]*&~ " , '' , " $_SERVER[REQUEST_URI] & " ), 0 , - 1 );} function
pagination ( $D , $nb ){ return " " . ( $D == $nb ? $D + 1 : '<a href="' . h ( remove_from_uri ( " page " ) . ( $D ? " &page= $D " : " " )) . '">' . ( $D + 1 ) . " </a> " );} function
get_file ( $x , $ub = false ){ $oc = $_FILES [ $x ]; if ( ! $oc ) return
null ; foreach ( $oc
as $x => $X ) $oc [ $x ] = ( array ) $X ; $I = '' ; foreach ( $oc [ " error " ] as $x => $n ){ if ( $n ) return $n ; $B = $oc [ " name " ][ $x ]; $sg = $oc [ " tmp_name " ][ $x ]; $fb = file_get_contents ( $ub && ereg ( '\\.gz$' , $B ) ? " compress.zlib:// $sg " : $sg ); if ( $ub ){ $Mf = substr ( $fb , 0 , 3 ); if ( function_exists ( " iconv " ) && ereg ( " ^ \xFE \xFF |^ \xFF \xFE " , $Mf , $jf )) $fb = iconv ( " utf-16 " , " utf-8 " , $fb ); elseif ( $Mf == " \xEF \xBB \xBF " ) $fb = substr ( $fb , 3 );} $I .= $fb . " \n \n " ;} return $I ;} function
upload_error ( $n ){ $Gd = ( $n == UPLOAD_ERR_INI_SIZE ? ini_get ( " upload_max_filesize " ) : 0 ); return ( $n ? lang ( 2 ) . ( $Gd ? " " . lang ( 3 , $Gd ) : " " ) : lang ( 4 ));} function
repeat_pattern ( $He , $vd ){ return
str_repeat ( " $He { 0,65535} " , $vd / 65535 ) . " $He { 0, " . ( $vd % 65535 ) . " } " ;} function
is_utf8 ( $X ){ return ( preg_match ( '~~u' , $X ) &&! preg_match ( '~[\\0-\\x8\\xB\\xC\\xE-\\x1F]~' , $X ));} function
shorten_utf8 ( $O , $vd = 80 , $Tf = " " ){ if ( ! preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n - \ x { FFFF}] " , $vd ) . " )( $ )?)u " , $O , $A )) preg_match ( " (^( " . repeat_pattern ( " [ \t \r \n -~] " , $vd ) . " )( $ )?) " , $O , $A ); return
h ( $A [ 1 ]) . $Tf . ( isset ( $A [ 2 ]) ? " " : " <i>...</i> " );} function
friendly_url ( $X ){ return
preg_replace ( '~[^a-z0-9_]~i' , '-' , $X );} function
hidden_fields ( $We , $Qc = array ()){ while ( list ( $x , $X ) = each ( $We )){ if ( is_array ( $X )){ foreach ( $X
as $hd => $W ) $We [ $x . " [ $hd ] " ] = $W ;} elseif ( ! in_array ( $x , $Qc )) echo '<input type="hidden" name="' . h ( $x ) . '" value="' . h ( $X ) . '">' ;}} function
2012-06-04 16:58:40 +02:00
hidden_fields_get (){ echo ( sid () ? '<input type="hidden" name="' . session_name () . '" value="' . h ( session_id ()) . '">' : '' ),( SERVER !== null ? '<input type="hidden" name="' . DRIVER . '" value="' . h ( SERVER ) . '">' : " " ), '<input type="hidden" name="username" value="' . h ( $_GET [ " username " ]) . '">' ;} function
2013-07-27 17:43:34 +02:00
table_status1 ( $P , $lc = false ){ $I = table_status ( $P , $lc ); return ( $I ? $I : array ( " Name " => $P ));} function
column_foreign_keys ( $P ){ global $b ; $I = array (); foreach ( $b -> foreignKeys ( $P ) as $q ){ foreach ( $q [ " source " ] as $X ) $I [ $X ][] = $q ;} return $I ;} function
enum_input ( $T , $_a , $o , $Y , $Rb = null ){ global $b ; preg_match_all ( " ~'((?:[^']|'')*)'~ " , $o [ " length " ], $Bd ); $I = ( $Rb !== null ? " <label><input type=' $T ' $_a value=' $Rb ' " . (( is_array ( $Y ) ? in_array ( $Rb , $Y ) : $Y === 0 ) ? " checked " : " " ) . " ><i> " . lang ( 5 ) . " </i></label> " : " " ); foreach ( $Bd [ 1 ] as $s => $X ){ $X = stripcslashes ( str_replace ( " '' " , " ' " , $X )); $Pa = ( is_int ( $Y ) ? $Y == $s + 1 : ( is_array ( $Y ) ? in_array ( $s + 1 , $Y ) : $Y === $X )); $I .= " <label><input type=' $T ' $_a value=' " . ( $s + 1 ) . " ' " . ( $Pa ? ' checked' : '' ) . '>' . h ( $b -> editVal ( $X , $o )) . '</label>' ;} return $I ;} function
input ( $o , $Y , $r ){ global $i , $U , $b , $w ; $B = h ( bracket_escape ( $o [ " field " ])); echo " <td class='function'> " ; $mf = ( $w == " mssql " && $o [ " auto_increment " ]); if ( $mf &&! $_POST [ " save " ]) $r = null ; $Cc = ( isset ( $_GET [ " select " ]) || $mf ? array ( " orig " => lang ( 6 )) : array ()) + $b -> editFunctions ( $o ); $_a = " name='fields[ $B ]' " ; if ( $o [ " type " ] == " enum " ) echo
nbsp ( $Cc [ " " ]) . " <td> " . $b -> editInput ( $_GET [ " edit " ], $o , $_a , $Y ); else { $rc = 0 ; foreach ( $Cc
2013-07-27 17:52:25 +02:00
as $x => $X ){ if ( $x === " " ||! $X ) break ; $rc ++ ;} $ie = ( $rc ? " onchange= \" var f = this.form['function[ " . h ( js_escape ( bracket_escape ( $o [ " field " ]))) . " ]']; if ( $rc > f.selectedIndex) f.selectedIndex = $rc ; \" " : " " ); $_a .= $ie ; echo ( count ( $Cc ) > 1 ? adminer_html_select ( " function[ $B ] " , $Cc , $r === null || in_array ( $r , $Cc ) || isset ( $Cc [ $r ]) ? $r : " " , " functionChange(this); " ) : nbsp ( reset ( $Cc ))) . '<td>' ; $Zc = $b -> editInput ( $_GET [ " edit " ], $o , $_a , $Y ); if ( $Zc != " " ) echo $Zc ; elseif ( $o [ " type " ] == " set " ){ preg_match_all ( " ~'((?:[^']|'')*)'~ " , $o [ " length " ], $Bd ); foreach ( $Bd [ 1 ] as $s => $X ){ $X = stripcslashes ( str_replace ( " '' " , " ' " , $X )); $Pa = ( is_int ( $Y ) ? ( $Y >> $s ) & 1 : in_array ( $X , explode ( " , " , $Y ), true )); echo " <label><input type='checkbox' name='fields[ $B ][ $s ]' value=' " . ( 1 << $s ) . " ' " . ( $Pa ? ' checked' : '' ) . " $ie > " . h ( $b -> editVal ( $X , $o )) . '</label>' ;}} elseif ( ereg ( 'blob|bytea|raw|file' , $o [ " type " ]) && ini_bool ( " file_uploads " )) echo " <input type='file' name='fields- $B ' $ie > " ; elseif (( $jg = ereg ( 'text|lob' , $o [ " type " ])) || ereg ( " \n " , $Y )){ if ( $jg && $w != " sqlite " ) $_a .= " cols='50' rows='12' " ; else { $K = min ( 12 , substr_count ( $Y , " \n " ) + 1 ); $_a .= " cols='30' rows=' $K ' " . ( $K == 1 ? " style='height: 1.2em;' " : " " );} echo " <textarea $_a > " . h ( $Y ) . '</textarea>' ;} else { $Id = ( ! ereg ( 'int' , $o [ " type " ]) && preg_match ( '~^(\\d+)(,(\\d+))?$~' , $o [ " length " ], $A ) ? (( ereg ( " binary " , $o [ " type " ]) ? 2 : 1 ) * $A [ 1 ] + ( $A [ 3 ] ? 1 : 0 ) + ( $A [ 2 ] &&! $o [ " unsigned " ] ? 1 : 0 )) : ( $U [ $o [ " type " ]] ? $U [ $o [ " type " ]] + ( $o [ " unsigned " ] ? 0 : 1 ) : 0 )); if ( $w == 'sql' && $i -> server_info >= 5.6 && ereg ( 'time' , $o [ " type " ])) $Id += 7 ; echo " <input " . ( ereg ( 'int' , $o [ " type " ]) ? " type='number' " : " " ) . " value=' " . h ( $Y ) . " ' " . ( $Id ? " maxlength=' $Id ' " : " " ) . ( ereg ( 'char|binary' , $o [ " type " ]) && $Id > 20 ? " size='40' " : " " ) . " $_a > " ;}}} function
2013-07-27 17:43:34 +02:00
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 ( ereg ( 'blob|bytea|raw|file' , $o [ " type " ]) && ini_bool ( " file_uploads " )){ $oc = get_file ( " fields- $t " ); if ( ! is_string ( $oc )) return
false ; return
q ( $oc );} return $b -> processInput ( $o , $Y , $r );} function
search_tables (){ global $b , $i ; $_GET [ " where " ][ 0 ][ " op " ] = " LIKE %% " ; $_GET [ " where " ][ 0 ][ " val " ] = $_POST [ " query " ]; $xc = false ; foreach ( table_status ( '' , true ) as $P => $Q ){ $B = $b -> tableName ( $Q ); if ( isset ( $Q [ " Engine " ]) && $B != " " && ( ! $_POST [ " tables " ] || in_array ( $P , $_POST [ " tables " ]))){ $H = $i -> query ( " SELECT " . limit ( " 1 FROM " . table ( $P ), " WHERE " . implode ( " AND " , $b -> selectSearchProcess ( fields ( $P ), array ())), 1 )); if ( ! $H || $H -> fetch_row ()){ if ( ! $xc ){ echo " <ul> \n " ; $xc = true ;} echo " <li> " . ( $H ? " <a href=' " . h ( ME . " select= " . urlencode ( $P ) . " &where[0][op]= " . urlencode ( $_GET [ " where " ][ 0 ][ " op " ]) . " &where[0][val]= " . urlencode ( $_GET [ " where " ][ 0 ][ " val " ])) . " '> $B </a> \n " : " $B : <span class='error'> " . error () . " </span> \n " );}}} echo ( $xc ? " </ul> " : " <p class='message'> " . lang ( 7 )) . " \n " ;} function
dump_headers ( $Pc , $Rd = false ){ global $b ; $I = $b -> dumpHeaders ( $Pc , $Rd ); $ye = $_POST [ " output " ]; if ( $ye != " text " ) header ( " Content-Disposition: attachment; filename= " . $b -> dumpFilename ( $Pc ) . " . $I " . ( $ye != " file " &&! ereg ( '[^0-9a-z]' , $ye ) ? " . $ye " : " " )); session_write_close (); ob_flush (); flush (); return $I ;} function
dump_csv ( $J ){ foreach ( $J
as $x => $X ){ if ( preg_match ( " ~[ \" \n ,; \t ]~ " , $X ) || $X === " " ) $J [ $x ] = '"' . str_replace ( '"' , '""' , $X ) . '"' ;} echo
implode (( $_POST [ " format " ] == " csv " ? " , " : ( $_POST [ " format " ] == " tsv " ? " \t " : " ; " )), $J ) . " \r \n " ;} function
apply_sql_function ( $r , $f ){ return ( $r ? ( $r == " unixepoch " ? " DATETIME( $f , ' $r ') " : ( $r == " count distinct " ? " COUNT(DISTINCT " : strtoupper ( " $r ( " )) . " $f ) " ) : $f );} function
password_file ( $k ){ $Ab = ini_get ( " upload_tmp_dir " ); if ( ! $Ab ){ if ( function_exists ( 'sys_get_temp_dir' )) $Ab = sys_get_temp_dir (); else { $pc =@ tempnam ( " " , " " ); if ( ! $pc ) return
false ; $Ab = dirname ( $pc ); unlink ( $pc );}} $pc = " $Ab /adminer.key " ; $I =@ file_get_contents ( $pc ); if ( $I ||! $k ) return $I ; $zc =@ fopen ( $pc , " w " ); if ( $zc ){ $I = md5 ( uniqid ( mt_rand (), true )); fwrite ( $zc , $I ); fclose ( $zc );} return $I ;} function
is_mail ( $Ob ){ $za = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]' ; $Cb = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; $He = " $za +( \\ . $za +)*@( $Cb ? \\ .)+ $Cb " ; return
preg_match ( " (^ $He (, \\ s* $He )* \$ )i " , $Ob );} function
is_url ( $O ){ $Cb = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])' ; return ( preg_match ( " ~^(https?)://( $Cb ? \\ .)+ $Cb (: \\ d+)?(/.*)?( \\ ?.*)?(#.*)? \$ ~i " , $O , $A ) ? strtolower ( $A [ 1 ]) : " " );} function
is_shortable ( $o ){ return
ereg ( 'char|text|lob|geometry|point|linestring|polygon' , $o [ " type " ]);} function
slow_query ( $G ){ global $b , $S ; $m = $b -> database (); if ( support ( " kill " ) && is_object ( $j = connect ()) && ( $m == " " || $j -> select_db ( $m ))){ $kd = $j -> result ( " SELECT CONNECTION_ID() " ); echo ' < script type = " text/javascript " >
var timeout = setTimeout ( function () {
ajax ( \ '' , js_escape ( ME ), ' script = kill\ ' , function () {
}, \ 'token=' , $S , '&kill=' , $kd , ' \ ' );
}, ',1000*$b->queryTimeout(),' );
</ script >
';}else$j=null;ob_flush();flush();$I=@get_key_vals($G,$j);if($j){echo"<script type=' text / javascript ' > clearTimeout ( timeout ); </ script > \n " ;ob_flush();flush();}return
array_keys ( $I );} function
lzw_decompress ( $Ga ){ $_b = 256 ; $Ha = 8 ; $Ua = array (); $nf = 0 ; $of = 0 ; for ( $s = 0 ; $s < strlen ( $Ga ); $s ++ ){ $nf = ( $nf << 8 ) + ord ( $Ga [ $s ]); $of += 8 ; if ( $of >= $Ha ){ $of -= $Ha ; $Ua [] = $nf >> $of ; $nf &= ( 1 << $of ) - 1 ; $_b ++ ; if ( $_b >> $Ha ) $Ha ++ ;}} $zb = range ( " \0 " , " \xFF " ); $I = " " ; foreach ( $Ua
as $s => $Ta ){ $Nb = $zb [ $Ta ]; if ( ! isset ( $Nb )) $Nb = $bh . $bh [ 0 ]; $I .= $Nb ; if ( $s ) $zb [] = $bh . $Nb [ 0 ]; $bh = $Nb ;} return $I ;} global $b , $i , $Eb , $Lb , $Vb , $n , $Cc , $Hc , $ba , $Yc , $w , $ca , $od , $he , $Ie , $Qf , $S , $xg , $U , $Kg , $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 ); if ( ! defined ( " SID " )){ session_name ( " adminer_sid " ); $Ae = array ( 0 , preg_replace ( '~\\?.*~' , '' , $_SERVER [ " REQUEST_URI " ]), " " , $ba ); if ( version_compare ( PHP_VERSION , '5.2.0' ) >= 0 ) $Ae [] = true ; call_user_func_array ( 'session_set_cookie_params' , $Ae ); session_start ();} remove_slashes ( array ( & $_GET , & $_POST , & $_COOKIE ), $qc ); if ( function_exists ( " set_magic_quotes_runtime " )) set_magic_quotes_runtime ( false ); @ set_time_limit ( 0 ); @ ini_set ( " zend.ze1_compatibility_mode " , false ); @ ini_set ( " precision " , 20 ); $od = array ( 'en' => 'English' , 'ar' => 'العربية' , 'bn' => 'বাংলা' , 'ca' => 'Català' , 'cs' => 'Čeština' , 'de' => 'Deutsch' , 'es' => 'Español' , 'et' => 'Eesti' , 'fa' => 'فارسی' , 'fr' => 'Français' , 'hu' => 'Magyar' , 'id' => 'Bahasa Indonesia' , 'it' => 'Italiano' , 'ja' => '日本語' , 'ko' => '한국어' , 'lt' => 'Lietuvių' , 'nl' => 'Nederlands' , 'pl' => 'Polski' , 'pt' => 'Português' , 'ro' => 'Limba Română' , 'ru' => 'Русский язык' , 'sk' => 'Slovenčina' , 'sl' => 'Slovenski' , 'sr' => 'Српски' , 'ta' => 'தமிழ்' , 'tr' => 'Türkçe' , 'uk' => 'Українська' , 'zh' => '简体中文' , 'zh-tw' => '繁體中文' ,); function
get_lang (){ global $ca ; return $ca ;} function
lang ( $t , $Zd = null ){ if ( is_string ( $t )){ $Ke = array_search ( $t , get_translations ( " en " )); if ( $Ke !== false ) $t = $Ke ;} global $ca , $xg ; $wg = ( $xg [ $t ] ? $xg [ $t ] : $t ); if ( is_array ( $wg )){ $Ke = ( $Zd == 1 ? 0 : ( $ca == 'cs' || $ca == 'sk' ? ( $Zd && $Zd < 5 ? 1 : 2 ) : ( $ca == 'fr' ? ( ! $Zd ? 0 : 1 ) : ( $ca == 'pl' ? ( $Zd % 10 > 1 && $Zd % 10 < 5 && $Zd / 10 % 10 != 1 ? 1 : 2 ) : ( $ca == 'sl' ? ( $Zd % 100 == 1 ? 0 : ( $Zd % 100 == 2 ? 1 : ( $Zd % 100 == 3 || $Zd % 100 == 4 ? 2 : 3 ))) : ( $ca == 'lt' ? ( $Zd % 10 == 1 && $Zd % 100 != 11 ? 0 : ( $Zd % 10 > 1 && $Zd / 10 % 10 != 1 ? 1 : 2 )) : ( $ca == 'ru' || $ca == 'sr' || $ca == 'uk' ? ( $Zd % 10 == 1 && $Zd % 100 != 11 ? 0 : ( $Zd % 10 > 1 && $Zd % 10 < 5 && $Zd / 10 % 10 != 1 ? 1 : 2 )) : 1 ))))))); $wg = $wg [ $Ke ];} $xa = func_get_args (); array_shift ( $xa ); $wc = str_replace ( " %d " , " %s " , $wg ); if ( $wc != $wg ) $xa [ 0 ] = number_format ( $Zd , 0 , " . " , lang ( 8 )); return
vsprintf ( $wc , $xa );} function
2013-07-27 17:52:25 +02:00
switch_lang (){ global $ca , $od ; echo " <form action='' method='post'> \n <div id='lang'> " , lang ( 9 ) . " : " . adminer_html_select ( " lang " , $od , $ca , " this.form.submit(); " ), " <input type='submit' value=' " . lang ( 10 ) . " ' class='hidden'> \n " , " <input type='hidden' name='token' value=' $_SESSION[token] '> \n " ; echo " </div> \n </form> \n " ;} if ( isset ( $_POST [ " lang " ]) && $_SESSION [ " token " ] == $_POST [ " token " ]){ cookie ( " adminer_lang " , $_POST [ " lang " ]); $_SESSION [ " lang " ] = $_POST [ " lang " ]; $_SESSION [ " translations " ] = array (); redirect ( remove_from_uri ());} $ca = " en " ; if ( isset ( $od [ $_COOKIE [ " adminer_lang " ]])){ cookie ( " adminer_lang " , $_COOKIE [ " adminer_lang " ]); $ca = $_COOKIE [ " adminer_lang " ];} elseif ( isset ( $od [ $_SESSION [ " lang " ]])) $ca = $_SESSION [ " lang " ]; else { $pa = array (); preg_match_all ( '~([-a-z]+)(;q=([0-9.]+))?~' , str_replace ( " _ " , " - " , strtolower ( $_SERVER [ " HTTP_ACCEPT_LANGUAGE " ])), $Bd , PREG_SET_ORDER ); foreach ( $Bd
2013-07-27 17:43:34 +02:00
as $A ) $pa [ $A [ 1 ]] = ( isset ( $A [ 3 ]) ? $A [ 3 ] : 1 ); arsort ( $pa ); foreach ( $pa
as $x => $F ){ if ( isset ( $od [ $x ])){ $ca = $x ; break ;} $x = preg_replace ( '~-.*~' , '' , $x ); if ( ! isset ( $pa [ $x ]) && isset ( $od [ $x ])){ $ca = $x ; break ;}}} $xg =& $_SESSION [ " translations " ]; if ( $_SESSION [ " translations_version " ] != 2121441971 ){ $xg = array (); $_SESSION [ " translations_version " ] = 2121441971 ;} function
get_translations ( $nd ){ switch ( $nd ){ case " en " : $h = " 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<> % Si<53> <69> y<1B> F<EFBFBD> 9<EFBFBD> (l<13> GH<47> \\ <EFBFBD> (<02> <> q<> <71> a3<61> bG;<3B> B.a<> F<EFBFBD> &<26> t<08> : T<> <54> <EFBFBD> <EFBFBD> s4<73> '<27> \n <16> P:Y<> fS<66> <53> <EFBFBD> p<EFBFBD> <70> e<EFBFBD> ,<2C> <> D0<44> dF<64> <09> [r)<29> +v<> <76> \n <EFBFBD> a9V <09> S<EFBFBD> k ̦<> n<EFBFBD> cj<63> <6A> AE3<45> F<EFBFBD> <46> <EFBFBD> <1D> <> 3<EFBFBD> Sz\n (^ { c<EFBFBD> <EFBFBD> ?<3F> <> <EFBFBD> .D<> }t<> <74> <EFBFBD> m<> jl { <EFBFBD> ȋ<EFBFBD> <EFBFBD> <EFBFBD> N<EFBFBD> <0C> o;<3B> <> G_T&<26> A6ar<61> cI<63> <49> ?<0F> ,<2C> <> M<EFBFBD> <4D> 4<EFBFBD> <34> h\" <EFBFBD> (<28> :<3A> <> X<EFBFBD> !<21> <08> <<3C> <> HK C Ȧ2<C8A6> #<23> #<0E> s<EFBFBD> İ<EFBFBD> \0 <EFBFBD> 3<EFBFBD> #;C 9\r <EFBFBD> <EFBFBD> 4 K`<60> ;<3B> H<0B> <> DC\" <EFBFBD> 1<EFBFBD> К <EFBFBD> <EFBFBD> \r <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <08> <> <EFBFBD> <EFBFBD> :<3A> <11> <> <EFBFBD> <06> C<> ƶ8b<38> <62> m<> <6D> <EFBFBD> +,þ9<C3BE> .T\0 <EFBFBD> <EFBFBD> <EFBFBD> ز N<> <4E> J<> <13> h C*<2A> j<EFBFBD> <6A> <EFBFBD> ͎<EFBFBD> <<3C> b<EFBFBD> <62> <EFBFBD> \" <EFBFBD> <EFBFBD> <\$ <EFBFBD> <EFBFBD> <EFBFBD> ><3E> <> S<> <53> <EFBFBD> S<EFBFBD> <53> ;<3B> <0B> <> 6\" <EFBFBD> T<EFBFBD> 쮀T<EFBFBD> =S<> ?#<23> \$ <EFBFBD> ð<EFBFBD> 6\r )<08> )<29> B3,7<> l0 \\ C<> #,<2C> \$ <EFBFBD> <EFBFBD> `<60> *<2A> P<EFBFBD> <0C> <> <0E> H<03> <> 3J)D?eE 8<> 8G<38> \\ <EFBFBD> <EFBFBD> ✊J<E29C8A> %<25> <> <EFBFBD> <0B> 8\r (<08> <08> &<26> <> <EFBFBD> <EFBFBD> E XU=SUղ<55> <D5B2> <EFBFBD> \r 5[ \$ <EFBFBD> 8̨<EFBFBD> <EFBFBD> :<3A> \n <EFBFBD> r\\ ո x<EFBFBD> <EFBFBD> <08> <1E> C@<40> :<01> ^<17> <> <EFBFBD> \\ <EFBFBD> H<EFBFBD> <EFBFBD> <EFBFBD> +C8^<5E> c<EFBFBD> <63> \n <EFBFBD> <EFBFBD> xE<01> K<EFBFBD> <4B> <EFBFBD> <0B> <> <EFBFBD> 5<EFBFBD> A<EFBFBD> u7<75> p<EFBFBD> <05> |<7C> <> <EFBFBD> <EFBFBD> 7<> <37> <EFBFBD> <EFBFBD> Z<EFBFBD> E<> <45> <EFBFBD> y<EFBFBD> P<EFBFBD> 1<EFBFBD> <1D> <> <EFBFBD> K<EFBFBD> @<40> <> r<EFBFBD> 9j L*B( <02> <> <EFBFBD> i<EFBFBD> <69> P<EFBFBD> )<02> UI4<08> %Ib\\ <EFBFBD> \r <EFBFBD> <EFBFBD> ӪUi<EFBFBD> j<EFBFBD> ?<3F> `ȟ)<29> j<> <6A> <EFBFBD> <EFBFBD> ֞DӲ<44> <D3B2> B<> ލ J<> @( ☩5;<15> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> yM<79> l<EFBFBD> <6C> 1<EFBFBD> <31> <EFBFBD> <04> K<EFBFBD> <4B> J<EFBFBD> Q}<7D> <09> 1;<3B> <> (,<2C> <> #h<> ><3E> <> |h<> \\ K[<5B> p<EFBFBD> \$ b0<EFBFBD> <EFBFBD> -<2D> \n [<5B> )<29> 0<EFBFBD> 97<39> ;<3B> <> % EUV \$ 4<EFBFBD> ں% \r <04> <> '<27> Dʁ3<CA81> 4<EFBFBD> <34> Z|<03> Q<EFBFBD> <51> <EFBFBD> <EFBFBD> IR<49> <52> <EFBFBD> N.<2E> e<EFBFBD> <65> U<EFBFBD> <55> +6 ̨<> 5-<08> g<EFBFBD> !<21> M< 3<> v<EFBFBD> <03> g\r =<3D> <> <EFBFBD> H<EFBFBD> <48> <02> Emܼ@X\" <EFBFBD> <EFBFBD> YIF<EFBFBD> 7<> 'Tw¢ 3<> <11> 5\0 <EFBFBD> ޒ<EFBFBD> \$ *|<7C> 4<EFBFBD> 4<EFBFBD> <03> <> <08> h2<68> <32> <EFBFBD> <15> <> Iv d<> <13> p \n <EFBFBD> @\" <10> @T@\" <EFBFBD> <EFBFBD> <EFBFBD> Ӥ %<25> <> <EFBFBD> S` Y<> i<EFBFBD> <69> \$ <<3C> <> <EFBFBD> a<EFBFBD> :L <09> Y<19> <> <EFBFBD> Ҩt P<> <19> <> <19> \n Q)<29> L:<3A> <> 8 Y<> \" !<21> <> <EFBFBD> <EFBFBD> DJCy<43> v<EFBFBD> A p<> wܸm<DCB8> %<25> +<1F> <> R<> Q\r <EFBFBD> My#<23> <19> C<EFBFBD> 4<EFBFBD> = P<> <50> I<> eI<65> <49> Dzm\r !<21> 8<0C> `*<15> ' \0 <EFBFBD> |2Ҹ<32> <D2B8> `<60> <> <0B> 6I%x<> Ǒ P<> pB<08> _<14> <> ^3!<14> 3hF{ _a<EFBFBD> <EFBFBD> , \" <EFBFBD> '<27> &<26> \0 q<EFBFBD> <EFBFBD> <EFBFBD> \r <EFBFBD> `<60> <> 03<30> Fm<46> <6D> <1E> <> <EFBFBD> w <09> -tM<74> `H<> 0fTn\0 <04> C)9<> <39> k@<40> u<EFBFBD> <75> <EFBFBD> | <09> a<EFBFBD> 3<EFBFBD> o 4<> c<EFBFBD> <63> '<27> fsϠ<73> J&<26> ڞ<EFBFBD> 6t<36> <19> <0B> ٛg<D99B> <67> <20> E<> Y<EFBFBD> ' p<> Fc<46> #<23> <> -<2D> <09> E<EFBFBD> <45> <EFBFBD> <EFBFBD> pjp<6A> <70> Ms<4D> |)<29> l<EFBFBD> X<> <19> <> <EFBFBD> <09> t P p<> <18> wΌ<77> \$ KR<EFBFBD> PH8%h<> 2* )<29> <> S<EFBFBD> <53> @<40> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> W<EFBFBD> <02> <0C> <> <EFBFBD> &<26> <> PK<50> <4B> 5<EFBFBD> <35> <EFBFBD> s)Y<> <59> BDNă=<3D> R<> J<EFBFBD> (<28> Y<> Zܮ<5A> <DCAE> S \$ <EFBFBD> \r <EFBFBD> <EFBFBD> <EFBFBD> <04> ]+6+<2B> ԧU<D4A7> @<40> <> ^<5E> JT<4A> F<EFBFBD> <46> \\ <EFBFBD> <EFBFBD> 8<EFBFBD> u<EFBFBD> <EFBFBD> <EFBFBD> C1Am <02> o<EFBFBD> U<EFBFBD> <55> <EFBFBD> jj<6A> x<EFBFBD> O<EFBFBD> 5<EFBFBD> z 4H<34> <04> )QJł<4A> &Q<> 6<06> Ct/p<> <70> <08> <> \" <EFBFBD> -<18> <> \$ <EFBFBD> <EFBFBD> U X<> <58> ]-i<> <69> <EFBFBD> l<\0 <EFBFBD> _\\ R \r <EFBFBD> <EFBFBD> \$ <EFBFBD> <EFBFBD> Ia<49> <61> <EFBFBD> <EFBFBD> [<1A> i o|<7C> <15> ^<5E> W\r <EFBFBD> U<> <55> a<EFBFBD> ګe]-<2D> x<EFBFBD> <78> <EFBFBD> <EFBFBD> [8ovX*tNƉ<4E> &<26> <> <09> -t<0C> <> <EFBFBD> `<60> <> <EFBFBD> /<2F> <> <EFBFBD> 8W _rck<63> <6B> \\ <EFBFBD> Bea 4<> I<EFBFBD> <49> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> O#<23> =1<19> jXy+<2B> ,RO<52> <4F> 1<EFBFBD> <18> <> C2 *a<> &|XN<58> Zr<5A> * <7<> 8{ >l}\r rL<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <05> Y<<3C> \r <19> <> F<EFBFBD> <46> <EFBFBD> ;<3B> <> _<EFBFBD> M<EFBFBD> Έ<EFBFBD> <CE88> <EFBFBD> <EFBFBD> e<EFBFBD> <02> 07ikf<1A> h묖<68> mU<6D> 2<EFBFBD> <32> <14> \n <EFBFBD> aWi 7w8<77> <38> iO89<1F> s(YN\\ S<0F> <> <16> <> ,<2C> 䔑<EFBFBD> <E49491> !`y2<79> <32> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <12> <> <EFBFBD> 3<EFBFBD> W<EFBFBD> <57> <EFBFBD> <16> <1F> <> <EFBFBD> <EFBFBD> nb<6E> 9 \n PY<EFBFBD> y5 M<> ڧPa<50> \n <EFBFBD> SHe<EFBFBD> 8+Q =v<> Z<EFBFBD> L<1A> ߄<EFBFBD> oB UŰ%%<25> <> y<EFBFBD> <79> <EFBFBD> ]<5D> ȯ<EFBFBD> <18> \\ <EFBFBD> <EFBFBD> <EFBFBD> .<2E> <> <17> <> e]o&I\" %I<> \\ /<2F> <> <EFBFBD> ֤Y<D6A4> <59> <EFBFBD> <EFBFBD> <EFBFBD> ( 78d><3E> <1C> <10> ne<6E> @e<> Y<EFBFBD> Pǐr7<72> Xʚ<58> <CA9A> <EFBFBD> <EFBFBD> <> <7F> <EFBFBD> <EFBFBD> <04> r<EFBFBD> <72> <0F> <> t<> <74> |<7C> o<EFBFBD> ZJ8<4A> <08> چ<EFBFBD> p<EFBFBD> <70> <EFBFBD> 8<EFBFBD> <18> &Z&<26> 7<EFBFBD> <37> ! \\ <EFBFBD> <EFBFBD> <EFBFBD> lq<EFBFBD> Jex<1D> <> T<EFBFBD> r<EFBFBD> <72> <EFBFBD> 9<EFBFBD> <39> q&<26> TFЫP<D0AB> <50> Ӡ <EFBFBD> <D3A0> <EFBFBD> m ?v<> @<40> 5<EFBFBD> \$ <17> u<> <75> r o@<40> <> <0B> <> <EFBFBD> <01> <> <EFBFBD> \0 <EFBFBD> I<EFBFBD> <EFBFBD> ޣ=m<> <6D> \\ <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 6<EFBFBD> <EFBFBD> x<EFBFBD> <EFBFBD> Z<EFBFBD> <EFBFBD> <EFBFBD> !` }<7D> <> <20> <> <EFBFBD> h /<2F> Sw<53> <> <D7BA> <EFBFBD> -<2D> <> <EFBFBD> !<21> <> <EFBFBD> \n <EFBFBD> <1A> a<> 9<EFBFBD> 8<EFBFBD> F @\r !<21> s <20> D@<40> o]<5D> T* `Z<16> ]HA<48> <41> c<EFBFBD> @<40> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <02> ><0B> <> <1A> <> \" h DC<44> 4X \n &<26> Qˆ <51> >g<> %<25> hʰ7x<37> \" <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <04> ǒ<EFBFBD> <C792> \\ @W<> ~<7E> p<EFBFBD> <15> Σ<EFBFBD> ֆ<> <D686> #<23> :@<40> ?6<> <36> z<EFBFBD> 6|<7C> 72<37> =<3D> <> <EFBFBD> r<> D \" <EFBFBD> <EFBFBD> <02> <1F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ֿ<EFBFBD> vz<76> <7A> CLH<4C> v<EFBFBD> <76> ʲ\r L<EFBFBD> \$ b<EFBFBD> <EFBFBD> s<> <73> <EFBFBD> c<<08> ڸ+<2B> \0 <EFBFBD> <EFBFBD> <04> <> b<EFBFBD> <02> ,F<> &<26> <> <EFBFBD> <EFBFBD> <EFBFBD> \" <EFBFBD> \" v<EFBFBD> (<28> \0 M A<> pr<70> <72> \\ <EFBFBD> H<EFBFBD> D jl<6A> 2<EFBFBD> S<> <53> <EFBFBD> h<EFBFBD> <02> <> <EFBFBD> <EFBFBD> ϧ<EFBFBD> O-<2D> S <20> )<29> <> <EFBFBD> <EFBFBD> ,牺<0C> Z<BL<42> <02> iJ3 <09> <> \r <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> \n \" <EFBFBD> " ; break ; case " ar " : $h = " <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<5F> Td<54> <64> <EFBFBD> <EFBFBD> <EFBFBD> <05> <> Q<> %F<08> <> <EFBFBD> <EFBFBD> PEdJ<64> ]<5D> MŖiE<69> t<EFBFBD> T<EFBFBD> '템9s BGeHh\\ <EFBFBD> m(A<> <14> L6#%9<> Q<EFBFBD> JXd:&<26> <> h C<> aΡ R<CEA1> Pcչ<63> z<EFBFBD> <7A> <EFBFBD> <EFBFBD> n<EFBFBD> <*<2A> <> <EFBFBD> ̡g\n 9<EFBFBD> <EFBFBD> %<25> <> h 5ut.<2E> <> <EFBFBD> Q S<> <53> \n <EFBFBD> <EFBFBD> Ķ p{ <12> <> <EFBFBD> l-\n <EFBFBD> <EFBFBD> ;<01> D<EFBFBD> <44> <16> \n <EFBFBD> <EFBFBD> <EFBFBD> n<EFBFBD> <10> <> <EFBFBD> <EFBFBD> g<EFBFBD> h<15> <> wk0<6B> GPs<<04> :<3A> <> e<EFBFBD> :<3A> 4<05> <> T<EFBFBD> <54> <EFBFBD> F<EFBFBD> <46> \r p<> 0<EFBFBD> <30> <14> (H<> \\ <EFBFBD> :0<> <30> <09> k<EFBFBD> .DB<44> <42> Ҝ@ʼn<> [(PR<50> <06> 1\" <EFBFBD> 6hs<68> <73> <EFBFBD> eC<65> <43> 30<33> <12> <> { z<EFBFBD> <EFBFBD> Q<EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <0E> <0E> <16> <> <EFBFBD> 7<> J<0E> *<2A> <> } H ,2A+<2B> F<EFBFBD> <46> <0C> p<EFBFBD> Ai#<23> \" 6q<EFBFBD> x<EFBFBD> \$ e<EFBFBD> q 'EZ:@<40> I<EFBFBD> <14> <> <EFBFBD> d} L<0E> <1E> 4<05> Ԝ 'Ezp[<5B> <0F> <> @%<25> <> #<0E> `<60> <0E> <08> 6<0C> <> <EFBFBD> 0<EFBFBD> <30> <EFBFBD> &<26> <> <EFBFBD> jNB<4E> <02> <> &M<> q[@,%ħ *<2A> *?<3F> <> U ,R<> m* \$ Q P<> <50> <05> <> [<5B> N<EFBFBD> <4E> <EFBFBD> *<2A> o_<6F> <5F> U<EFBFBD> _<16> m_<03> *<2A> i F,<2C> <ϵ<> 4<EFBFBD> O13<31> I2d<04> B5<42> :<3A> %<25> cwa 2<> <32> ȷ|<7C> AU<41> -<2D> <> <EFBFBD> S<EFBFBD> Z<EFBFBD> W<EFBFBD> E<EFBFBD> SG-<2D> <> : \r <EFBFBD> P<EFBFBD> )<29> B0@*\r <EFBFBD> X<EFBFBD> 7 <20> <> <EFBFBD> S ӣ<18> <> <EFBFBD> <EFBFBD> \" <EFBFBD> J<EFBFBD> <EFBFBD> LªLݸθL<02> <> <EFBFBD> K;<3B> <> d<EFBFBD> \" Ԉ-<2D> :<3A> m><3E> '<27> n@<40> <> <0C> <10> <10> Np<4E> <f<> <19> Y<EFBFBD> <59> a<EFBFBD> .w \$ 7]9д0<D0B4> %<25> <> [8Nzt%<25> -<2D> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <08> :<0C> <> @8lC<6C> <43> 7<EFBFBD> R<EFBFBD> <52> < H<> 2<EFBFBD> <32> <EFBFBD> x0<78> F<> 3<07> <10> :<0E> <> t<17> <> <EFBFBD> # <20> 4<EFBFBD> <34> (]<5D> <0C> ~<1F> <20> 9<EFBFBD> #x<> <17> T<EFBFBD> <54> 9<0C> (龋<> <E9BE8B> 05<30> A<EFBFBD> <41> 6<EFBFBD> <14> ۇ<EFBFBD> <DB87> <EFBFBD> ^0<> <30> (A<41> @<40> ,<0E> n0<6E> <30> \0 <EFBFBD> :l<> (<28> Lv<19> :<3A> 3<EFBFBD> jB<6A> <42> <EFBFBD> Z<EFBFBD> <5A> X6<58> }<7D> <> C<EFBFBD> <43> 8?<3F> j&<26> <> l<10> *<2A> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> j<> <15> z䓫e<E493AB> <65> <18> lb<6C> (<28> 2<EFBFBD> <32> <EFBFBD> /.<2E> Bށ\\ )<08> <> <EFBFBD> <EFBFBD> bG<62> aMd<4D> <64> <EFBFBD> <EFBFBD> j<02> O \n aP<EFBFBD> <EFBFBD> T<> <54> C*,U<> *<03> <> <EFBFBD> 15 \$ bԂ<13> <> <EFBFBD> `ax!<21> <> <EFBFBD> b<> R<> ~L \$ M ?<3F> &<26> <> <EFBFBD> Pk(]0<> <30> <EFBFBD> <EFBFBD> B<EFBFBD> H \n <04> ,<2C> <> <EFBFBD> <14> <0E> <> 7<EFBFBD> <37> @<40> i<0C> <> Q<EFBFBD> \0 <EFBFBD> T<> <0E> <> <EFBFBD> `<60> \" xnK<01> <> 6Lj<36> <C788> <EFBFBD> r \r ᴍ<EFBFBD> P<EFBFBD> <EFBFBD> <EFBFBD> φ<> %|<7C> <> <14> <> <02> ̵'A<> t, \r Q<EFBFBD> +k<> <6B> uf<75> <66> S=X<> <58> <EFBFBD> <EFBFBD> D~<7E> d4u[D<<3C> <1D> <> Xd \" <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 8<EFBFBD> <EFBFBD> :<3A> <> 9<EFBFBD> .<2E> <> P<EFBFBD> <50> <EFBFBD> <EFBFBD> \n <EFBFBD> 'E<> <45> <1A> aM<61> )<29> <> <EFBFBD> K3<4B> c A<> Bb<08> Jw<4A> !P<> A<EFBFBD> 5=<3D> <> 4<EFBFBD> <34> ;Q6<51> <0F> <> { 1 LM<4C> <4D> '#Rq<06> <> V3 \0 @<40> U<EFBFBD> <55> R<> W<EFBFBD> D<EFBFBD> G<EFBFBD> <47> [<5B> q<EFBFBD> .gP<67> <1E> v<EFBFBD> <76> <EFBFBD> <EFBFBD> '0<> <30> <10> U+Nt<4E> <74> B<EFBFBD> <04> <> <02> P<08> * Y<> ?<3F> E <09> <16> <> <EFBFBD> <EFBFBD> <07> 9<EFBFBD> |<7C> .<2E> Bz<42> s<> LG<4C> <08> I<EFBFBD> <,P<> [ \r <EFBFBD> <EFBFBD> I<EFBFBD> <1B> .<0F> <> <EFBFBD> #<23> y<EFBFBD> <79> <EFBFBD> 9<EFBFBD> p<EFBFBD> ϣ@c<> <19> V<EFBFBD> <56> A-<2D> l]<5D> |<7C> <> ' <20> <> <EFBFBD> BBɩ m7<6D> t<EFBFBD> <74> <EFBFBD> aQ<61> <51> <EFBFBD> 9<EFBFBD> <39> ğbr<62> <72> 0<EFBFBD> <30> <EFBFBD> <EFBFBD> mQ\" <EFBFBD> E<15> <> <14> d<EFBFBD> <64> E
2012-06-04 16:58:40 +02:00
Min_PDO
extends
2013-07-27 17:43:34 +02:00
PDO { var $_result , $server_info , $affected_rows , $errno , $error ; function
__construct (){ global $b ; $Ke = array_search ( " SQL " , $b -> operators ); if ( $Ke !== false ) unset ( $b -> operators [ $Ke ]);} function
dsn ( $Ib , $V , $E , $cc = 'auth_error' ){ set_exception_handler ( $cc ); parent :: __construct ( $Ib , $V , $E ); restore_exception_handler (); $this -> setAttribute ( 13 , array ( 'Min_PDOStatement' )); $this -> server_info = $this -> getAttribute ( 4 );} function
query ( $G , $Eg = false ){ $H = parent :: query ( $G ); $this -> error = " " ; if ( ! $H ){ list (, $this -> errno , $this -> error ) = $this -> errorInfo (); return
false ;} $this -> store_result ( $H ); return $H ;} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
store_result ( $H = null ){ if ( ! $H ){ $H = $this -> _result ; if ( ! $H ) return
false ;} if ( $H -> columnCount ()){ $H -> num_rows = $H -> rowCount (); return $H ;} $this -> affected_rows = $H -> rowCount (); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
next_result (){ if ( ! $this -> _result ) return
false ; $this -> _result -> _offset = 0 ; return @ $this -> _result -> nextRowset ();} function
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! $H ) return
false ; $J = $H -> fetch (); return $J [ $o ];}} class
2012-06-04 16:58:40 +02:00
Min_PDOStatement
extends
PDOStatement { var $_offset = 0 , $num_rows ; function
fetch_assoc (){ return $this -> fetch ( 2 );} function
fetch_row (){ return $this -> fetch ( 3 );} function
2013-07-27 17:43:34 +02:00
fetch_field (){ $J = ( object ) $this -> getColumnMeta ( $this -> _offset ++ ); $J -> orgtable = $J -> table ; $J -> orgname = $J -> name ; $J -> charsetnr = ( in_array ( " blob " ,( array ) $J -> flags ) ? 63 : 0 ); return $J ;}}} $Eb = array (); $Eb [ " sqlite " ] = " SQLite 3 " ; $Eb [ " sqlite2 " ] = " SQLite 2 " ; if ( isset ( $_GET [ " sqlite " ]) || isset ( $_GET [ " sqlite2 " ])){ $Ne = array (( isset ( $_GET [ " sqlite " ]) ? " SQLite3 " : " SQLite " ), " PDO_SQLite " ); define ( " DRIVER " ,( isset ( $_GET [ " sqlite " ]) ? " sqlite " : " sqlite2 " )); if ( class_exists ( isset ( $_GET [ " sqlite " ]) ? " SQLite3 " : " SQLiteDatabase " )){ if ( isset ( $_GET [ " sqlite " ])){ class
Min_SQLite { var $extension = " SQLite3 " , $server_info , $affected_rows , $errno , $error , $_link ; function
Min_SQLite ( $pc ){ $this -> _link = new
SQLite3 ( $pc ); $Ug = $this -> _link -> version (); $this -> server_info = $Ug [ " versionString " ];} function
query ( $G ){ $H =@ $this -> _link -> query ( $G ); $this -> error = " " ; if ( ! $H ){ $this -> errno = $this -> _link -> lastErrorCode (); $this -> error = $this -> _link -> lastErrorMsg (); return
false ;} elseif ( $H -> numColumns ()) return
2012-06-04 16:58:40 +02:00
new
2013-07-27 17:43:34 +02:00
Min_Result ( $H ); $this -> affected_rows = $this -> _link -> changes (); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
quote ( $O ){ return ( is_utf8 ( $O ) ? " ' " . $this -> _link -> escapeString ( $O ) . " ' " : " x' " . reset ( unpack ( 'H*' , $O )) . " ' " );} function
2012-06-04 16:58:40 +02:00
store_result (){ return $this -> _result ;} function
2013-07-27 17:43:34 +02:00
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
false ; $J = $H -> _result -> fetchArray (); return $J [ $o ];}} class
2012-06-04 16:58:40 +02:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2013-07-27 17:43:34 +02:00
Min_Result ( $H ){ $this -> _result = $H ;} function
2012-06-04 16:58:40 +02:00
fetch_assoc (){ return $this -> _result -> fetchArray ( SQLITE3_ASSOC );} function
fetch_row (){ return $this -> _result -> fetchArray ( SQLITE3_NUM );} function
2013-07-27 17:43:34 +02:00
fetch_field (){ $f = $this -> _offset ++ ; $T = $this -> _result -> columnType ( $f ); return ( object ) array ( " name " => $this -> _result -> columnName ( $f ), " type " => $T , " charsetnr " => ( $T == SQLITE3_BLOB ? 63 : 0 ),);} function
2012-06-04 16:58:40 +02:00
__desctruct (){ return $this -> _result -> finalize ();}}} else { class
Min_SQLite { var $extension = " SQLite " , $server_info , $affected_rows , $error , $_link ; function
2013-07-27 17:43:34 +02:00
Min_SQLite ( $pc ){ $this -> server_info = sqlite_libversion (); $this -> _link = new
SQLiteDatabase ( $pc );} function
query ( $G , $Eg = false ){ $Od = ( $Eg ? " unbufferedQuery " : " query " ); $H =@ $this -> _link -> $Od ( $G , SQLITE_BOTH , $n ); $this -> error = " " ; if ( ! $H ){ $this -> error = $n ; return
false ;} elseif ( $H === true ){ $this -> affected_rows = $this -> changes (); return
2012-06-04 16:58:40 +02:00
true ;} return
new
2013-07-27 17:43:34 +02:00
Min_Result ( $H );} function
quote ( $O ){ return " ' " . sqlite_escape_string ( $O ) . " ' " ;} function
2012-06-04 16:58:40 +02:00
store_result (){ return $this -> _result ;} function
2013-07-27 17:43:34 +02:00
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
false ; $J = $H -> _result -> fetch (); return $J [ $o ];}} class
2012-06-04 16:58:40 +02:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2013-07-27 17:43:34 +02:00
Min_Result ( $H ){ $this -> _result = $H ; if ( method_exists ( $H , 'numRows' )) $this -> num_rows = $H -> numRows ();} function
fetch_assoc (){ $J = $this -> _result -> fetch ( SQLITE_ASSOC ); if ( ! $J ) return
false ; $I = array (); foreach ( $J
as $x => $X ) $I [( $x [ 0 ] == '"' ? idf_unescape ( $x ) : $x )] = $X ; return $I ;} function
2012-06-04 16:58:40 +02:00
fetch_row (){ return $this -> _result -> fetch ( SQLITE_NUM );} function
2013-07-27 17:43:34 +02:00
fetch_field (){ $B = $this -> _result -> fieldName ( $this -> _offset ++ ); $He = '(\\[.*]|"(?:[^"]|"")*"|(.+))' ; if ( preg_match ( " ~^( $He\\ .)? $He\ $ ~ " , $B , $A )){ $P = ( $A [ 3 ] != " " ? $A [ 3 ] : idf_unescape ( $A [ 2 ])); $B = ( $A [ 5 ] != " " ? $A [ 5 ] : idf_unescape ( $A [ 4 ]));} return ( object ) array ( " name " => $B , " orgname " => $B , " orgtable " => $P ,);}}}} elseif ( extension_loaded ( " pdo_sqlite " )){ class
2012-06-04 16:58:40 +02:00
Min_SQLite
extends
Min_PDO { var $extension = " PDO_SQLite " ; function
2013-07-27 17:43:34 +02:00
Min_SQLite ( $pc ){ $this -> dsn ( DRIVER . " : $pc " , " " , " " );}}} if ( class_exists ( " Min_SQLite " )){ class
2012-06-04 16:58:40 +02:00
Min_DB
extends
Min_SQLite { function
Min_DB (){ $this -> Min_SQLite ( " :memory: " );} function
2013-07-27 17:43:34 +02:00
select_db ( $pc ){ if ( is_readable ( $pc ) && $this -> query ( " ATTACH " . $this -> quote ( ereg ( " (^[/ \\ \\ ]|:) " , $pc ) ? $pc : dirname ( $_SERVER [ " SCRIPT_FILENAME " ]) . " / $pc " ) . " AS a " )){ $this -> Min_SQLite ( $pc ); return
2012-06-04 16:58:40 +02:00
true ;} return
false ;} function
2013-07-27 17:43:34 +02:00
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2012-06-04 16:58:40 +02:00
next_result (){ return
false ;}}} function
2013-07-27 17:43:34 +02:00
idf_escape ( $t ){ return '"' . str_replace ( '"' , '""' , $t ) . '"' ;} function
table ( $t ){ return
idf_escape ( $t );} function
2012-06-04 16:58:40 +02:00
connect (){ return
new
Min_DB ;} function
get_databases (){ return
array ();} function
2013-07-27 17:43:34 +02:00
limit ( $G , $Z , $y , $C = 0 , $Cf = " " ){ return " $G $Z " . ( $y !== null ? $Cf . " LIMIT $y " . ( $C ? " OFFSET $C " : " " ) : " " );} function
limit1 ( $G , $Z ){ global $i ; return ( $i -> result ( " SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT') " ) ? limit ( $G , $Z , 1 ) : " $G $Z " );} function
db_collation ( $m , $Xa ){ global $i ; return $i -> result ( " PRAGMA encoding " );} function
2012-06-04 16:58:40 +02: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
2013-07-27 17:43:34 +02:00
count_tables ( $l ){ return
2012-06-04 16:58:40 +02:00
array ();} function
2013-07-27 17:43:34 +02:00
table_status ( $B = " " ){ global $i ; $I = array (); foreach ( get_rows ( " SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view') " . ( $B != " " ? " AND name = " . q ( $B ) : " ORDER BY name " )) as $J ){ $J [ " Oid " ] = 1 ; $J [ " Auto_increment " ] = " " ; $J [ " Rows " ] = $i -> result ( " SELECT COUNT(*) FROM " . idf_escape ( $J [ " Name " ])); $I [ $J [ " Name " ]] = $J ;} foreach ( get_rows ( " SELECT * FROM sqlite_sequence " , null , " " ) as $J ) $I [ $J [ " name " ]][ " Auto_increment " ] = $J [ " seq " ]; return ( $B != " " ? $I [ $B ] : $I );} function
is_view ( $Q ){ return $Q [ " Engine " ] == " view " ;} function
fk_support ( $Q ){ global $i ; return ! $i -> result ( " SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY') " );} function
fields ( $P ){ $I = array (); foreach ( get_rows ( " PRAGMA table_info( " . table ( $P ) . " ) " ) as $J ){ $T = strtolower ( $J [ " type " ]); $vb = $J [ " dflt_value " ]; $I [ $J [ " name " ]] = array ( " field " => $J [ " name " ], " type " => ( eregi ( " int " , $T ) ? " integer " : ( eregi ( " char|clob|text " , $T ) ? " text " : ( eregi ( " blob " , $T ) ? " blob " : ( eregi ( " real|floa|doub " , $T ) ? " real " : " numeric " )))), " full_type " => $T , " default " => ( ereg ( " '(.*)' " , $vb , $A ) ? str_replace ( " '' " , " ' " , $A [ 1 ]) : ( $vb == " NULL " ? null : $vb )), " null " =>! $J [ " notnull " ], " auto_increment " => eregi ( '^integer$' , $T ) && $J [ " pk " ], " privileges " => array ( " select " => 1 , " insert " => 1 , " update " => 1 ), " primary " => $J [ " pk " ],);} return $I ;} function
indexes ( $P , $j = null ){ $I = array (); $Qe = array (); foreach ( fields ( $P ) as $o ){ if ( $o [ " primary " ]) $Qe [] = $o [ " field " ];} if ( $Qe ) $I [ " " ] = array ( " type " => " PRIMARY " , " columns " => $Qe , " lengths " => array ()); $Lf = get_key_vals ( " SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = " . q ( $P )); foreach ( get_rows ( " PRAGMA index_list( " . table ( $P ) . " ) " ) as $J ){ $B = $J [ " name " ]; if ( ! ereg ( " ^sqlite_ " , $B )){ $I [ $B ][ " type " ] = ( $J [ " unique " ] ? " UNIQUE " : " INDEX " ); $I [ $B ][ " lengths " ] = array (); foreach ( get_rows ( " PRAGMA index_info( " . idf_escape ( $B ) . " ) " ) as $vf ) $I [ $B ][ " columns " ][] = $vf [ " name " ]; $I [ $B ][ " descs " ] = array (); if ( eregi ( '^CREATE( UNIQUE)? INDEX ' . quotemeta ( idf_escape ( $B ) . ' ON ' . idf_escape ( $P )) . ' \((.*)\)$' , $Lf [ $B ], $jf )){ preg_match_all ( '/("[^"]*+")+( DESC)?/' , $jf [ 2 ], $Bd ); foreach ( $Bd [ 2 ] as $X ) $I [ $B ][ " descs " ][] = ( $X ? '1' : null );}}} return $I ;} function
foreign_keys ( $P ){ $I = array (); foreach ( get_rows ( " PRAGMA foreign_key_list( " . table ( $P ) . " ) " ) as $J ){ $q =& $I [ $J [ " id " ]]; if ( ! $q ) $q = $J ; $q [ " source " ][] = $J [ " from " ]; $q [ " target " ][] = $J [ " to " ];} return $I ;} function
view ( $B ){ global $i ; return
array ( " select " => preg_replace ( '~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\\s+~iU' , '' , $i -> result ( " SELECT sql FROM sqlite_master WHERE name = " . q ( $B ))));} function
2012-06-04 16:58:40 +02:00
collations (){ return ( isset ( $_GET [ " create " ]) ? get_vals ( " PRAGMA collation_list " , 1 ) : array ());} function
2013-07-27 17:43:34 +02:00
information_schema ( $m ){ return
2012-06-04 16:58:40 +02:00
false ;} function
2013-07-27 17:43:34 +02:00
error (){ global $i ; return
h ( $i -> error );} function
check_sqlite_name ( $B ){ global $i ; $jc = " db|sdb|sqlite " ; if ( ! preg_match ( " ~^[^ \\ 0]* \\ .( $jc ) \$ ~ " , $B )){ $i -> error = lang ( 11 , str_replace ( " | " , " , " , $jc )); return
2012-06-04 16:58:40 +02:00
false ;} return
true ;} function
2013-07-27 17:43:34 +02:00
create_database ( $m , $e ){ global $i ; if ( file_exists ( $m )){ $i -> error = lang ( 12 ); return
false ;} if ( ! check_sqlite_name ( $m )) return
false ; $z = new
Min_SQLite ( $m ); $z -> query ( 'PRAGMA encoding = "UTF-8"' ); $z -> query ( 'CREATE TABLE adminer (i)' ); $z -> query ( 'DROP TABLE adminer' ); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
drop_databases ( $l ){ global $i ; $i -> Min_SQLite ( " :memory: " ); foreach ( $l
as $m ){ if ( !@ unlink ( $m )){ $i -> error = lang ( 12 ); return
2012-06-04 16:58:40 +02:00
false ;}} return
true ;} function
2013-07-27 17:43:34 +02:00
rename_database ( $B , $e ){ global $i ; if ( ! check_sqlite_name ( $B )) return
false ; $i -> Min_SQLite ( " :memory: " ); $i -> error = lang ( 12 ); return @ rename ( DB , $B );} function
2012-06-04 16:58:40 +02:00
auto_increment (){ return " PRIMARY KEY " . ( DRIVER == " sqlite " ? " AUTOINCREMENT " : " " );} function
2013-07-27 17:43:34 +02:00
alter_table ( $P , $B , $p , $tc , $bb , $Tb , $e , $Aa , $Ee ){ $Ng = ( $P == " " || $tc ); foreach ( $p
as $o ){ if ( $o [ 0 ] != " " ||! $o [ 1 ] || $o [ 2 ]){ $Ng = true ; break ;}} $c = array (); $we = array (); $Re = false ; foreach ( $p
as $o ){ if ( $o [ 1 ]){ if ( $o [ 1 ][ 6 ]) $Re = true ; $c [] = ( $Ng ? " " : " ADD " ) . implode ( $o [ 1 ]); if ( $o [ 0 ] != " " ) $we [ $o [ 0 ]] = $o [ 1 ][ 0 ];}} if ( $Ng ){ if ( $P != " " ){ queries ( " BEGIN " ); foreach ( foreign_keys ( $P ) as $q ){ $g = array (); foreach ( $q [ " source " ] as $f ){ if ( ! $we [ $f ]) continue
2 ; $g [] = $we [ $f ];} $tc [] = " FOREIGN KEY ( " . implode ( " , " , $g ) . " ) REFERENCES " . table ( $q [ " table " ]) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $q [ " target " ])) . " ) ON DELETE $q[on_delete] ON UPDATE $q[on_update] " ;} $v = array (); foreach ( indexes ( $P ) as $id => $u ){ $g = array (); foreach ( $u [ " columns " ] as $f ){ if ( ! $we [ $f ]) continue
2 ; $g [] = $we [ $f ];} $g = " ( " . implode ( " , " , $g ) . " ) " ; if ( $u [ " type " ] != " PRIMARY " ) $v [] = array ( $u [ " type " ], $id , $g ); elseif ( ! $Re ) $tc [] = " PRIMARY KEY $g " ;}} $c = array_merge ( $c , $tc ); if ( ! queries ( " CREATE TABLE " . table ( $P != " " ? " adminer_ $B " : $B ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " )) return
false ; if ( $P != " " ){ if ( $we &&! queries ( " INSERT INTO " . table ( " adminer_ $B " ) . " ( " . implode ( " , " , $we ) . " ) SELECT " . implode ( " , " , array_map ( 'idf_escape' , array_keys ( $we ))) . " FROM " . table ( $P ))) return
false ; $Bg = array (); foreach ( triggers ( $P ) as $_g => $mg ){ $yg = trigger ( $_g ); $Bg [] = " CREATE TRIGGER " . idf_escape ( $_g ) . " " . implode ( " " , $mg ) . " ON " . table ( $B ) . " \n $yg[Statement] " ;} if ( ! queries ( " DROP TABLE " . table ( $P ))) return
false ; queries ( " ALTER TABLE " . table ( " adminer_ $B " ) . " RENAME TO " . table ( $B )); if ( ! alter_indexes ( $B , $v )) return
false ; foreach ( $Bg
as $yg ){ if ( ! queries ( $yg )) return
false ;} queries ( " COMMIT " );}} else { foreach ( $c
as $X ){ if ( ! queries ( " ALTER TABLE " . table ( $P ) . " $X " )) return
false ;} if ( $P != $B &&! queries ( " ALTER TABLE " . table ( $P ) . " RENAME TO " . table ( $B ))) return
false ;} if ( $Aa ) queries ( " UPDATE sqlite_sequence SET seq = $Aa WHERE name = " . q ( $B )); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
index_sql ( $P , $T , $B , $g ){ return " CREATE $T " . ( $T != " INDEX " ? " INDEX " : " " ) . idf_escape ( $B != " " ? $B : uniqid ( $P . " _ " )) . " ON " . table ( $P ) . " $g " ;} function
alter_indexes ( $P , $c ){ foreach ( array_reverse ( $c ) as $X ){ if ( ! queries ( $X [ 2 ] == " DROP " ? " DROP INDEX " . idf_escape ( $X [ 1 ]) : index_sql ( $P , $X [ 0 ], $X [ 1 ], $X [ 2 ]))) return
false ;} return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
truncate_tables ( $R ){ return
apply_queries ( " DELETE FROM " , $R );} function
drop_views ( $Wg ){ return
apply_queries ( " DROP VIEW " , $Wg );} function
drop_tables ( $R ){ return
apply_queries ( " DROP TABLE " , $R );} function
move_tables ( $R , $Wg , $fg ){ return
2012-06-04 16:58:40 +02:00
false ;} function
2013-07-27 17:43:34 +02:00
trigger ( $B ){ global $i ; if ( $B == " " ) return
array ( " Statement " => " BEGIN \n \t ; \n END " ); preg_match ( '~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*([a-z]+)\\s+([a-z]+)\\s+ON\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*(?:FOR\\s*EACH\\s*ROW\\s)?(.*)~is' , $i -> result ( " SELECT sql FROM sqlite_master WHERE name = " . q ( $B )), $A ); return
array ( " Timing " => strtoupper ( $A [ 1 ]), " Event " => strtoupper ( $A [ 2 ]), " Trigger " => $B , " Statement " => $A [ 3 ]);} function
triggers ( $P ){ $I = array (); foreach ( get_rows ( " SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $P )) as $J ){ preg_match ( '~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*([a-z]+)\\s*([a-z]+)~i' , $J [ " sql " ], $A ); $I [ $J [ " name " ]] = array ( $A [ 1 ], $A [ 2 ]);} return $I ;} function
2012-06-04 16:58:40 +02:00
trigger_options (){ return
array ( " Timing " => array ( " BEFORE " , " AFTER " , " INSTEAD OF " ), " Type " => array ( " FOR EACH ROW " ),);} function
2013-07-27 17:43:34 +02:00
routine ( $B , $T ){} function
2012-06-04 16:58:40 +02:00
routines (){} function
2013-07-27 17:43:34 +02:00
routine_languages (){} function
2012-06-04 16:58:40 +02:00
begin (){ return
queries ( " BEGIN " );} function
2013-07-27 17:43:34 +02:00
insert_into ( $P , $N ){ return
queries ( " INSERT INTO " . table ( $P ) . ( $N ? " ( " . implode ( " , " , array_keys ( $N )) . " ) \n VALUES ( " . implode ( " , " , $N ) . " ) " : " DEFAULT VALUES " ));} function
insert_update ( $P , $N , $Qe ){ return
queries ( " REPLACE INTO " . table ( $P ) . " ( " . implode ( " , " , array_keys ( $N )) . " ) VALUES ( " . implode ( " , " , $N ) . " ) " );} function
last_id (){ global $i ; return $i -> result ( " SELECT LAST_INSERT_ROWID() " );} function
explain ( $i , $G ){ return $i -> query ( " EXPLAIN $G " );} function
found_rows ( $Q , $Z ){} function
2012-06-04 16:58:40 +02:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2013-07-27 17:43:34 +02:00
set_schema ( $zf ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
create_sql ( $P , $Aa ){ global $i ; $I = $i -> result ( " SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = " . q ( $P )); foreach ( indexes ( $P ) as $B => $u ){ if ( $B == '' ) continue ; $I .= " ; \n \n " . index_sql ( $P , $u [ 'type' ], $B , " ( " . implode ( " , " , array_map ( 'idf_escape' , $u [ 'columns' ])) . " ) " );} return $I ;} function
truncate_sql ( $P ){ return " DELETE FROM " . table ( $P );} function
use_sql ( $qb ){} function
trigger_sql ( $P , $Rf ){ return
implode ( get_vals ( " SELECT sql || ';; \n ' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = " . q ( $P )));} function
show_variables (){ global $i ; $I = array (); foreach ( array ( " auto_vacuum " , " cache_size " , " count_changes " , " default_cache_size " , " empty_result_callbacks " , " encoding " , " foreign_keys " , " full_column_names " , " fullfsync " , " journal_mode " , " journal_size_limit " , " legacy_file_format " , " locking_mode " , " page_size " , " max_page_count " , " read_uncommitted " , " recursive_triggers " , " reverse_unordered_selects " , " secure_delete " , " short_column_names " , " synchronous " , " temp_store " , " temp_store_directory " , " schema_version " , " integrity_check " , " quick_check " ) as $x ) $I [ $x ] = $i -> result ( " PRAGMA $x " ); return $I ;} function
show_status (){ $I = array (); foreach ( get_vals ( " PRAGMA compile_options " ) as $me ){ list ( $x , $X ) = explode ( " = " , $me , 2 ); $I [ $x ] = $X ;} return $I ;} function
convert_field ( $o ){} function
unconvert_field ( $o , $I ){ return $I ;} function
support ( $mc ){ return
ereg ( '^(view|trigger|variables|status|dump|move_col|drop_col)$' , $mc );} $w = " sqlite " ; $U = array ( " integer " => 0 , " real " => 0 , " numeric " => 0 , " text " => 0 , " blob " => 0 ); $Qf = array_keys ( $U ); $Kg = array (); $le = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Cc = array ( " hex " , " length " , " lower " , " round " , " unixepoch " , " upper " ); $Hc = array ( " avg " , " count " , " count distinct " , " group_concat " , " max " , " min " , " sum " ); $Lb = array ( array (), array ( " integer|real|numeric " => " +/- " , " text " => " || " ,));} $Eb [ " pgsql " ] = " PostgreSQL " ; if ( isset ( $_GET [ " pgsql " ])){ $Ne = array ( " PgSQL " , " PDO_PgSQL " ); define ( " DRIVER " , " pgsql " ); if ( extension_loaded ( " pgsql " )){ class
2012-06-04 16:58:40 +02:00
Min_DB { var $extension = " PgSQL " , $_link , $_result , $_string , $_database = true , $server_info , $affected_rows , $error ; function
2013-07-27 17:43:34 +02:00
_error ( $Wb , $n ){ if ( ini_bool ( " html_errors " )) $n = html_entity_decode ( strip_tags ( $n )); $n = ereg_replace ( '^[^:]*: ' , '' , $n ); $this -> error = $n ;} function
connect ( $M , $V , $E ){ global $b ; $m = $b -> database (); set_error_handler ( array ( $this , '_error' )); $this -> _string = " host=' " . str_replace ( " : " , " ' port=' " , addcslashes ( $M , " ' \\ " )) . " ' user=' " . addcslashes ( $V , " ' \\ " ) . " ' password=' " . addcslashes ( $E , " ' \\ " ) . " ' " ; $this -> _link =@ pg_connect ( " $this->_string dbname=' " . ( $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 ){ $Ug = pg_version ( $this -> _link ); $this -> server_info = $Ug [ " server " ]; pg_set_client_encoding ( $this -> _link , " UTF8 " );} return ( bool ) $this -> _link ;} function
quote ( $O ){ return " ' " . pg_escape_string ( $this -> _link , $O ) . " ' " ;} function
select_db ( $qb ){ global $b ; if ( $qb == $b -> database ()) return $this -> _database ; $I =@ pg_connect ( " $this->_string dbname=' " . addcslashes ( $qb , " ' \\ " ) . " ' " , PGSQL_CONNECT_FORCE_NEW ); if ( $I ) $this -> _link = $I ; return $I ;} function
close (){ $this -> _link =@ pg_connect ( " $this->_string dbname='postgres' " );} function
query ( $G , $Eg = false ){ $H =@ pg_query ( $this -> _link , $G ); $this -> error = " " ; if ( ! $H ){ $this -> error = pg_last_error ( $this -> _link ); return
false ;} elseif ( ! pg_num_fields ( $H )){ $this -> affected_rows = pg_affected_rows ( $H ); return
2012-06-04 16:58:40 +02:00
true ;} return
new
2013-07-27 17:43:34 +02:00
Min_Result ( $H );} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2012-06-04 16:58:40 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2013-07-27 17:43:34 +02:00
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! $H ||! $H -> num_rows ) return
false ; return
pg_fetch_result ( $H -> _result , 0 , $o );}} class
2012-06-04 16:58:40 +02:00
Min_Result { var $_result , $_offset = 0 , $num_rows ; function
2013-07-27 17:43:34 +02:00
Min_Result ( $H ){ $this -> _result = $H ; $this -> num_rows = pg_num_rows ( $H );} function
2012-06-04 16:58:40 +02:00
fetch_assoc (){ return
pg_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
pg_fetch_row ( $this -> _result );} function
2013-07-27 17:43:34 +02:00
fetch_field (){ $f = $this -> _offset ++ ; $I = new
stdClass ; if ( function_exists ( 'pg_field_table' )) $I -> orgtable = pg_field_table ( $this -> _result , $f ); $I -> name = pg_field_name ( $this -> _result , $f ); $I -> orgname = $I -> name ; $I -> type = pg_field_type ( $this -> _result , $f ); $I -> charsetnr = ( $I -> type == " bytea " ? 63 : 0 ); return $I ;} function
2012-06-04 16:58:40 +02:00
__destruct (){ pg_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_pgsql " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_PgSQL " ; function
2013-07-27 17:43:34 +02:00
connect ( $M , $V , $E ){ global $b ; $m = $b -> database (); $O = " pgsql:host=' " . str_replace ( " : " , " ' port=' " , addcslashes ( $M , " ' \\ " )) . " ' options='-c client_encoding=utf8' " ; $this -> dsn ( " $O dbname=' " . ( $m != " " ? addcslashes ( $m , " ' \\ " ) : " postgres " ) . " ' " , $V , $E ); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
select_db ( $qb ){ global $b ; return ( $b -> database () == $qb );} function
2012-06-04 16:58:40 +02:00
close (){}}} function
2013-07-27 17:43:34 +02:00
idf_escape ( $t ){ return '"' . str_replace ( '"' , '""' , $t ) . '"' ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ global $b ; $i = new
Min_DB ; $mb = $b -> credentials (); if ( $i -> connect ( $mb [ 0 ], $mb [ 1 ], $mb [ 2 ])){ if ( $i -> server_info >= 9 ) $i -> query ( " SET application_name = 'Adminer' " ); return $i ;} return $i -> error ;} function
2012-06-04 16:58:40 +02:00
get_databases (){ return
2013-07-27 17:43:34 +02:00
get_vals ( " SELECT datname FROM pg_database ORDER BY datname " );} function
limit ( $G , $Z , $y , $C = 0 , $Cf = " " ){ return " $G $Z " . ( $y !== null ? $Cf . " LIMIT $y " . ( $C ? " OFFSET $C " : " " ) : " " );} function
limit1 ( $G , $Z ){ return " $G $Z " ;} function
db_collation ( $m , $Xa ){ global $i ; return $i -> result ( " SHOW LC_COLLATE " );} function
2012-06-04 16:58:40 +02:00
engines (){ return
array ();} function
2013-07-27 17:43:34 +02:00
logged_user (){ global $i ; return $i -> result ( " SELECT user " );} function
2012-06-04 16:58:40 +02:00
tables_list (){ return
get_key_vals ( " SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema() ORDER BY table_name " );} function
2013-07-27 17:43:34 +02:00
count_tables ( $l ){ return
2012-06-04 16:58:40 +02:00
array ();} function
2013-07-27 17:43:34 +02:00
table_status ( $B = " " ){ $I = array (); foreach ( get_rows ( " SELECT relname AS \" Name \" , CASE relkind WHEN 'r' THEN '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 \"
2012-06-04 16:58:40 +02:00
FROM pg_class
WHERE relkind IN ( 'r' , 'v' )
2013-07-27 17:43:34 +02:00
AND relnamespace = ( SELECT oid FROM pg_namespace WHERE nspname = current_schema ())
" .( $B != " " ? " AND relname = " .q( $B ): " ORDER BY relname " ))as $J ) $I[$J["Name"] ]= $J ;return( $B != " " ? $I[$B] : $I );}function
is_view ( $Q ){ return $Q [ " Engine " ] == " view " ;} function
fk_support ( $Q ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
fields ( $P ){ $I = array (); $va = 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
2012-06-04 16:58:40 +02:00
FROM pg_class c
JOIN pg_namespace n ON c . relnamespace = n . oid
JOIN pg_attribute a ON c . oid = a . attrelid
LEFT JOIN pg_attrdef d ON c . oid = d . adrelid AND a . attnum = d . adnum
2013-07-27 17:43:34 +02:00
WHERE c . relname = " .q( $P ). "
2012-06-04 16:58:40 +02:00
AND n . nspname = current_schema ()
AND NOT a . attisdropped
AND a . attnum > 0
2013-07-27 17:43:34 +02:00
ORDER BY a . attnum " )as $J ) { $T = $J [ " full_type " ]; if ( ereg ( '(.+)\\((.*)\\)$' , $J [ " full_type " ], $A )) list (, $T , $J [ " length " ]) = $A ; $J [ " type " ] = ( $va [ $T ] ? $va [ $T ] : $T ); $J [ " full_type " ] = $J [ " type " ] . ( $J [ " length " ] ? " ( $J[length] ) " : " " ); $J [ " null " ] =! $J [ " attnotnull " ]; $J [ " auto_increment " ] = eregi ( " ^nextval \\ ( " , $J [ " default " ]); $J [ " privileges " ] = array ( " insert " => 1 , " select " => 1 , " update " => 1 ); if ( preg_match ( '~^(.*)::.+$~' , $J [ " default " ], $A )) $J [ " default " ] = ( $A [ 1 ][ 0 ] == " ' " ? idf_unescape ( $A [ 1 ]) : $A [ 1 ]); $I [ $J [ " field " ]] = $J ; } return $I ;}function
indexes ( $P , $j = null ){ global $i ; if ( ! is_object ( $j )) $j = $i ; $I = array (); $Zf = $j -> result ( " SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = " . q ( $P )); $g = get_key_vals ( " SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Zf AND attnum > 0 " , $j ); foreach ( get_rows ( " SELECT relname, indisunique::int, indisprimary::int, indkey, indoption FROM pg_index i, pg_class ci WHERE i.indrelid = $Zf AND ci.oid = i.indexrelid " , $j ) as $J ){ $kf = $J [ " relname " ]; $I [ $kf ][ " type " ] = ( $J [ " indisprimary " ] ? " PRIMARY " : ( $J [ " indisunique " ] ? " UNIQUE " : " INDEX " )); $I [ $kf ][ " columns " ] = array (); foreach ( explode ( " " , $J [ " indkey " ]) as $Uc ) $I [ $kf ][ " columns " ][] = $g [ $Uc ]; $I [ $kf ][ " descs " ] = array (); foreach ( explode ( " " , $J [ " indoption " ]) as $Vc ) $I [ $kf ][ " descs " ][] = ( $Vc & 1 ? '1' : null ); $I [ $kf ][ " lengths " ] = array ();} return $I ;} function
foreign_keys ( $P ){ global $he ; $I = array (); foreach ( get_rows ( " SELECT conname, pg_get_constraintdef(oid) AS definition
FROM pg_constraint
WHERE conrelid = ( SELECT pc . oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON ( pn . oid = pc . relnamespace ) WHERE pc . relname = " .q( $P ). " AND pn . nspname = current_schema ())
AND contype = 'f' :: char
ORDER BY conkey , conname " )as $J ) { if(preg_match('~FOREIGN KEY \ s* \ ((.+) \ ) \ s*REFERENCES (.+) \ ((.+) \ )(.*) $ ~iA', $J['definition'] , $A )) { $J [ 'source' ] = array_map ( 'trim' , explode ( ',' , $A [ 1 ])); $J [ 'table' ] = $A [ 2 ]; if ( preg_match ( '~(.+)\.(.+)~' , $A [ 2 ], $Ad )){ $J [ 'ns' ] = $Ad [ 1 ]; $J [ 'table' ] = $Ad [ 2 ]; } $J['target'] =array_map('trim',explode(',', $A[3] )); $J['on_delete'] =(preg_match( " ~ ON DELETE ( $he ) ~ " , $A[4] , $Ad )? $Ad[1] :'NO ACTION'); $J['on_update'] =(preg_match( " ~ ON UPDATE ( $he ) ~ " , $A[4] , $Ad )? $Ad[1] :'NO ACTION'); $I[$J['conname'] ]= $J ;}}return $I ;}function
view ( $B ){ global $i ; return
array ( " select " => $i -> result ( " SELECT pg_get_viewdef( " . q ( $B ) . " ) " ));} function
2012-06-04 16:58:40 +02:00
collations (){ return
array ();} function
2013-07-27 17:43:34 +02:00
information_schema ( $m ){ return ( $m == " information_schema " );} function
error (){ global $i ; $I = h ( $i -> error ); if ( preg_match ( '~^(.*\\n)?([^\\n]*)\\n( *)\\^(\\n.*)?$~s' , $I , $A )) $I = $A [ 1 ] . preg_replace ( '~((?:[^&]|&[^;]*;){' . strlen ( $A [ 3 ]) . '})(.*)~' , '\\1<b>\\2</b>' , $A [ 2 ]) . $A [ 4 ]; return
nl_br ( $I );} function
create_database ( $m , $e ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $e ? " ENCODING " . idf_escape ( $e ) : " " ));} function
drop_databases ( $l ){ global $i ; $i -> close (); return
apply_queries ( " DROP DATABASE " , $l , 'idf_escape' );} function
rename_database ( $B , $e ){ return
queries ( " ALTER DATABASE " . idf_escape ( DB ) . " RENAME TO " . idf_escape ( $B ));} function
2012-06-04 16:58:40 +02:00
auto_increment (){ return " " ;} function
2013-07-27 17:43:34 +02:00
alter_table ( $P , $B , $p , $tc , $bb , $Tb , $e , $Aa , $Ee ){ $c = array (); $Ze = array (); foreach ( $p
as $o ){ $f = idf_escape ( $o [ 0 ]); $X = $o [ 1 ]; if ( ! $X ) $c [] = " DROP $f " ; else { $Rg = $X [ 5 ]; unset ( $X [ 5 ]); if ( isset ( $X [ 6 ]) && $o [ 0 ] == " " ) $X [ 1 ] = ( $X [ 1 ] == " bigint " ? " big " : " " ) . " serial " ; if ( $o [ 0 ] == " " ) $c [] = ( $P != " " ? " ADD " : " " ) . implode ( $X ); else { if ( $f != $X [ 0 ]) $Ze [] = " ALTER TABLE " . table ( $P ) . " RENAME $f TO $X[0] " ; $c [] = " ALTER $f TYPE $X[1] " ; if ( ! $X [ 6 ]){ $c [] = " ALTER $f " . ( $X [ 3 ] ? " SET $X[3] " : " DROP DEFAULT " ); $c [] = " ALTER $f " . ( $X [ 2 ] == " NULL " ? " DROP NOT " : " SET " ) . $X [ 2 ];}} if ( $o [ 0 ] != " " || $Rg != " " ) $Ze [] = " COMMENT ON COLUMN " . table ( $P ) . " . $X[0] IS " . ( $Rg != " " ? substr ( $Rg , 9 ) : " '' " );}} $c = array_merge ( $c , $tc ); if ( $P == " " ) array_unshift ( $Ze , " CREATE TABLE " . table ( $B ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); elseif ( $c ) array_unshift ( $Ze , " ALTER TABLE " . table ( $P ) . " \n " . implode ( " , \n " , $c )); if ( $P != " " && $P != $B ) $Ze [] = " ALTER TABLE " . table ( $P ) . " RENAME TO " . table ( $B ); if ( $P != " " || $bb != " " ) $Ze [] = " COMMENT ON TABLE " . table ( $B ) . " IS " . q ( $bb ); if ( $Aa != " " ){} foreach ( $Ze
as $G ){ if ( ! queries ( $G )) return
false ;} return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
alter_indexes ( $P , $c ){ $k = array (); $Fb = array (); $Ze = array (); foreach ( $c
as $X ){ if ( $X [ 0 ] != " INDEX " ) $k [] = ( $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 " : " " ) . $X [ 2 ]); elseif ( $X [ 2 ] == " DROP " ) $Fb [] = idf_escape ( $X [ 1 ]); else $Ze [] = " CREATE INDEX " . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $P . " _ " )) . " ON " . table ( $P ) . " $X[2] " ;} if ( $k ) array_unshift ( $Ze , " ALTER TABLE " . table ( $P ) . implode ( " , " , $k )); if ( $Fb ) array_unshift ( $Ze , " DROP INDEX " . implode ( " , " , $Fb )); foreach ( $Ze
as $G ){ if ( ! queries ( $G )) return
false ;} return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
truncate_tables ( $R ){ return
queries ( " TRUNCATE " . implode ( " , " , array_map ( 'table' , $R ))); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
drop_views ( $Wg ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $Wg )));} function
drop_tables ( $R ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $R )));} function
move_tables ( $R , $Wg , $fg ){ foreach ( $R
as $P ){ if ( ! queries ( " ALTER TABLE " . table ( $P ) . " SET SCHEMA " . idf_escape ( $fg ))) return
false ;} foreach ( $Wg
as $P ){ if ( ! queries ( " ALTER VIEW " . table ( $P ) . " SET SCHEMA " . idf_escape ( $fg ))) return
false ;} return
true ;} function
trigger ( $B ){ if ( $B == " " ) return
array ( " Statement " => " EXECUTE PROCEDURE () " ); $K = 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 ( $B )); return
reset ( $K );} function
triggers ( $P ){ $I = array (); foreach ( get_rows ( " SELECT * FROM information_schema.triggers WHERE event_object_table = " . q ( $P )) as $J ) $I [ $J [ " trigger_name " ]] = array ( $J [ " condition_timing " ], $J [ " event_manipulation " ]); return $I ;} function
2012-06-04 16:58:40 +02:00
trigger_options (){ return
array ( " Timing " => array ( " BEFORE " , " AFTER " ), " Type " => array ( " FOR EACH ROW " , " FOR EACH STATEMENT " ),);} function
2013-07-27 17:43:34 +02: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
2012-06-04 16:58:40 +02:00
begin (){ return
queries ( " BEGIN " );} function
2013-07-27 17:43:34 +02:00
insert_into ( $P , $N ){ return
queries ( " INSERT INTO " . table ( $P ) . ( $N ? " ( " . implode ( " , " , array_keys ( $N )) . " ) \n VALUES ( " . implode ( " , " , $N ) . " ) " : " DEFAULT VALUES " ));} function
insert_update ( $P , $N , $Qe ){ global $i ; $Lg = array (); $Z = array (); foreach ( $N
as $x => $X ){ $Lg [] = " $x = $X " ; if ( isset ( $Qe [ idf_unescape ( $x )])) $Z [] = " $x = $X " ;} return ( $Z && queries ( " UPDATE " . table ( $P ) . " SET " . implode ( " , " , $Lg ) . " WHERE " . implode ( " AND " , $Z )) && $i -> affected_rows ) || queries ( " INSERT INTO " . table ( $P ) . " ( " . implode ( " , " , array_keys ( $N )) . " ) VALUES ( " . implode ( " , " , $N ) . " ) " );} function
2012-06-04 16:58:40 +02:00
last_id (){ return
0 ;} function
2013-07-27 17:43:34 +02:00
explain ( $i , $G ){ return $i -> query ( " EXPLAIN $G " );} function
found_rows ( $Q , $Z ){ global $i ; if ( ereg ( " rows=([0-9]+) " , $i -> result ( " EXPLAIN SELECT * FROM " . idf_escape ( $Q [ " Name " ]) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " )), $jf )) return $jf [ 1 ]; return
false ;} function
2012-06-04 16:58:40 +02:00
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
2013-07-27 17:43:34 +02:00
get_vals ( " SELECT nspname FROM pg_namespace ORDER BY nspname " );} function
get_schema (){ global $i ; return $i -> result ( " SELECT current_schema() " );} function
set_schema ( $yf ){ global $i , $U , $Qf ; $I = $i -> query ( " SET search_path TO " . idf_escape ( $yf )); foreach ( types () as $T ){ if ( ! isset ( $U [ $T ])){ $U [ $T ] = 0 ; $Qf [ lang ( 13 )][] = $T ;}} return $I ;} function
use_sql ( $qb ){ return " \ connect " . idf_escape ( $qb );} function
2012-06-04 16:58:40 +02:00
show_variables (){ return
get_key_vals ( " SHOW ALL " );} function
2013-07-27 17:43:34 +02:00
process_list (){ global $i ; return
get_rows ( " SELECT * FROM pg_stat_activity ORDER BY " . ( $i -> server_info < 9.2 ? " procpid " : " pid " ));} function
2012-06-04 16:58:40 +02:00
show_status (){} function
2013-07-27 17:43:34 +02:00
convert_field ( $o ){} function
unconvert_field ( $o , $I ){ return $I ;} function
support ( $mc ){ return
ereg ( '^(comment|view|scheme|processlist|sequence|trigger|type|variables|drop_col)$' , $mc );} $w = " pgsql " ; $U = array (); $Qf = array (); foreach ( array ( lang ( 14 ) => array ( " smallint " => 5 , " integer " => 10 , " bigint " => 19 , " boolean " => 1 , " numeric " => 0 , " real " => 7 , " double precision " => 16 , " money " => 20 ), lang ( 15 ) => array ( " date " => 13 , " time " => 17 , " timestamp " => 20 , " timestamptz " => 21 , " interval " => 0 ), lang ( 16 ) => array ( " character " => 0 , " character varying " => 0 , " text " => 0 , " tsquery " => 0 , " tsvector " => 0 , " uuid " => 0 , " xml " => 0 ), lang ( 17 ) => array ( " bit " => 0 , " bit varying " => 0 , " bytea " => 0 ), lang ( 18 ) => array ( " cidr " => 43 , " inet " => 43 , " macaddr " => 17 , " txid_snapshot " => 0 ), lang ( 19 ) => array ( " box " => 0 , " circle " => 0 , " line " => 0 , " lseg " => 0 , " path " => 0 , " point " => 0 , " polygon " => 0 ),) as $x => $X ){ $U += $X ; $Qf [ $x ] = array_keys ( $X );} $Kg = array (); $le = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " ~ " , " !~ " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " ); $Cc = array ( " char_length " , " lower " , " round " , " to_hex " , " to_timestamp " , " upper " ); $Hc = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $Lb = array ( array ( " char " => " md5 " , " date|time " => " now " ,), array ( " int|numeric|real|money " => " +/- " , " date|time " => " + interval/- interval " , " char|text " => " || " ,));} $Eb [ " oracle " ] = " Oracle " ; if ( isset ( $_GET [ " oracle " ])){ $Ne = array ( " OCI8 " , " PDO_OCI " ); define ( " DRIVER " , " oracle " ); if ( extension_loaded ( " oci8 " )){ class
Min_DB { var $extension = " oci8 " , $_link , $_result , $server_info , $affected_rows , $errno , $error ; function
_error ( $Wb , $n ){ if ( ini_bool ( " html_errors " )) $n = html_entity_decode ( strip_tags ( $n )); $n = ereg_replace ( '^[^:]*: ' , '' , $n ); $this -> error = $n ;} function
connect ( $M , $V , $E ){ $this -> _link =@ oci_new_connect ( $V , $E , $M , " AL32UTF8 " ); if ( $this -> _link ){ $this -> server_info = oci_server_version ( $this -> _link ); return
2012-06-04 16:58:40 +02:00
true ;} $n = oci_error (); $this -> error = $n [ " message " ]; return
false ;} function
2013-07-27 17:43:34 +02:00
quote ( $O ){ return " ' " . str_replace ( " ' " , " '' " , $O ) . " ' " ;} function
select_db ( $qb ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
query ( $G , $Eg = false ){ $H = oci_parse ( $this -> _link , $G ); $this -> error = " " ; if ( ! $H ){ $n = oci_error ( $this -> _link ); $this -> errno = $n [ " code " ]; $this -> error = $n [ " message " ]; return
false ;} set_error_handler ( array ( $this , '_error' )); $I =@ oci_execute ( $H ); restore_error_handler (); if ( $I ){ if ( oci_num_fields ( $H )) return
2012-06-04 16:58:40 +02:00
new
2013-07-27 17:43:34 +02:00
Min_Result ( $H ); $this -> affected_rows = oci_num_rows ( $H );} return $I ;} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2012-06-04 16:58:40 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2013-07-27 17:43:34 +02:00
result ( $G , $o = 1 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H ) ||! oci_fetch ( $H -> _result )) return
false ; return
oci_result ( $H -> _result , $o );}} class
2012-06-04 16:58:40 +02:00
Min_Result { var $_result , $_offset = 1 , $num_rows ; function
2013-07-27 17:43:34 +02:00
Min_Result ( $H ){ $this -> _result = $H ;} function
_convert ( $J ){ foreach (( array ) $J
as $x => $X ){ if ( is_a ( $X , 'OCI-Lob' )) $J [ $x ] = $X -> load ();} return $J ;} function
2012-06-04 16:58:40 +02:00
fetch_assoc (){ return $this -> _convert ( oci_fetch_assoc ( $this -> _result ));} function
fetch_row (){ return $this -> _convert ( oci_fetch_row ( $this -> _result ));} function
2013-07-27 17:43:34 +02:00
fetch_field (){ $f = $this -> _offset ++ ; $I = new
stdClass ; $I -> name = oci_field_name ( $this -> _result , $f ); $I -> orgname = $I -> name ; $I -> type = oci_field_type ( $this -> _result , $f ); $I -> charsetnr = ( ereg ( " raw|blob|bfile " , $I -> type ) ? 63 : 0 ); return $I ;} function
2012-06-04 16:58:40 +02:00
__destruct (){ oci_free_statement ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_oci " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_OCI " ; function
2013-07-27 17:43:34 +02:00
connect ( $M , $V , $E ){ $this -> dsn ( " oci:dbname=// $M ;charset=AL32UTF8 " , $V , $E ); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
select_db ( $qb ){ return
2012-06-04 16:58:40 +02:00
true ;}}} function
2013-07-27 17:43:34 +02:00
idf_escape ( $t ){ return '"' . str_replace ( '"' , '""' , $t ) . '"' ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ global $b ; $i = new
Min_DB ; $mb = $b -> credentials (); if ( $i -> connect ( $mb [ 0 ], $mb [ 1 ], $mb [ 2 ])) return $i ; return $i -> error ;} function
2012-06-04 16:58:40 +02:00
get_databases (){ return
get_vals ( " SELECT tablespace_name FROM user_tablespaces " );} function
2013-07-27 17:43:34 +02:00
limit ( $G , $Z , $y , $C = 0 , $Cf = " " ){ return ( $C ? " * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $G $Z ) t WHERE rownum <= " . ( $y + $C ) . " ) WHERE rnum > $C " : ( $y !== null ? " * FROM (SELECT $G $Z ) WHERE rownum <= " . ( $y + $C ) : " $G $Z " ));} function
limit1 ( $G , $Z ){ return " $G $Z " ;} function
db_collation ( $m , $Xa ){ global $i ; return $i -> result ( " SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET' " );} function
2012-06-04 16:58:40 +02:00
engines (){ return
array ();} function
2013-07-27 17:43:34 +02:00
logged_user (){ global $i ; return $i -> result ( " SELECT USER FROM DUAL " );} function
2012-06-04 16:58:40 +02:00
tables_list (){ return
get_key_vals ( " SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = " . q ( DB ) . "
2013-07-27 17:43:34 +02:00
UNION SELECT view_name , 'view' FROM user_views
ORDER BY 1 " );}function
count_tables ( $l ){ return
2012-06-04 16:58:40 +02:00
array ();} function
2013-07-27 17:43:34 +02:00
table_status ( $B = " " ){ $I = array (); $_f = q ( $B ); foreach ( get_rows ( 'SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = ' . q ( DB ) . ( $B != " " ? " AND table_name = $_f " : " " ) . "
UNION SELECT view_name , 'view' , 0 , 0 FROM user_views " .( $B != " " ? " WHERE view_name = $_f " : " " ). "
ORDER BY 1 " )as $J ) { if( $B != " " )return $J ; $I[$J["Name"] ]= $J ;}return $I ;}function
is_view ( $Q ){ return $Q [ " Engine " ] == " view " ;} function
fk_support ( $Q ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
fields ( $P ){ $I = array (); foreach ( get_rows ( " SELECT * FROM all_tab_columns WHERE table_name = " . q ( $P ) . " ORDER BY column_id " ) as $J ){ $T = $J [ " DATA_TYPE " ]; $vd = " $J[DATA_PRECISION] , $J[DATA_SCALE] " ; if ( $vd == " , " ) $vd = $J [ " DATA_LENGTH " ]; $I [ $J [ " COLUMN_NAME " ]] = array ( " field " => $J [ " COLUMN_NAME " ], " full_type " => $T . ( $vd ? " ( $vd ) " : " " ), " type " => strtolower ( $T ), " length " => $vd , " default " => $J [ " DATA_DEFAULT " ], " null " => ( $J [ " NULLABLE " ] == " Y " ), " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ),);} return $I ;} function
indexes ( $P , $j = null ){ $I = array (); foreach ( get_rows ( " SELECT uic.*, uc.constraint_type
FROM user_ind_columns uic
LEFT JOIN user_constraints uc ON uic . index_name = uc . constraint_name AND uic . table_name = uc . table_name
WHERE uic . table_name = " .q( $P ). "
ORDER BY uc . constraint_type , uic . column_position " , $j )as $J ) { $Sc = $J [ " INDEX_NAME " ]; $I [ $Sc ][ " type " ] = ( $J [ " CONSTRAINT_TYPE " ] == " P " ? " PRIMARY " : ( $J [ " CONSTRAINT_TYPE " ] == " U " ? " UNIQUE " : " INDEX " )); $I [ $Sc ][ " columns " ][] = $J [ " COLUMN_NAME " ]; $I [ $Sc ][ " lengths " ][] = ( $J [ " CHAR_LENGTH " ] && $J [ " CHAR_LENGTH " ] != $J [ " COLUMN_LENGTH " ] ? $J [ " CHAR_LENGTH " ] : null ); $I [ $Sc ][ " descs " ][] = ( $J [ " DESCEND " ] ? '1' : null ); } return $I ;}function
view ( $B ){ $K = get_rows ( 'SELECT text "select" FROM user_views WHERE view_name = ' . q ( $B )); return
reset ( $K );} function
2012-06-04 16:58:40 +02:00
collations (){ return
array ();} function
2013-07-27 17:43:34 +02:00
information_schema ( $m ){ return
2012-06-04 16:58:40 +02:00
false ;} function
2013-07-27 17:43:34 +02:00
error (){ global $i ; return
h ( $i -> error );} function
explain ( $i , $G ){ $i -> query ( " EXPLAIN PLAN FOR $G " ); return $i -> query ( " SELECT * FROM plan_table " );} function
found_rows ( $Q , $Z ){} function
alter_table ( $P , $B , $p , $tc , $bb , $Tb , $e , $Aa , $Ee ){ $c = $Fb = array (); foreach ( $p
as $o ){ $X = $o [ 1 ]; if ( $X && $o [ 0 ] != " " && idf_escape ( $o [ 0 ]) != $X [ 0 ]) queries ( " ALTER TABLE " . table ( $P ) . " RENAME COLUMN " . idf_escape ( $o [ 0 ]) . " TO $X[0] " ); if ( $X ) $c [] = ( $P != " " ? ( $o [ 0 ] != " " ? " MODIFY ( " : " ADD ( " ) : " " ) . implode ( $X ) . ( $P != " " ? " ) " : " " ); else $Fb [] = idf_escape ( $o [ 0 ]);} if ( $P == " " ) return
queries ( " CREATE TABLE " . table ( $B ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) " ); return ( ! $c || queries ( " ALTER TABLE " . table ( $P ) . " \n " . implode ( " \n " , $c ))) && ( ! $Fb || queries ( " ALTER TABLE " . table ( $P ) . " DROP ( " . implode ( " , " , $Fb ) . " ) " )) && ( $P == $B || queries ( " ALTER TABLE " . table ( $P ) . " RENAME TO " . table ( $B )));} function
foreign_keys ( $P ){ return
2012-06-04 16:58:40 +02:00
array ();} function
2013-07-27 17:43:34 +02:00
truncate_tables ( $R ){ return
apply_queries ( " TRUNCATE TABLE " , $R );} function
drop_views ( $Wg ){ return
apply_queries ( " DROP VIEW " , $Wg );} function
drop_tables ( $R ){ return
apply_queries ( " DROP TABLE " , $R );} function
2012-06-04 16:58:40 +02:00
begin (){ return
true ;} function
2013-07-27 17:43:34 +02:00
insert_into ( $P , $N ){ return
queries ( " INSERT INTO " . table ( $P ) . " ( " . implode ( " , " , array_keys ( $N )) . " ) \n VALUES ( " . implode ( " , " , $N ) . " ) " );} function
2012-06-04 16:58:40 +02:00
last_id (){ return
0 ;} function
schemas (){ return
2013-07-27 17:43:34 +02:00
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 $i ; return $i -> result ( " SELECT sys_context('USERENV', 'SESSION_USER') FROM dual " );} function
set_schema ( $zf ){ global $i ; return $i -> query ( " ALTER SESSION SET CURRENT_SCHEMA = " . idf_escape ( $zf ));} function
2012-06-04 16:58:40 +02:00
show_variables (){ return
get_key_vals ( 'SELECT name, display_value FROM v$parameter' );} function
2013-07-27 17:43:34 +02:00
process_list (){ return
get_rows ( ' SELECT sess . process AS " process " , sess . username AS " user " , sess . schemaname AS " schema " , sess . status AS " status " , sess . wait_class AS " wait_class " , sess . seconds_in_wait AS " seconds_in_wait " , sql . sql_text AS " sql_text " , sess . machine AS " machine " , sess . port AS " port "
FROM v $session sess LEFT OUTER JOIN v $sql sql
ON sql . sql_id = sess . sql_id
WHERE sess . type = \ ' USER\ '
ORDER BY PROCESS
' );} function
show_status (){ $K = get_rows ( 'SELECT * FROM v$instance' ); return
reset ( $K );} function
convert_field ( $o ){} function
unconvert_field ( $o , $I ){ return $I ;} function
support ( $mc ){ return
ereg ( " view|scheme|processlist|drop_col|variables|status " , $mc );} $w = " oracle " ; $U = array (); $Qf = array (); foreach ( array ( lang ( 14 ) => array ( " number " => 38 , " binary_float " => 12 , " binary_double " => 21 ), lang ( 15 ) => array ( " date " => 10 , " timestamp " => 29 , " interval year " => 12 , " interval day " => 28 ), lang ( 16 ) => array ( " char " => 2000 , " varchar2 " => 4000 , " nchar " => 2000 , " nvarchar2 " => 4000 , " clob " => 4294967295 , " nclob " => 4294967295 ), lang ( 17 ) => array ( " raw " => 2000 , " long raw " => 2147483648 , " blob " => 4294967295 , " bfile " => 4294967296 ),) as $x => $X ){ $U += $X ; $Qf [ $x ] = array_keys ( $X );} $Kg = array (); $le = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT REGEXP " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Cc = array ( " length " , " lower " , " round " , " upper " ); $Hc = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $Lb = array ( array ( " date " => " current_date " , " timestamp " => " current_timestamp " ,), array ( " number|float|double " => " +/- " , " date|timestamp " => " + interval/- interval " , " char|clob " => " || " ,));} $Eb [ " mssql " ] = " MS SQL " ; if ( isset ( $_GET [ " mssql " ])){ $Ne = array ( " SQLSRV " , " MSSQL " ); define ( " DRIVER " , " mssql " ); if ( extension_loaded ( " sqlsrv " )){ class
Min_DB { var $extension = " sqlsrv " , $_link , $_result , $server_info , $affected_rows , $errno , $error ; function
_get_error (){ $this -> error = " " ; foreach ( sqlsrv_errors () as $n ){ $this -> errno = $n [ " code " ]; $this -> error .= " $n[message] \n " ;} $this -> error = rtrim ( $this -> error );} function
connect ( $M , $V , $E ){ $this -> _link =@ sqlsrv_connect ( $M , array ( " UID " => $V , " PWD " => $E , " CharacterSet " => " UTF-8 " )); if ( $this -> _link ){ $Wc = sqlsrv_server_info ( $this -> _link ); $this -> server_info = $Wc [ 'SQLServerVersion' ];} else $this -> _get_error (); return ( bool ) $this -> _link ;} function
quote ( $O ){ return " ' " . str_replace ( " ' " , " '' " , $O ) . " ' " ;} function
select_db ( $qb ){ return $this -> query ( " USE " . idf_escape ( $qb ));} function
query ( $G , $Eg = false ){ $H = sqlsrv_query ( $this -> _link , $G ); $this -> error = " " ; if ( ! $H ){ $this -> _get_error (); return
false ;} return $this -> store_result ( $H );} function
multi_query ( $G ){ $this -> _result = sqlsrv_query ( $this -> _link , $G ); $this -> error = " " ; if ( ! $this -> _result ){ $this -> _get_error (); return
2012-06-04 16:58:40 +02:00
false ;} return
true ;} function
2013-07-27 17:43:34 +02:00
store_result ( $H = null ){ if ( ! $H ) $H = $this -> _result ; if ( sqlsrv_field_metadata ( $H )) return
2012-06-04 16:58:40 +02:00
new
2013-07-27 17:43:34 +02:00
Min_Result ( $H ); $this -> affected_rows = sqlsrv_rows_affected ( $H ); return
2012-06-04 16:58:40 +02:00
true ;} function
next_result (){ return
sqlsrv_next_result ( $this -> _result );} function
2013-07-27 17:43:34 +02:00
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
false ; $J = $H -> fetch_row (); return $J [ $o ];}} class
2012-06-04 16:58:40 +02:00
Min_Result { var $_result , $_offset = 0 , $_fields , $num_rows ; function
2013-07-27 17:43:34 +02:00
Min_Result ( $H ){ $this -> _result = $H ;} function
_convert ( $J ){ foreach (( array ) $J
as $x => $X ){ if ( is_a ( $X , 'DateTime' )) $J [ $x ] = $X -> format ( " Y-m-d H:i:s " );} return $J ;} function
2012-06-04 16:58:40 +02:00
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
2013-07-27 17:43:34 +02:00
fetch_field (){ if ( ! $this -> _fields ) $this -> _fields = sqlsrv_field_metadata ( $this -> _result ); $o = $this -> _fields [ $this -> _offset ++ ]; $I = new
stdClass ; $I -> name = $o [ " Name " ]; $I -> orgname = $o [ " Name " ]; $I -> type = ( $o [ " Type " ] == 1 ? 254 : 0 ); return $I ;} function
seek ( $C ){ for ( $s = 0 ; $s < $C ; $s ++ ) sqlsrv_fetch ( $this -> _result );} function
2012-06-04 16:58:40 +02:00
__destruct (){ sqlsrv_free_stmt ( $this -> _result );}}} elseif ( extension_loaded ( " mssql " )){ class
Min_DB { var $extension = " MSSQL " , $_link , $_result , $server_info , $affected_rows , $error ; function
2013-07-27 17:43:34 +02:00
connect ( $M , $V , $E ){ $this -> _link =@ mssql_connect ( $M , $V , $E ); if ( $this -> _link ){ $H = $this -> query ( " SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition') " ); $J = $H -> fetch_row (); $this -> server_info = $this -> result ( " sp_server_info 2 " , 2 ) . " [ $J[0] ] $J[1] " ;} else $this -> error = mssql_get_last_message (); return ( bool ) $this -> _link ;} function
quote ( $O ){ return " ' " . str_replace ( " ' " , " '' " , $O ) . " ' " ;} function
select_db ( $qb ){ return
mssql_select_db ( $qb );} function
query ( $G , $Eg = false ){ $H = mssql_query ( $G , $this -> _link ); $this -> error = " " ; if ( ! $H ){ $this -> error = mssql_get_last_message (); return
false ;} if ( $H === true ){ $this -> affected_rows = mssql_rows_affected ( $this -> _link ); return
2012-06-04 16:58:40 +02:00
true ;} return
new
2013-07-27 17:43:34 +02:00
Min_Result ( $H );} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2012-06-04 16:58:40 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
mssql_next_result ( $this -> _result );} function
2013-07-27 17:43:34 +02:00
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! is_object ( $H )) return
false ; return
mssql_result ( $H -> _result , 0 , $o );}} class
2012-06-04 16:58:40 +02:00
Min_Result { var $_result , $_offset = 0 , $_fields , $num_rows ; function
2013-07-27 17:43:34 +02:00
Min_Result ( $H ){ $this -> _result = $H ; $this -> num_rows = mssql_num_rows ( $H );} function
2012-06-04 16:58:40 +02:00
fetch_assoc (){ return
mssql_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
mssql_fetch_row ( $this -> _result );} function
num_rows (){ return
mssql_num_rows ( $this -> _result );} function
2013-07-27 17:43:34 +02:00
fetch_field (){ $I = mssql_fetch_field ( $this -> _result ); $I -> orgtable = $I -> table ; $I -> orgname = $I -> name ; return $I ;} function
seek ( $C ){ mssql_data_seek ( $this -> _result , $C );} function
2012-06-04 16:58:40 +02:00
__destruct (){ mssql_free_result ( $this -> _result );}}} function
2013-07-27 17:43:34 +02:00
idf_escape ( $t ){ return " [ " . str_replace ( " ] " , " ]] " , $t ) . " ] " ;} function
table ( $t ){ return ( $_GET [ " ns " ] != " " ? idf_escape ( $_GET [ " ns " ]) . " . " : " " ) . idf_escape ( $t );} function
connect (){ global $b ; $i = new
Min_DB ; $mb = $b -> credentials (); if ( $i -> connect ( $mb [ 0 ], $mb [ 1 ], $mb [ 2 ])) return $i ; return $i -> error ;} function
2012-06-04 16:58:40 +02:00
get_databases (){ return
get_vals ( " EXEC sp_databases " );} function
2013-07-27 17:43:34 +02:00
limit ( $G , $Z , $y , $C = 0 , $Cf = " " ){ return ( $y !== null ? " TOP ( " . ( $y + $C ) . " ) " : " " ) . " $G $Z " ;} function
limit1 ( $G , $Z ){ return
limit ( $G , $Z , 1 );} function
db_collation ( $m , $Xa ){ global $i ; return $i -> result ( " SELECT collation_name FROM sys.databases WHERE name = " . q ( $m ));} function
2012-06-04 16:58:40 +02:00
engines (){ return
array ();} function
2013-07-27 17:43:34 +02:00
logged_user (){ global $i ; return $i -> result ( " SELECT SUSER_NAME() " );} function
2012-06-04 16:58:40 +02:00
tables_list (){ return
get_key_vals ( " SELECT name, type_desc FROM sys.all_objects WHERE schema_id = SCHEMA_ID( " . q ( get_schema ()) . " ) AND type IN ('S', 'U', 'V') ORDER BY name " );} function
2013-07-27 17:43:34 +02:00
count_tables ( $l ){ global $i ; $I = array (); foreach ( $l
as $m ){ $i -> select_db ( $m ); $I [ $m ] = $i -> result ( " SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES " );} return $I ;} function
table_status ( $B = " " ){ $I = array (); foreach ( get_rows ( " SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID( " . q ( get_schema ()) . " ) AND type IN ('S', 'U', 'V') " . ( $B != " " ? " AND name = " . q ( $B ) : " ORDER BY name " )) as $J ){ if ( $B != " " ) return $J ; $I [ $J [ " Name " ]] = $J ;} return $I ;} function
is_view ( $Q ){ return $Q [ " Engine " ] == " VIEW " ;} function
fk_support ( $Q ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
fields ( $P ){ $I = array (); foreach ( get_rows ( " SELECT c.*, t.name type, d.definition [default]
2012-06-04 16:58:40 +02:00
FROM sys . all_columns c
JOIN sys . all_objects o ON c . object_id = o . object_id
JOIN sys . types t ON c . user_type_id = t . user_type_id
LEFT JOIN sys . default_constraints d ON c . default_object_id = d . parent_column_id
2013-07-27 17:43:34 +02:00
WHERE o . schema_id = SCHEMA_ID ( " .q(get_schema()). " ) AND o . type IN ( 'S' , 'U' , 'V' ) AND o . name = " .q( $P ))as $J ) { $T = $J [ " type " ]; $vd = ( ereg ( " char|binary " , $T ) ? $J [ " max_length " ] : ( $T == " decimal " ? " $J[precision] , $J[scale] " : " " )); $I [ $J [ " name " ]] = array ( " field " => $J [ " name " ], " full_type " => $T . ( $vd ? " ( $vd ) " : " " ), " type " => $T , " length " => $vd , " default " => $J [ " default " ], " null " => $J [ " is_nullable " ], " auto_increment " => $J [ " is_identity " ], " collation " => $J [ " collation_name " ], " privileges " => array ( " insert " => 1 , " select " => 1 , " update " => 1 ), " primary " => $J [ " is_identity " ],); } return $I ;}function
indexes ( $P , $j = null ){ $I = array (); foreach ( get_rows ( " SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
2012-06-04 16:58:40 +02:00
FROM sys . indexes i
INNER JOIN sys . index_columns ic ON i . object_id = ic . object_id AND i . index_id = ic . index_id
INNER JOIN sys . columns c ON ic . object_id = c . object_id AND ic . column_id = c . column_id
2013-07-27 17:43:34 +02:00
WHERE OBJECT_NAME ( i . object_id ) = " .q( $P ), $j )as $J ) { $B = $J [ " name " ]; $I [ $B ][ " type " ] = ( $J [ " is_primary_key " ] ? " PRIMARY " : ( $J [ " is_unique " ] ? " UNIQUE " : " INDEX " )); $I [ $B ][ " lengths " ] = array (); $I [ $B ][ " columns " ][ $J [ " key_ordinal " ]] = $J [ " column_name " ]; $I [ $B ][ " descs " ][ $J [ " key_ordinal " ]] = ( $J [ " is_descending_key " ] ? '1' : null ); } return $I ;}function
view ( $B ){ global $i ; return
array ( " select " => preg_replace ( '~^(?:[^[]|\\[[^]]*])*\\s+AS\\s+~isU' , '' , $i -> result ( " SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = " . q ( $B ))));} function
collations (){ $I = array (); foreach ( get_vals ( " SELECT name FROM fn_helpcollations() " ) as $e ) $I [ ereg_replace ( " _.* " , " " , $e )][] = $e ; return $I ;} function
information_schema ( $m ){ return
2012-06-04 16:58:40 +02:00
false ;} function
2013-07-27 17:43:34 +02:00
error (){ global $i ; return
nl_br ( h ( preg_replace ( '~^(\\[[^]]*])+~m' , '' , $i -> error )));} function
create_database ( $m , $e ){ return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( eregi ( '^[a-z0-9_]+$' , $e ) ? " COLLATE $e " : " " ));} function
drop_databases ( $l ){ return
queries ( " DROP DATABASE " . implode ( " , " , array_map ( 'idf_escape' , $l )));} function
rename_database ( $B , $e ){ if ( eregi ( '^[a-z0-9_]+$' , $e )) queries ( " ALTER DATABASE " . idf_escape ( DB ) . " COLLATE $e " ); queries ( " ALTER DATABASE " . idf_escape ( DB ) . " MODIFY NAME = " . idf_escape ( $B )); return
2012-06-04 16:58:40 +02:00
true ;} function
auto_increment (){ return " IDENTITY " . ( $_POST [ " Auto_increment " ] != " " ? " ( " . ( + $_POST [ " Auto_increment " ]) . " ,1) " : " " ) . " PRIMARY KEY " ;} function
2013-07-27 17:43:34 +02:00
alter_table ( $P , $B , $p , $tc , $bb , $Tb , $e , $Aa , $Ee ){ $c = array (); foreach ( $p
as $o ){ $f = idf_escape ( $o [ 0 ]); $X = $o [ 1 ]; if ( ! $X ) $c [ " DROP " ][] = " COLUMN $f " ; else { $X [ 1 ] = preg_replace ( " ~( COLLATE )'( \\ w+)'~ " , " \\ 1 \\ 2 " , $X [ 1 ]); if ( $o [ 0 ] == " " ) $c [ " ADD " ][] = " \n " . implode ( " " , $X ) . ( $P == " " ? substr ( $tc [ $X [ 0 ]], 16 + strlen ( $X [ 0 ])) : " " ); else { unset ( $X [ 6 ]); if ( $f != $X [ 0 ]) queries ( " EXEC sp_rename " . q ( table ( $P ) . " . $f " ) . " , " . q ( idf_unescape ( $X [ 0 ])) . " , 'COLUMN' " ); $c [ " ALTER COLUMN " . implode ( " " , $X )][] = " " ;}}} if ( $P == " " ) return
queries ( " CREATE TABLE " . table ( $B ) . " ( " . implode ( " , " ,( array ) $c [ " ADD " ]) . " \n ) " ); if ( $P != $B ) queries ( " EXEC sp_rename " . q ( table ( $P )) . " , " . q ( $B )); if ( $tc ) $c [ " " ] = $tc ; foreach ( $c
as $x => $X ){ if ( ! queries ( " ALTER TABLE " . idf_escape ( $B ) . " $x " . implode ( " , " , $X ))) return
false ;} return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
alter_indexes ( $P , $c ){ $u = array (); $Fb = array (); foreach ( $c
as $X ){ if ( $X [ 2 ] == " DROP " ){ if ( $X [ 0 ] == " PRIMARY " ) $Fb [] = idf_escape ( $X [ 1 ]); else $u [] = idf_escape ( $X [ 1 ]) . " ON " . table ( $P );} elseif ( ! queries (( $X [ 0 ] != " PRIMARY " ? " CREATE $X[0] " . ( $X [ 0 ] != " INDEX " ? " INDEX " : " " ) . idf_escape ( $X [ 1 ] != " " ? $X [ 1 ] : uniqid ( $P . " _ " )) . " ON " . table ( $P ) : " ALTER TABLE " . table ( $P ) . " ADD PRIMARY KEY " ) . " $X[2] " )) return
false ;} return ( ! $u || queries ( " DROP INDEX " . implode ( " , " , $u ))) && ( ! $Fb || queries ( " ALTER TABLE " . table ( $P ) . " DROP " . implode ( " , " , $Fb )));} function
2012-06-04 16:58:40 +02:00
begin (){ return
queries ( " BEGIN TRANSACTION " );} function
2013-07-27 17:43:34 +02:00
insert_into ( $P , $N ){ return
queries ( " INSERT INTO " . table ( $P ) . ( $N ? " ( " . implode ( " , " , array_keys ( $N )) . " ) \n VALUES ( " . implode ( " , " , $N ) . " ) " : " DEFAULT VALUES " ));} function
insert_update ( $P , $N , $Qe ){ $Lg = array (); $Z = array (); foreach ( $N
as $x => $X ){ $Lg [] = " $x = $X " ; if ( isset ( $Qe [ idf_unescape ( $x )])) $Z [] = " $x = $X " ;} return
queries ( " MERGE " . table ( $P ) . " USING (VALUES( " . implode ( " , " , $N ) . " )) AS source (c " . implode ( " , c " , range ( 1 , count ( $N ))) . " ) ON " . implode ( " AND " , $Z ) . " WHEN MATCHED THEN UPDATE SET " . implode ( " , " , $Lg ) . " WHEN NOT MATCHED THEN INSERT ( " . implode ( " , " , array_keys ( $N )) . " ) VALUES ( " . implode ( " , " , $N ) . " ); " );} function
last_id (){ global $i ; return $i -> result ( " SELECT SCOPE_IDENTITY() " );} function
explain ( $i , $G ){ $i -> query ( " SET SHOWPLAN_ALL ON " ); $I = $i -> query ( $G ); $i -> query ( " SET SHOWPLAN_ALL OFF " ); return $I ;} function
found_rows ( $Q , $Z ){} function
foreign_keys ( $P ){ $I = array (); foreach ( get_rows ( " EXEC sp_fkeys @fktable_name = " . q ( $P )) as $J ){ $q =& $I [ $J [ " FK_NAME " ]]; $q [ " table " ] = $J [ " PKTABLE_NAME " ]; $q [ " source " ][] = $J [ " FKCOLUMN_NAME " ]; $q [ " target " ][] = $J [ " PKCOLUMN_NAME " ];} return $I ;} function
truncate_tables ( $R ){ return
apply_queries ( " TRUNCATE TABLE " , $R );} function
drop_views ( $Wg ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $Wg )));} function
drop_tables ( $R ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $R )));} function
move_tables ( $R , $Wg , $fg ){ return
apply_queries ( " ALTER SCHEMA " . idf_escape ( $fg ) . " TRANSFER " , array_merge ( $R , $Wg ));} function
trigger ( $B ){ if ( $B == " " ) return
array (); $K = get_rows ( " SELECT s.name [Trigger],
2012-06-04 16:58:40 +02:00
CASE WHEN OBJECTPROPERTY ( s . id , 'ExecIsInsertTrigger' ) = 1 THEN 'INSERT' WHEN OBJECTPROPERTY ( s . id , 'ExecIsUpdateTrigger' ) = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY ( s . id , 'ExecIsDeleteTrigger' ) = 1 THEN 'DELETE' END [ Event ],
CASE WHEN OBJECTPROPERTY ( s . id , 'ExecIsInsteadOfTrigger' ) = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [ Timing ],
c . text
FROM sysobjects s
JOIN syscomments c ON s . id = c . id
2013-07-27 17:43:34 +02:00
WHERE s . xtype = 'TR' AND s . name = " .q( $B )); $I =reset( $K );if( $I ) $I["Statement"] =preg_replace('~^.+ \\ s+AS \\ s+~isU','', $I["text"] );return $I ;}function
triggers ( $P ){ $I = array (); foreach ( get_rows ( " SELECT sys1.name,
2012-06-04 16:58:40 +02:00
CASE WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsInsertTrigger' ) = 1 THEN 'INSERT' WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsUpdateTrigger' ) = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsDeleteTrigger' ) = 1 THEN 'DELETE' END [ Event ],
CASE WHEN OBJECTPROPERTY ( sys1 . id , 'ExecIsInsteadOfTrigger' ) = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [ Timing ]
FROM sysobjects sys1
JOIN sysobjects sys2 ON sys1 . parent_obj = sys2 . id
2013-07-27 17:43:34 +02:00
WHERE sys1 . xtype = 'TR' AND sys2 . name = " .q( $P ))as $J ) $I[$J["name"] ]=array( $J["Timing"] , $J["Event"] );return $I ;}function
2012-06-04 16:58:40 +02:00
trigger_options (){ return
array ( " Timing " => array ( " AFTER " , " INSTEAD OF " ), " Type " => array ( " AS " ),);} function
schemas (){ return
get_vals ( " SELECT name FROM sys.schemas " );} function
2013-07-27 17:43:34 +02:00
get_schema (){ global $i ; if ( $_GET [ " ns " ] != " " ) return $_GET [ " ns " ]; return $i -> result ( " SELECT SCHEMA_NAME() " );} function
set_schema ( $yf ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
use_sql ( $qb ){ return " USE " . idf_escape ( $qb );} function
2012-06-04 16:58:40 +02:00
show_variables (){ return
array ();} function
show_status (){ return
array ();} function
2013-07-27 17:43:34 +02:00
convert_field ( $o ){} function
unconvert_field ( $o , $I ){ return $I ;} function
support ( $mc ){ return
ereg ( '^(scheme|trigger|view|drop_col)$' , $mc );} $w = " mssql " ; $U = array (); $Qf = array (); foreach ( array ( lang ( 14 ) => array ( " tinyint " => 3 , " smallint " => 5 , " int " => 10 , " bigint " => 20 , " bit " => 1 , " decimal " => 0 , " real " => 12 , " float " => 53 , " smallmoney " => 10 , " money " => 20 ), lang ( 15 ) => array ( " date " => 10 , " smalldatetime " => 19 , " datetime " => 19 , " datetime2 " => 19 , " time " => 8 , " datetimeoffset " => 10 ), lang ( 16 ) => array ( " char " => 8000 , " varchar " => 8000 , " text " => 2147483647 , " nchar " => 4000 , " nvarchar " => 4000 , " ntext " => 1073741823 ), lang ( 17 ) => array ( " binary " => 8000 , " varbinary " => 8000 , " image " => 2147483647 ),) as $x => $X ){ $U += $X ; $Qf [ $x ] = array_keys ( $X );} $Kg = array (); $le = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " IN " , " IS NULL " , " NOT LIKE " , " NOT IN " , " IS NOT NULL " ); $Cc = array ( " len " , " lower " , " round " , " upper " ); $Hc = array ( " avg " , " count " , " count distinct " , " max " , " min " , " sum " ); $Lb = array ( array ( " date|time " => " getdate " ,), array ( " int|decimal|real|float|money|datetime " => " +/- " , " char|text " => " + " ,));} $Eb = array ( " server " => " MySQL " ) + $Eb ; if ( ! defined ( " DRIVER " )){ $Ne = array ( " MySQLi " , " MySQL " , " PDO_MySQL " ); define ( " DRIVER " , " server " ); if ( extension_loaded ( " mysqli " )){ class
2012-06-04 16:58:40 +02:00
Min_DB
extends
MySQLi { var $extension = " MySQLi " ; function
Min_DB (){ parent :: init ();} function
2013-07-27 17:43:34 +02:00
connect ( $M , $V , $E ){ mysqli_report ( MYSQLI_REPORT_OFF ); list ( $Mc , $Je ) = explode ( " : " , $M , 2 ); $I =@ $this -> real_connect (( $M != " " ? $Mc : ini_get ( " mysqli.default_host " )),( $M . $V != " " ? $V : ini_get ( " mysqli.default_user " )),( $M . $V . $E != " " ? $E : ini_get ( " mysqli.default_pw " )), null ,( is_numeric ( $Je ) ? $Je : ini_get ( " mysqli.default_port " )),( ! is_numeric ( $Je ) ? $Je : null )); if ( $I ){ if ( method_exists ( $this , 'set_charset' )) $this -> set_charset ( " utf8 " ); else $this -> query ( " SET NAMES utf8 " );} return $I ;} function
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! $H ) return
false ; $J = $H -> fetch_array (); return $J [ $o ];} function
quote ( $O ){ return " ' " . $this -> escape_string ( $O ) . " ' " ;}}} 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
connect ( $M , $V , $E ){ $this -> _link =@ mysql_connect (( $M != " " ? $M : ini_get ( " mysql.default_host " )),( " $M $V " != " " ? $V : ini_get ( " mysql.default_user " )),( " $M $V $E " != " " ? $E : ini_get ( " mysql.default_password " )), true , 131072 ); if ( $this -> _link ){ $this -> server_info = mysql_get_server_info ( $this -> _link ); if ( function_exists ( 'mysql_set_charset' )) mysql_set_charset ( " utf8 " , $this -> _link ); else $this -> query ( " SET NAMES utf8 " );} else $this -> error = mysql_error (); return ( bool ) $this -> _link ;} function
quote ( $O ){ return " ' " . mysql_real_escape_string ( $O , $this -> _link ) . " ' " ;} function
select_db ( $qb ){ return
mysql_select_db ( $qb , $this -> _link );} function
query ( $G , $Eg = false ){ $H =@ ( $Eg ? mysql_unbuffered_query ( $G , $this -> _link ) : mysql_query ( $G , $this -> _link )); $this -> error = " " ; if ( ! $H ){ $this -> errno = mysql_errno ( $this -> _link ); $this -> error = mysql_error ( $this -> _link ); return
false ;} if ( $H === true ){ $this -> affected_rows = mysql_affected_rows ( $this -> _link ); $this -> info = mysql_info ( $this -> _link ); return
2012-06-04 16:58:40 +02:00
true ;} return
new
2013-07-27 17:43:34 +02:00
Min_Result ( $H );} function
multi_query ( $G ){ return $this -> _result = $this -> query ( $G );} function
2012-06-04 16:58:40 +02:00
store_result (){ return $this -> _result ;} function
next_result (){ return
false ;} function
2013-07-27 17:43:34 +02:00
result ( $G , $o = 0 ){ $H = $this -> query ( $G ); if ( ! $H ||! $H -> num_rows ) return
false ; return
mysql_result ( $H -> _result , 0 , $o );}} class
2012-06-04 16:58:40 +02:00
Min_Result { var $num_rows , $_result , $_offset = 0 ; function
2013-07-27 17:43:34 +02:00
Min_Result ( $H ){ $this -> _result = $H ; $this -> num_rows = mysql_num_rows ( $H );} function
2012-06-04 16:58:40 +02:00
fetch_assoc (){ return
mysql_fetch_assoc ( $this -> _result );} function
fetch_row (){ return
mysql_fetch_row ( $this -> _result );} function
2013-07-27 17:43:34 +02:00
fetch_field (){ $I = mysql_fetch_field ( $this -> _result , $this -> _offset ++ ); $I -> orgtable = $I -> table ; $I -> orgname = $I -> name ; $I -> charsetnr = ( $I -> blob ? 63 : 0 ); return $I ;} function
2012-06-04 16:58:40 +02:00
__destruct (){ mysql_free_result ( $this -> _result );}}} elseif ( extension_loaded ( " pdo_mysql " )){ class
Min_DB
extends
Min_PDO { var $extension = " PDO_MySQL " ; function
2013-07-27 17:43:34 +02:00
connect ( $M , $V , $E ){ $this -> dsn ( " mysql:host= " . str_replace ( " : " , " ;unix_socket= " , preg_replace ( '~:(\\d)~' , ';port=\\1' , $M )), $V , $E ); $this -> query ( " SET NAMES utf8 " ); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
select_db ( $qb ){ return $this -> query ( " USE " . idf_escape ( $qb ));} function
query ( $G , $Eg = false ){ $this -> setAttribute ( 1000 , ! $Eg ); return
parent :: query ( $G , $Eg );}}} function
idf_escape ( $t ){ return " ` " . str_replace ( " ` " , " `` " , $t ) . " ` " ;} function
table ( $t ){ return
idf_escape ( $t );} function
connect (){ global $b ; $i = new
Min_DB ; $mb = $b -> credentials (); if ( $i -> connect ( $mb [ 0 ], $mb [ 1 ], $mb [ 2 ])){ $i -> query ( " SET sql_quote_show_create = 1, autocommit = 1 " ); return $i ;} $I = $i -> error ; if ( function_exists ( 'iconv' ) &&! is_utf8 ( $I ) && strlen ( $wf = iconv ( " windows-1250 " , " utf-8 " , $I )) > strlen ( $I )) $I = $wf ; return $I ;} function
get_databases ( $sc ){ global $i ; $I = get_session ( " dbs " ); if ( $I === null ){ $G = ( $i -> server_info >= 5 ? " SELECT SCHEMA_NAME FROM information_schema.SCHEMATA " : " SHOW DATABASES " ); $I = ( $sc ? slow_query ( $G ) : get_vals ( $G )); restart_session (); set_session ( " dbs " , $I ); stop_session ();} return $I ;} function
limit ( $G , $Z , $y , $C = 0 , $Cf = " " ){ return " $G $Z " . ( $y !== null ? $Cf . " LIMIT $y " . ( $C ? " OFFSET $C " : " " ) : " " );} function
limit1 ( $G , $Z ){ return
limit ( $G , $Z , 1 );} function
db_collation ( $m , $Xa ){ global $i ; $I = null ; $k = $i -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ); if ( preg_match ( '~ COLLATE ([^ ]+)~' , $k , $A )) $I = $A [ 1 ]; elseif ( preg_match ( '~ CHARACTER SET ([^ ]+)~' , $k , $A )) $I = $Xa [ $A [ 1 ]][ - 1 ]; return $I ;} function
engines (){ $I = array (); foreach ( get_rows ( " SHOW ENGINES " ) as $J ){ if ( ereg ( " YES|DEFAULT " , $J [ " Support " ])) $I [] = $J [ " Engine " ];} return $I ;} function
logged_user (){ global $i ; return $i -> result ( " SELECT USER() " );} function
tables_list (){ global $i ; return
get_key_vals ( " SHOW " . ( $i -> server_info >= 5 ? " FULL " : " " ) . " TABLES " );} function
count_tables ( $l ){ $I = array (); foreach ( $l
as $m ) $I [ $m ] = count ( get_vals ( " SHOW TABLES IN " . idf_escape ( $m ))); return $I ;} function
table_status ( $B = " " , $lc = false ){ global $i ; $I = array (); foreach ( get_rows ( $lc && $i -> server_info >= 5 ? " SELECT TABLE_NAME AS Name, Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() " . ( $B != " " ? " AND TABLE_NAME = " . q ( $B ) : " ORDER BY Name " ) : " SHOW TABLE STATUS " . ( $B != " " ? " LIKE " . q ( addcslashes ( $B , " %_ \\ " )) : " " )) as $J ){ if ( $J [ " Engine " ] == " InnoDB " ) $J [ " Comment " ] = preg_replace ( '~(?:(.+); )?InnoDB free: .*~' , '\\1' , $J [ " Comment " ]); if ( ! isset ( $J [ " Engine " ])) $J [ " Comment " ] = " " ; if ( $B != " " ) return $J ; $I [ $J [ " Name " ]] = $J ;} return $I ;} function
is_view ( $Q ){ return $Q [ " Engine " ] === null ;} function
fk_support ( $Q ){ return
eregi ( " InnoDB|IBMDB2I " , $Q [ " Engine " ]);} function
fields ( $P ){ $I = array (); foreach ( get_rows ( " SHOW FULL COLUMNS FROM " . table ( $P )) as $J ){ preg_match ( '~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~' , $J [ " Type " ], $A ); $I [ $J [ " Field " ]] = array ( " field " => $J [ " Field " ], " full_type " => $J [ " Type " ], " type " => $A [ 1 ], " length " => $A [ 2 ], " unsigned " => ltrim ( $A [ 3 ] . $A [ 4 ]), " default " => ( $J [ " Default " ] != " " || ereg ( " char|set " , $A [ 1 ]) ? $J [ " Default " ] : null ), " null " => ( $J [ " Null " ] == " YES " ), " auto_increment " => ( $J [ " Extra " ] == " auto_increment " ), " on_update " => ( eregi ( '^on update (.+)' , $J [ " Extra " ], $A ) ? $A [ 1 ] : " " ), " collation " => $J [ " Collation " ], " privileges " => array_flip ( explode ( " , " , $J [ " Privileges " ])), " comment " => $J [ " Comment " ], " primary " => ( $J [ " Key " ] == " PRI " ),);} return $I ;} function
indexes ( $P , $j = null ){ $I = array (); foreach ( get_rows ( " SHOW INDEX FROM " . table ( $P ), $j ) as $J ){ $I [ $J [ " Key_name " ]][ " type " ] = ( $J [ " Key_name " ] == " PRIMARY " ? " PRIMARY " : ( $J [ " Index_type " ] == " FULLTEXT " ? " FULLTEXT " : ( $J [ " Non_unique " ] ? " INDEX " : " UNIQUE " ))); $I [ $J [ " Key_name " ]][ " columns " ][] = $J [ " Column_name " ]; $I [ $J [ " Key_name " ]][ " lengths " ][] = $J [ " Sub_part " ]; $I [ $J [ " Key_name " ]][ " descs " ][] = null ;} return $I ;} function
foreign_keys ( $P ){ global $i , $he ; static $He = '`(?:[^`]|``)+`' ; $I = array (); $kb = $i -> result ( " SHOW CREATE TABLE " . table ( $P ), 1 ); if ( $kb ){ preg_match_all ( " ~CONSTRAINT ( $He ) FOREIGN KEY \\ (((?: $He ,? ?)+) \\ ) REFERENCES ( $He )(?: \\ .( $He ))? \\ (((?: $He ,? ?)+) \\ )(?: ON DELETE ( $he ))?(?: ON UPDATE ( $he ))?~ " , $kb , $Bd , PREG_SET_ORDER ); foreach ( $Bd
as $A ){ preg_match_all ( " ~ $He ~ " , $A [ 2 ], $If ); preg_match_all ( " ~ $He ~ " , $A [ 5 ], $fg ); $I [ idf_unescape ( $A [ 1 ])] = array ( " db " => idf_unescape ( $A [ 4 ] != " " ? $A [ 3 ] : $A [ 4 ]), " table " => idf_unescape ( $A [ 4 ] != " " ? $A [ 4 ] : $A [ 3 ]), " source " => array_map ( 'idf_unescape' , $If [ 0 ]), " target " => array_map ( 'idf_unescape' , $fg [ 0 ]), " on_delete " => ( $A [ 6 ] ? $A [ 6 ] : " RESTRICT " ), " on_update " => ( $A [ 7 ] ? $A [ 7 ] : " RESTRICT " ),);}} return $I ;} function
view ( $B ){ global $i ; return
array ( " select " => preg_replace ( '~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU' , '' , $i -> result ( " SHOW CREATE VIEW " . table ( $B ), 1 )));} function
collations (){ $I = array (); foreach ( get_rows ( " SHOW COLLATION " ) as $J ){ if ( $J [ " Default " ]) $I [ $J [ " Charset " ]][ - 1 ] = $J [ " Collation " ]; else $I [ $J [ " Charset " ]][] = $J [ " Collation " ];} ksort ( $I ); foreach ( $I
as $x => $X ) asort ( $I [ $x ]); return $I ;} function
information_schema ( $m ){ global $i ; return ( $i -> server_info >= 5 && $m == " information_schema " ) || ( $i -> server_info >= 5.5 && $m == " performance_schema " );} function
error (){ global $i ; return
h ( preg_replace ( '~^You have an error.*syntax to use~U' , " Syntax error " , $i -> error ));} function
error_line (){ global $i ; if ( ereg ( ' at line ([0-9]+)$' , $i -> error , $jf )) return $jf [ 1 ] - 1 ;} function
create_database ( $m , $e ){ set_session ( " dbs " , null ); return
queries ( " CREATE DATABASE " . idf_escape ( $m ) . ( $e ? " COLLATE " . q ( $e ) : " " ));} function
drop_databases ( $l ){ restart_session (); set_session ( " dbs " , null ); return
apply_queries ( " DROP DATABASE " , $l , 'idf_escape' );} function
rename_database ( $B , $e ){ if ( create_database ( $B , $e )){ $lf = array (); foreach ( tables_list () as $P => $T ) $lf [] = table ( $P ) . " TO " . idf_escape ( $B ) . " . " . table ( $P ); if ( ! $lf || queries ( " RENAME TABLE " . implode ( " , " , $lf ))){ queries ( " DROP DATABASE " . idf_escape ( DB )); return
2012-06-04 16:58:40 +02:00
true ;}} return
false ;} function
2013-07-27 17:43:34 +02:00
auto_increment (){ $Ba = " 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 )){ $Ba = " " ; break ;} if ( $u [ " type " ] == " PRIMARY " ) $Ba = " UNIQUE " ;}} return " AUTO_INCREMENT $Ba " ;} function
alter_table ( $P , $B , $p , $tc , $bb , $Tb , $e , $Aa , $Ee ){ $c = array (); foreach ( $p
as $o ) $c [] = ( $o [ 1 ] ? ( $P != " " ? ( $o [ 0 ] != " " ? " CHANGE " . idf_escape ( $o [ 0 ]) : " ADD " ) : " " ) . " " . implode ( $o [ 1 ]) . ( $P != " " ? $o [ 2 ] : " " ) : " DROP " . idf_escape ( $o [ 0 ])); $c = array_merge ( $c , $tc ); $Nf = " COMMENT= " . q ( $bb ) . ( $Tb ? " ENGINE= " . q ( $Tb ) : " " ) . ( $e ? " COLLATE " . q ( $e ) : " " ) . ( $Aa != " " ? " AUTO_INCREMENT= $Aa " : " " ) . $Ee ; if ( $P == " " ) return
queries ( " CREATE TABLE " . table ( $B ) . " ( \n " . implode ( " , \n " , $c ) . " \n ) $Nf " ); if ( $P != $B ) $c [] = " RENAME TO " . table ( $B ); $c [] = $Nf ; return
queries ( " ALTER TABLE " . table ( $P ) . " \n " . implode ( " , \n " , $c ));} function
alter_indexes ( $P , $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 ]) . " " : " " ) . $X [ 2 ]); return
queries ( " ALTER TABLE " . table ( $P ) . implode ( " , " , $c ));} function
truncate_tables ( $R ){ return
apply_queries ( " TRUNCATE TABLE " , $R );} function
drop_views ( $Wg ){ return
queries ( " DROP VIEW " . implode ( " , " , array_map ( 'table' , $Wg )));} function
drop_tables ( $R ){ return
queries ( " DROP TABLE " . implode ( " , " , array_map ( 'table' , $R )));} function
move_tables ( $R , $Wg , $fg ){ $lf = array (); foreach ( array_merge ( $R , $Wg ) as $P ) $lf [] = table ( $P ) . " TO " . idf_escape ( $fg ) . " . " . table ( $P ); return
queries ( " RENAME TABLE " . implode ( " , " , $lf ));} function
copy_tables ( $R , $Wg , $fg ){ queries ( " SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' " ); foreach ( $R
as $P ){ $B = ( $fg == DB ? table ( " copy_ $P " ) : idf_escape ( $fg ) . " . " . table ( $P )); if ( ! queries ( " DROP TABLE IF EXISTS $B " ) ||! queries ( " CREATE TABLE $B LIKE " . table ( $P )) ||! queries ( " INSERT INTO $B SELECT * FROM " . table ( $P ))) return
false ;} foreach ( $Wg
as $P ){ $B = ( $fg == DB ? table ( " copy_ $P " ) : idf_escape ( $fg ) . " . " . table ( $P )); $Vg = view ( $P ); if ( ! queries ( " DROP VIEW IF EXISTS $B " ) ||! queries ( " CREATE VIEW $B AS $Vg[select] " )) return
false ;} return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
trigger ( $B ){ if ( $B == " " ) return
array (); $K = get_rows ( " SHOW TRIGGERS WHERE `Trigger` = " . q ( $B )); return
reset ( $K );} function
triggers ( $P ){ $I = array (); foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $P , " %_ \\ " ))) as $J ) $I [ $J [ " Trigger " ]] = array ( $J [ " Timing " ], $J [ " Event " ]); return $I ;} function
2012-06-04 16:58:40 +02:00
trigger_options (){ return
array ( " Timing " => array ( " BEFORE " , " AFTER " ), " Type " => array ( " FOR EACH ROW " ),);} function
2013-07-27 17:43:34 +02:00
routine ( $B , $T ){ global $i , $Vb , $Yc , $U ; $va = array ( " bool " , " boolean " , " integer " , " double precision " , " real " , " dec " , " numeric " , " fixed " , " national char " , " national varchar " ); $Dg = " (( " . implode ( " | " , array_merge ( array_keys ( $U ), $va )) . " ) \\ b(?: \\ s* \\ (((?:[^' \" )]*| $Vb )+) \\ ))? \\ s*(zerofill \\ s*)?(unsigned(?: \\ s+zerofill)?)?)(?: \\ s*(?:CHARSET|CHARACTER \\ s+SET) \\ s*[' \" ]?([^' \" \\ s]+)[' \" ]?)? " ; $He = " \\ s*( " . ( $T == " FUNCTION " ? " " : $Yc ) . " )? \\ s*(?:`((?:[^`]|``)*)` \\ s*| \\ b( \\ S+) \\ s+) $Dg " ; $k = $i -> result ( " SHOW CREATE $T " . idf_escape ( $B ), 2 ); preg_match ( " ~ \\ (((?: $He\\s *,?)*) \\ ) \\ s* " . ( $T == " FUNCTION " ? " RETURNS \\ s+ $Dg\\s + " : " " ) . " (.*)~is " , $k , $A ); $p = array (); preg_match_all ( " ~ $He\\s *,?~is " , $A [ 1 ], $Bd , PREG_SET_ORDER ); foreach ( $Bd
as $_e ){ $B = str_replace ( " `` " , " ` " , $_e [ 2 ]) . $_e [ 3 ]; $p [] = array ( " field " => $B , " type " => strtolower ( $_e [ 5 ]), " length " => preg_replace_callback ( " ~ $Vb ~s " , 'normalize_enum' , $_e [ 6 ]), " unsigned " => strtolower ( preg_replace ( '~\\s+~' , ' ' , trim ( " $_e[8] $_e[7] " ))), " null " => 1 , " full_type " => $_e [ 4 ], " inout " => strtoupper ( $_e [ 1 ]), " collation " => strtolower ( $_e [ 9 ]),);} if ( $T != " FUNCTION " ) return
array ( " fields " => $p , " definition " => $A [ 11 ]); return
array ( " fields " => $p , " returns " => array ( " type " => $A [ 12 ], " length " => $A [ 13 ], " unsigned " => $A [ 15 ], " collation " => $A [ 16 ]), " definition " => $A [ 17 ], " language " => " SQL " ,);} function
2012-06-04 16:58:40 +02:00
routines (){ return
2013-07-27 17:43:34 +02:00
get_rows ( " SELECT ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . q ( DB ));} function
routine_languages (){ return
array ();} function
2012-06-04 16:58:40 +02:00
begin (){ return
queries ( " BEGIN " );} function
2013-07-27 17:43:34 +02:00
insert_into ( $P , $N ){ return
queries ( " INSERT INTO " . table ( $P ) . " ( " . implode ( " , " , array_keys ( $N )) . " ) \n VALUES ( " . implode ( " , " , $N ) . " ) " );} function
insert_update ( $P , $N , $Qe ){ foreach ( $N
as $x => $X ) $N [ $x ] = " $x = $X " ; $Lg = implode ( " , " , $N ); return
queries ( " INSERT INTO " . table ( $P ) . " SET $Lg ON DUPLICATE KEY UPDATE $Lg " );} function
last_id (){ global $i ; return $i -> result ( " SELECT LAST_INSERT_ID() " );} function
explain ( $i , $G ){ return $i -> query ( " EXPLAIN " . ( $i -> server_info >= 5.1 ? " PARTITIONS " : " " ) . $G );} function
found_rows ( $Q , $Z ){ return ( $Z || $Q [ " Engine " ] != " InnoDB " ? null : $Q [ " Rows " ]);} function
2012-06-04 16:58:40 +02:00
types (){ return
array ();} function
schemas (){ return
array ();} function
get_schema (){ return " " ;} function
2013-07-27 17:43:34 +02:00
set_schema ( $yf ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
create_sql ( $P , $Aa ){ global $i ; $I = $i -> result ( " SHOW CREATE TABLE " . table ( $P ), 1 ); if ( ! $Aa ) $I = preg_replace ( '~ AUTO_INCREMENT=\\d+~' , '' , $I ); return $I ;} function
truncate_sql ( $P ){ return " TRUNCATE " . table ( $P );} function
use_sql ( $qb ){ return " USE " . idf_escape ( $qb );} function
trigger_sql ( $P , $Rf ){ $I = " " ; foreach ( get_rows ( " SHOW TRIGGERS LIKE " . q ( addcslashes ( $P , " %_ \\ " )), null , " -- " ) as $J ) $I .= " \n " . ( $Rf == 'CREATE+ALTER' ? " DROP TRIGGER IF EXISTS " . idf_escape ( $J [ " Trigger " ]) . " ;; \n " : " " ) . " CREATE TRIGGER " . idf_escape ( $J [ " Trigger " ]) . " $J[Timing] $J[Event] ON " . table ( $J [ " Table " ]) . " FOR EACH ROW \n $J[Statement] ;; \n " ; return $I ;} function
2012-06-04 16:58:40 +02:00
show_variables (){ return
get_key_vals ( " SHOW VARIABLES " );} function
2013-07-27 17:43:34 +02:00
process_list (){ return
get_rows ( " SHOW FULL PROCESSLIST " );} function
2012-06-04 16:58:40 +02:00
show_status (){ return
get_key_vals ( " SHOW STATUS " );} function
2013-07-27 17:43:34 +02:00
convert_field ( $o ){ if ( ereg ( " binary " , $o [ " type " ])) return " HEX( " . idf_escape ( $o [ " field " ]) . " ) " ; if ( $o [ " type " ] == " bit " ) return " BIN( " . idf_escape ( $o [ " field " ]) . " + 0) " ; if ( ereg ( " geometry|point|linestring|polygon " , $o [ " type " ])) return " AsWKT( " . idf_escape ( $o [ " field " ]) . " ) " ;} function
unconvert_field ( $o , $I ){ if ( ereg ( " binary " , $o [ " type " ])) $I = " UNHEX( $I ) " ; if ( $o [ " type " ] == " bit " ) $I = " CONV( $I , 2, 10) + 0 " ; if ( ereg ( " geometry|point|linestring|polygon " , $o [ " type " ])) $I = " GeomFromText( $I ) " ; return $I ;} function
support ( $mc ){ global $i ; return ! ereg ( " scheme|sequence|type " . ( $i -> server_info < 5.1 ? " |event|partitioning " . ( $i -> server_info < 5 ? " |view|routine|trigger " : " " ) : " " ), $mc );} $w = " sql " ; $U = array (); $Qf = array (); foreach ( array ( lang ( 14 ) => array ( " tinyint " => 3 , " smallint " => 5 , " mediumint " => 8 , " int " => 10 , " bigint " => 20 , " decimal " => 66 , " float " => 12 , " double " => 21 ), lang ( 15 ) => array ( " date " => 10 , " datetime " => 19 , " timestamp " => 19 , " time " => 10 , " year " => 4 ), lang ( 16 ) => array ( " char " => 255 , " varchar " => 65535 , " tinytext " => 255 , " text " => 65535 , " mediumtext " => 16777215 , " longtext " => 4294967295 ), lang ( 20 ) => array ( " enum " => 65535 , " set " => 64 ), lang ( 17 ) => array ( " bit " => 20 , " binary " => 255 , " varbinary " => 65535 , " tinyblob " => 255 , " blob " => 65535 , " mediumblob " => 16777215 , " longblob " => 4294967295 ), lang ( 19 ) => array ( " geometry " => 0 , " point " => 0 , " linestring " => 0 , " polygon " => 0 , " multipoint " => 0 , " multilinestring " => 0 , " multipolygon " => 0 , " geometrycollection " => 0 ),) as $x => $X ){ $U += $X ; $Qf [ $x ] = array_keys ( $X );} $Kg = array ( " unsigned " , " zerofill " , " unsigned zerofill " ); $le = array ( " = " , " < " , " > " , " <= " , " >= " , " != " , " LIKE " , " LIKE %% " , " REGEXP " , " IN " , " IS NULL " , " NOT LIKE " , " NOT REGEXP " , " NOT IN " , " IS NOT NULL " , " SQL " ); $Cc = array ( " char_length " , " date " , " from_unixtime " , " lower " , " round " , " sec_to_time " , " time_to_sec " , " upper " ); $Hc = array ( " avg " , " count " , " count distinct " , " group_concat " , " max " , " min " , " sum " ); $Lb = 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 = " 3.7.1 " ; class
2012-06-04 16:58:40 +02:00
Adminer { var $operators ; function
2013-07-27 17:43:34 +02:00
name (){ return " <a href='http://www.adminer.org/' id='h1'>Adminer</a> " ;} function
2012-06-04 16:58:40 +02:00
credentials (){ return
array ( SERVER , $_GET [ " username " ], get_session ( " pwds " ));} function
2013-07-27 17:43:34 +02:00
permanentLogin ( $k = false ){ return
password_file ( $k );} function
2012-06-04 16:58:40 +02:00
database (){ return
DB ;} function
2013-07-27 17:43:34 +02:00
databases ( $sc = true ){ return
get_databases ( $sc );} function
queryTimeout (){ return
5 ;} function
headers (){ return
true ;} function
2012-06-04 16:58:40 +02:00
head (){ return
true ;} function
2013-07-27 17:43:34 +02:00
loginForm (){ global $Eb ; echo ' < table cellspacing = " 0 " >
2013-07-27 17:52:25 +02:00
< tr >< th > ',lang(21),' < td > ',adminer_html_select("auth[driver]",$Eb,DRIVER,"loginDriver(this);"),' < tr >< th > ',lang(22),' < td >< input name = " auth[server] " value = " ',h(SERVER),' " title = " hostname[:port] " placeholder = " localhost " autocapitalize = " off " >
2013-07-27 17:43:34 +02:00
< tr >< th > ',lang(23),' < td >< input name = " auth[username] " id = " username " value = " ',h( $_GET["username"] ),' " autocapitalize = " off " >
< tr >< th > ',lang(24),' < td >< input type = " password " name = " auth[password] " >
< tr >< th > ',lang(25),' < td >< input name = " auth[db] " value = " ',h( $_GET["db"] );?> " autocapitalize = " off " >
2012-06-04 16:58:40 +02:00
</ table >
< script type = " text/javascript " >
var username = document . getElementById ( 'username' );
2013-07-27 17:43:34 +02:00
focus ( username );
username . form [ 'auth[driver]' ] . onchange ();
2012-06-04 16:58:40 +02:00
</ script >
< ? php
2013-07-27 17:43:34 +02:00
echo " <p><input type='submit' value=' " . lang ( 26 ) . " '> \n " , checkbox ( " auth[permanent] " , 1 , $_COOKIE [ " adminer_permanent " ], lang ( 27 )) . " \n " ;} function
login ( $zd , $E ){ return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
tableName ( $Xf ){ return
h ( $Xf [ " Name " ]);} function
fieldName ( $o , $pe = 0 ){ return '<span title="' . h ( $o [ " full_type " ]) . '">' . h ( $o [ " field " ]) . '</span>' ;} function
selectLinks ( $Xf , $N = " " ){ echo '<p class="tabs">' ; $yd = array ( " select " => lang ( 28 ), " table " => lang ( 29 )); if ( is_view ( $Xf )) $yd [ " view " ] = lang ( 30 ); else $yd [ " create " ] = lang ( 31 ); if ( $N !== null ) $yd [ " edit " ] = lang ( 32 ); foreach ( $yd
as $x => $X ) echo " <a href=' " . h ( ME ) . " $x = " . urlencode ( $Xf [ " Name " ]) . ( $x == " edit " ? $N : " " ) . " ' " . bold ( isset ( $_GET [ $x ])) . " > $X </a> " ; echo " \n " ;} function
foreignKeys ( $P ){ return
foreign_keys ( $P );} function
backwardKeys ( $P , $Wf ){ return
2012-06-04 16:58:40 +02:00
array ();} function
2013-07-27 17:43:34 +02:00
backwardKeysPrint ( $Da , $J ){} function
selectQuery ( $G ){ global $w , $S ; return " <form action=' " . h ( ME ) . " sql=' method='post'><p><span onclick= \" return !selectEditSql(event, this, ' " . lang ( 33 ) . " '); \" > " . " <code class='jush- $w '> " . h ( str_replace ( " \n " , " " , $G )) . " </code> " . " <a href=' " . h ( ME ) . " sql= " . urlencode ( $G ) . " '> " . lang ( 34 ) . " </a> " . " </span><input type='hidden' name='token' value=' $S '></p></form> \n " ;} function
rowDescription ( $P ){ return " " ;} function
rowDescriptions ( $K , $uc ){ return $K ;} function
selectLink ( $X , $o ){} function
selectVal ( $X , $z , $o ){ $I = ( $X === null ? " <i>NULL</i> " : ( ereg ( " char|binary " , $o [ " type " ]) &&! ereg ( " var " , $o [ " type " ]) ? " <code> $X </code> " : $X )); if ( ereg ( 'blob|bytea|raw|file' , $o [ " type " ]) &&! is_utf8 ( $X )) $I = lang ( 35 , strlen ( html_entity_decode ( $X , ENT_QUOTES ))); return ( $z ? " <a href=' " . h ( $z ) . " '> $I </a> " : $I );} function
editVal ( $X , $o ){ return $X ;} function
selectColumnsPrint ( $L , $g ){ global $Cc , $Hc ; print_fieldset ( " select " , lang ( 36 ), $L ); $s = 0 ; $Ac = array ( lang ( 37 ) => $Cc , lang ( 38 ) => $Hc ); foreach ( $L
2013-07-27 17:52:25 +02:00
as $x => $X ){ $X = $_GET [ " columns " ][ $x ]; echo " <div> " . adminer_html_select ( " columns[ $s ][fun] " , array ( - 1 => " " ) + $Ac , $X [ " fun " ]), " (<select name='columns[ $s ][col]' onchange='selectFieldChange(this.form);'><option> " . optionlist ( $g , $X [ " col " ], true ) . " </select>)</div> \n " ; $s ++ ;} echo " <div> " . adminer_html_select ( " columns[ $s ][fun] " , array ( - 1 => " " ) + $Ac , " " , " this.nextSibling.nextSibling.onchange(); " ), " (<select name='columns[ $s ][col]' onchange='selectAddRow(this);'><option> " . optionlist ( $g , null , true ) . " </select>)</div> \n " , " </div></fieldset> \n " ;} function
2013-07-27 17:43:34 +02:00
selectSearchPrint ( $Z , $g , $v ){ print_fieldset ( " search " , lang ( 39 ), $Z ); foreach ( $v
2013-07-27 17:52:25 +02:00
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 " ]); $Na = " 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 name='where[ $s ][col]' onchange=' $Na '><option value=''>( " . lang ( 40 ) . " ) " . optionlist ( $g , $X [ " col " ], true ) . " </select> " , adminer_html_select ( " where[ $s ][op] " , $this -> operators , $X [ " op " ], $Na ), " <input type='search' name='where[ $s ][val]' value=' " . h ( $X [ " val " ]) . " ' onchange=' " . ( $X ? " selectFieldChange(this.form) " : " selectAddRow(this) " ) . " ;' onsearch='selectSearchSearch(this);'></div> \n " ;}} echo " </div></fieldset> \n " ;} function
2013-07-27 17:43:34 +02:00
selectOrderPrint ( $pe , $g , $v ){ print_fieldset ( " sort " , lang ( 41 ), $pe ); $s = 0 ; foreach (( array ) $_GET [ " order " ] as $x => $X ){ if ( isset ( $g [ $X ])){ echo " <div><select name='order[ $s ]' onchange='selectFieldChange(this.form);'><option> " . optionlist ( $g , $X , true ) . " </select> " , checkbox ( " desc[ $s ] " , 1 , isset ( $_GET [ " desc " ][ $x ]), lang ( 42 )) . " </div> \n " ; $s ++ ;}} echo " <div><select name='order[ $s ]' onchange='selectAddRow(this);'><option> " . optionlist ( $g , null , true ) . " </select> " , checkbox ( " desc[ $s ] " , 1 , false , lang ( 42 )) . " </div> \n " , " </div></fieldset> \n " ;} function
selectLimitPrint ( $y ){ echo " <fieldset><legend> " . lang ( 43 ) . " </legend><div> " ; echo " <input type='number' name='limit' class='size' value=' " . h ( $y ) . " ' onchange='selectFieldChange(this.form);'> " , " </div></fieldset> \n " ;} function
selectLengthPrint ( $kg ){ if ( $kg !== null ){ echo " <fieldset><legend> " . lang ( 44 ) . " </legend><div> " , " <input type='number' name='text_length' class='size' value=' " . h ( $kg ) . " '> " , " </div></fieldset> \n " ;}} function
selectActionPrint ( $v ){ echo " <fieldset><legend> " . lang ( 45 ) . " </legend><div> " , " <input type='submit' value=' " . lang ( 36 ) . " '> " , " <span id='noindex' title=' " . lang ( 46 ) . " '></span> " , " <script type='text/javascript'> \n " , " var indexColumns = " ; $g = array (); foreach ( $v
as $u ){ if ( $u [ " type " ] != " FULLTEXT " ) $g [ reset ( $u [ " columns " ])] = 1 ;} $g [ " " ] = 1 ; foreach ( $g
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
selectEmailPrint ( $Pb , $g ){} function
selectColumnsProcess ( $g , $v ){ global $Cc , $Hc ; $L = array (); $Fc = array (); foreach (( array ) $_GET [ " columns " ] as $x => $X ){ if ( $X [ " fun " ] == " count " || ( isset ( $g [ $X [ " col " ]]) && ( ! $X [ " fun " ] || in_array ( $X [ " fun " ], $Cc ) || in_array ( $X [ " fun " ], $Hc )))){ $L [ $x ] = apply_sql_function ( $X [ " fun " ],( isset ( $g [ $X [ " col " ]]) ? idf_escape ( $X [ " col " ]) : " * " )); if ( ! in_array ( $X [ " fun " ], $Hc )) $Fc [] = $L [ $x ];}} return
array ( $L , $Fc );} function
selectSearchProcess ( $p , $v ){ global $w ; $I = array (); foreach ( $v
as $s => $u ){ if ( $u [ " type " ] == " FULLTEXT " && $_GET [ " fulltext " ][ $s ] != " " ) $I [] = " 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 )){ $db = " $X[op] " ; if ( ereg ( 'IN$' , $X [ " op " ])){ $Rc = process_length ( $X [ " val " ]); $db .= " ( " . ( $Rc != " " ? $Rc : " NULL " ) . " ) " ;} elseif ( $X [ " op " ] == " SQL " ) $db = " $X[val] " ; elseif ( $X [ " op " ] == " LIKE %% " ) $db = " LIKE " . $this -> processInput ( $p [ $X [ " col " ]], " % $X[val] % " ); elseif ( ! ereg ( 'NULL$' , $X [ " op " ])) $db .= " " . $this -> processInput ( $p [ $X [ " col " ]], $X [ " val " ]); if ( $X [ " col " ] != " " ) $I [] = idf_escape ( $X [ " col " ]) . $db ; else { $Ya = array (); foreach ( $p
as $B => $o ){ $ed = ereg ( 'char|text|enum|set' , $o [ " type " ]); if (( is_numeric ( $X [ " val " ]) ||! ereg ( '(^|[^o])int|float|double|decimal|bit' , $o [ " type " ])) && ( ! ereg ( " [ \x80 - \xFF ] " , $X [ " val " ]) || $ed )){ $B = idf_escape ( $B ); $Ya [] = ( $w == " sql " && $ed &&! ereg ( '^utf8' , $o [ " collation " ]) ? " CONVERT( $B USING utf8) " : $B );}} $I [] = ( $Ya ? " ( " . implode ( " $db OR " , $Ya ) . " $db ) " : " 0 " );}}} return $I ;} function
selectOrderProcess ( $p , $v ){ $I = array (); foreach (( array ) $_GET [ " order " ] as $x => $X ){ if ( isset ( $p [ $X ]) || preg_match ( '~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~' , $X )) $I [] = ( isset ( $p [ $X ]) ? idf_escape ( $X ) : $X ) . ( isset ( $_GET [ " desc " ][ $x ]) ? " DESC " : " " );} return $I ;} function
selectLimitProcess (){ return ( isset ( $_GET [ " limit " ]) ? $_GET [ " limit " ] : " 50 " );} function
2012-06-04 16:58:40 +02:00
selectLengthProcess (){ return ( isset ( $_GET [ " text_length " ]) ? $_GET [ " text_length " ] : " 100 " );} function
2013-07-27 17:43:34 +02:00
selectEmailProcess ( $Z , $uc ){ return
2012-06-04 16:58:40 +02:00
false ;} function
2013-07-27 17:43:34 +02:00
selectQueryBuild ( $L , $Z , $Fc , $pe , $y , $D ){ return " " ;} function
messageQuery ( $G ){ global $w ; restart_session (); $Kc =& get_session ( " queries " ); $Oc = " sql- " . count ( $Kc [ $_GET [ " db " ]]); if ( strlen ( $G ) > 1e6 ) $G = ereg_replace ( '[\x80-\xFF]+$' , '' , substr ( $G , 0 , 1e6 )) . " \n ... " ; $Kc [ $_GET [ " db " ]][] = array ( $G , time ()); return " <span class='time'> " .@ date ( " H:i:s " ) . " </span> <a href='# $Oc ' onclick= \" return !toggle(' $Oc '); \" > " . lang ( 47 ) . " </a><div id=' $Oc ' class='hidden'><pre><code class='jush- $w '> " . shorten_utf8 ( $G , 1000 ) . '</code></pre><p><a href="' . h ( str_replace ( " db= " . urlencode ( DB ), " db= " . urlencode ( $_GET [ " db " ]), ME ) . 'sql=&history=' . ( count ( $Kc [ $_GET [ " db " ]]) - 1 )) . '">' . lang ( 34 ) . '</a></div>' ;} function
editFunctions ( $o ){ global $Lb ; $I = ( $o [ " null " ] ? " NULL/ " : " " ); foreach ( $Lb
as $x => $Cc ){ if ( ! $x || ( ! isset ( $_GET [ " call " ]) && ( isset ( $_GET [ " select " ]) || where ( $_GET )))){ foreach ( $Cc
as $He => $X ){ if ( ! $He || ereg ( $He , $o [ " type " ])) $I .= " / $X " ;} if ( $x &&! ereg ( 'set|blob|bytea|raw|file' , $o [ " type " ])) $I .= " /SQL " ;}} return
explode ( " / " , $I );} function
editInput ( $P , $o , $_a , $Y ){ if ( $o [ " type " ] == " enum " ) return ( isset ( $_GET [ " select " ]) ? " <label><input type='radio' $_a value='-1' checked><i> " . lang ( 6 ) . " </i></label> " : " " ) . ( $o [ " null " ] ? " <label><input type='radio' $_a value='' " . ( $Y !== null || isset ( $_GET [ " select " ]) ? " " : " checked " ) . " ><i>NULL</i></label> " : " " ) . enum_input ( " radio " , $_a , $o , $Y , 0 ); return " " ;} function
processInput ( $o , $Y , $r = " " ){ if ( $r == " SQL " ) return $Y ; $B = $o [ " field " ]; $I = q ( $Y ); if ( ereg ( '^(now|getdate|uuid)$' , $r )) $I = " $r () " ; elseif ( ereg ( '^current_(date|timestamp)$' , $r )) $I = $r ; elseif ( ereg ( '^([+-]|\\|\\|)$' , $r )) $I = idf_escape ( $B ) . " $r $I " ; elseif ( ereg ( '^[+-] interval$' , $r )) $I = idf_escape ( $B ) . " $r " . ( preg_match ( " ~^( \\ d+|'[0-9.: -]') [A-Z_]+ $ ~i " , $Y ) ? $Y : $I ); elseif ( ereg ( '^(addtime|subtime|concat)$' , $r )) $I = " $r ( " . idf_escape ( $B ) . " , $I ) " ; elseif ( ereg ( '^(md5|sha1|password|encrypt)$' , $r )) $I = " $r ( $I ) " ; return
unconvert_field ( $o , $I );} function
dumpOutput (){ $I = array ( 'text' => lang ( 48 ), 'file' => lang ( 49 )); if ( function_exists ( 'gzencode' )) $I [ 'gz' ] = 'gzip' ; return $I ;} function
2012-06-04 16:58:40 +02:00
dumpFormat (){ return
array ( 'sql' => 'SQL' , 'csv' => 'CSV,' , 'csv;' => 'CSV;' , 'tsv' => 'TSV' );} function
2013-07-27 17:43:34 +02:00
dumpDatabase ( $m ){} function
dumpTable ( $P , $Rf , $fd = 0 ){ if ( $_POST [ " format " ] != " sql " ){ echo " \xef \xbb \xbf " ; if ( $Rf ) dump_csv ( array_keys ( fields ( $P )));} elseif ( $Rf ){ if ( $fd == 2 ){ $p = array (); foreach ( fields ( $P ) as $B => $o ) $p [] = idf_escape ( $B ) . " $o[full_type] " ; $k = " CREATE TABLE " . table ( $P ) . " ( " . implode ( " , " , $p ) . " ) " ;} else $k = create_sql ( $P , $_POST [ " auto_increment " ]); if ( $k ){ if ( $Rf == " DROP+CREATE " || $fd == 1 ) echo " DROP " . ( $fd == 2 ? " VIEW " : " TABLE " ) . " IF EXISTS " . table ( $P ) . " ; \n " ; if ( $fd == 1 ) $k = remove_definer ( $k ); echo " $k ; \n \n " ;}}} function
dumpData ( $P , $Rf , $G ){ global $i , $w ; $Dd = ( $w == " sqlite " ? 0 : 1048576 ); if ( $Rf ){ if ( $_POST [ " format " ] == " sql " ){ if ( $Rf == " TRUNCATE+INSERT " ) echo
truncate_sql ( $P ) . " ; \n " ; $p = fields ( $P );} $H = $i -> query ( $G , 1 ); if ( $H ){ $ad = " " ; $La = " " ; $jd = array (); $Tf = " " ; $nc = ( $P != '' ? 'fetch_assoc' : 'fetch_row' ); while ( $J = $H -> $nc ()){ if ( ! $jd ){ $Sg = array (); foreach ( $J
as $X ){ $o = $H -> fetch_field (); $jd [] = $o -> name ; $x = idf_escape ( $o -> name ); $Sg [] = " $x = VALUES( $x ) " ;} $Tf = ( $Rf == " INSERT+UPDATE " ? " \n ON DUPLICATE KEY UPDATE " . implode ( " , " , $Sg ) : " " ) . " ; \n " ;} if ( $_POST [ " format " ] != " sql " ){ if ( $Rf == " table " ){ dump_csv ( $jd ); $Rf = " INSERT " ;} dump_csv ( $J );} else { if ( ! $ad ) $ad = " INSERT INTO " . table ( $P ) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $jd )) . " ) VALUES " ; foreach ( $J
as $x => $X ){ $o = $p [ $x ]; $J [ $x ] = ( $X !== null ? unconvert_field ( $o , ereg ( '(^|[^o])int|float|double|decimal' , $o [ " type " ]) && $X != '' ? $X : q ( $X )) : " NULL " );} $wf = ( $Dd ? " \n " : " " ) . " ( " . implode ( " , \t " , $J ) . " ) " ; if ( ! $La ) $La = $ad . $wf ; elseif ( strlen ( $La ) + 4 + strlen ( $wf ) + strlen ( $Tf ) < $Dd ) $La .= " , $wf " ; else { echo $La . $Tf ; $La = $ad . $wf ;}}} if ( $La ) echo $La . $Tf ;} elseif ( $_POST [ " format " ] == " sql " ) echo " -- " . str_replace ( " \n " , " " , $i -> error ) . " \n " ;}} function
dumpFilename ( $Pc ){ return
friendly_url ( $Pc != " " ? $Pc : ( SERVER != " " ? SERVER : " localhost " ));} function
dumpHeaders ( $Pc , $Rd = false ){ $ye = $_POST [ " output " ]; $hc = ( ereg ( 'sql' , $_POST [ " format " ]) ? " sql " : ( $Rd ? " tar " : " csv " )); header ( " Content-Type: " . ( $ye == " gz " ? " application/x-gzip " : ( $hc == " tar " ? " application/x-tar " : ( $hc == " sql " || $ye != " file " ? " text/plain " : " text/csv " ) . " ; charset=utf-8 " ))); if ( $ye == " gz " ) ob_start ( 'gzencode' , 1e6 ); return $hc ;} function
homepage (){ echo '<p>' . ( $_GET [ " ns " ] == " " ? '<a href="' . h ( ME ) . 'database=">' . lang ( 50 ) . " </a> \n " : " " ),( support ( " scheme " ) ? " <a href=' " . h ( ME ) . " scheme='> " . ( $_GET [ " ns " ] != " " ? lang ( 51 ) : lang ( 52 )) . " </a> \n " : " " ),( $_GET [ " ns " ] !== " " ? '<a href="' . h ( ME ) . 'schema=">' . lang ( 53 ) . " </a> \n " : " " ),( support ( " privileges " ) ? " <a href=' " . h ( ME ) . " privileges='> " . lang ( 54 ) . " </a> \n " : " " ); return
2012-06-04 16:58:40 +02:00
true ;} function
2013-07-27 17:43:34 +02:00
navigation ( $Qd ){ global $ia , $S , $w , $Eb ; echo ' < h1 >
',$this->name(),' < span class = " version " > ',$ia,' </ span >
< a href = " http://www.adminer.org/#download " id = " version " > ',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),' </ a >
2012-06-04 16:58:40 +02:00
</ h1 >
2013-07-27 17:43:34 +02:00
' ; if ( $Qd == " auth " ){ $rc = true ; foreach (( array ) $_SESSION [ " pwds " ] as $Db => $Ff ){ foreach ( $Ff
as $M => $Qg ){ foreach ( $Qg
as $V => $E ){ if ( $E !== null ){ if ( $rc ){ echo " <p id='logins' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'> \n " ; $rc = false ;} $tb = $_SESSION [ " db " ][ $Db ][ $M ][ $V ]; foreach (( $tb ? array_keys ( $tb ) : array ( " " )) as $m ) echo " <a href=' " . h ( auth_url ( $Db , $M , $V , $m )) . " '>( $Eb[$Db] ) " . h ( $V . ( $M != " " ? " @ $M " : " " ) . ( $m != " " ? " - $m " : " " )) . " </a><br> \n " ;}}}}} else { echo ' < form action = " " method = " post " >
2012-06-04 16:58:40 +02:00
< p class = " logout " >
2013-07-27 17:43:34 +02:00
';if(DB==""||!$Qd){echo"<a href=' " .h(ME). " sql = '".bold(isset($_GET["sql"]))." title=' " .lang(55). " '>".lang(47)."</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(56)."</a>\n";}echo' < input type = " submit " name = " logout " value = " ',lang(57),' " id = " logout " >
< input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ p >
</ form >
2013-07-27 17:43:34 +02:00
';$this->databasesPrint($Qd);if($_GET["ns"]!==""&&!$Qd&&DB!=""){echo' < p >< a href = " '.h(ME).'create= " '.bold($_GET["create"]==="").">".lang(58)."</a>\n";$R=table_status(' ',true);if(!$R)echo"<p class=' message ' > " .lang(7). " \n " ;else { $this->tablesPrint ( $R ); $yd =array();foreach( $R
as $P => $T ) $yd [] = preg_quote ( $P , '/' ); echo " <script type='text/javascript'> \n " , " var jushLinks = { $w : [ ' " . js_escape ( ME ) . " table= \$ &', / \\ b( " . implode ( " | " , $yd ) . " ) \\ b/g ] }; \n " ; foreach ( array ( " bac " , " bra " , " sqlite_quo " , " mssql_bra " ) as $X ) echo " jushLinks. $X = jushLinks. $w ; \n " ; echo " </script> \n " ;}}}} function
databasesPrint ( $Qd ){ global $i ; $l = $this -> databases (); echo ' < form action = " " >
< p id = " dbs " >
';hidden_fields_get();$rb=" onmousedown=' dbMouseDown ( event , this ); ' onchange=' dbChange ( this ); '";echo($l?"<select name=' db '$rb>".optionlist(array(""=>"(".lang(59).")")+$l,DB)."</select>":' < input name = " db " value = " '.h(DB).' " autocapitalize = " off " > '),"<input type=' submit ' value=' " .lang(10). " '".($l?" class=' hidden '":"").">\n";if($Qd!="db"&&DB!=""&&$i->select_db(DB)){if(support("scheme")){echo"<br><select name=' ns '$rb>".optionlist(array(""=>"(".lang(60).")")+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 = " " > ' : " " ))), " </p></form> \n " ;} function
tablesPrint ( $R ){ echo " <p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'> \n " ; foreach ( $R
as $P => $Nf ){ echo '<a href="' . h ( ME ) . 'select=' . urlencode ( $P ) . '"' . bold ( $_GET [ " select " ] == $P || $_GET [ " edit " ] == $P ) . " > " . lang ( 61 ) . " </a> " , '<a href="' . h ( ME ) . 'table=' . urlencode ( $P ) . '"' . bold ( in_array ( $P , array ( $_GET [ " table " ], $_GET [ " create " ], $_GET [ " indexes " ], $_GET [ " foreign " ], $_GET [ " trigger " ]))) . " title=' " . lang ( 29 ) . " '> " . $this -> tableName ( $Nf ) . " </a><br> \n " ;}}} $b = ( function_exists ( 'adminer_object' ) ? adminer_object () : new
Adminer ); if ( $b -> operators === null ) $b -> operators = $le ; function
page_header ( $ng , $n = " " , $Ka = array (), $og = " " ){ global $ca , $b , $i , $Eb ; header ( " Content-Type: text/html; charset=utf-8 " ); if ( $b -> headers ()){ header ( " X-Frame-Options: deny " ); header ( " X-XSS-Protection: 0 " );} $pg = $ng . ( $og != " " ? " : " . h ( $og ) : " " ); $qg = strip_tags ( $pg . ( SERVER != " " && SERVER != " localhost " ? h ( " - " . SERVER ) : " " ) . " - " . $b -> name ()); echo ' <! DOCTYPE html >
< html lang = " ', $ca ,' " dir = " ',lang(62),' " >
2012-06-04 16:58:40 +02: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 " >
2013-07-27 17:43:34 +02:00
< title > ',$qg,' </ title >
< link rel = " stylesheet " type = " text/css " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = default . css & amp ; version = 3.7 . 1 " ,' " >
< script type = " text/javascript " src = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = functions . js & amp ; version = 3.7 . 1 " ,' " ></ script >
';if($b->head()){echo' < link rel = " shortcut icon " type = " image/x-icon " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = favicon . ico & amp ; version = 3.7 . 1 " ,' " >
< link rel = " apple-touch-icon " href = " ',h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = favicon . ico & amp ; version = 3.7 . 1 " ,' " >
';if(file_exists("adminer.css")){echo' < link rel = " stylesheet " type = " text/css " href = " adminer.css " >
';}}echo'
< body class = " ',lang(62),' nojs " onkeydown = " bodyKeydown(event); " onclick = " bodyClick(event); " onload = " bodyLoad( \ '',(is_object( $i )?substr( $i->server_info ,0,3): " " ),' \ ');',(isset( $_COOKIE["adminer_version"] )? " " : " verifyVersion (); " ),' " >
2012-06-04 16:58:40 +02:00
< script type = " text/javascript " >
2013-07-27 17:43:34 +02:00
document . body . className = document . body . className . replace ( / nojs / , \ ' js\ ' );
2012-06-04 16:58:40 +02:00
</ script >
< div id = " content " >
2013-07-27 17:43:34 +02:00
';if($Ka!==null){$z=substr(preg_replace(' ~ ( username | db | ns ) = [ ^& ] *&~ ',' ',ME),0,-1);echo' < p id = " breadcrumb " >< a href = " '.h( $z ? $z : " . " ).' " > '.$Eb[DRIVER].' </ a > & raquo ; ';$z=substr(preg_replace(' ~ ( db | ns ) = [ ^& ] *&~ ',' ',ME),0,-1);$M=(SERVER!=""?h(SERVER):lang(22));if($Ka===false)echo"$M\n";else{echo"<a href=' " .( $z ?h( $z ): " . " ). " ' accesskey=' 1 ' title=' Alt + Shift + 1 '>$M</a> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Ka)))echo' < a href = " '.h( $z . " & db = " .urlencode(DB).(support( " scheme " )? " & ns = " : " " )).' " > '.h(DB).' </ a > & raquo ; ';if(is_array($Ka)){if($_GET["ns"]!="")echo' < a href = " '.h(substr(ME,0,-1)).' " > '.h($_GET["ns"]).' </ a > & raquo ; ' ; foreach ( $Ka
as $x => $X ){ $xb = ( is_array ( $X ) ? $X [ 1 ] : $X ); if ( $xb != " " ) echo '<a href="' . h ( ME . " $x = " ) . urlencode ( is_array ( $X ) ? $X [ 0 ] : $X ) . '">' . h ( $xb ) . '</a> » ' ;}} echo " $ng\n " ;}} echo " <h2> $pg </h2> \n " ; restart_session (); $Mg = preg_replace ( '~^[^?]*~' , '' , $_SERVER [ " REQUEST_URI " ]); $Nd = $_SESSION [ " messages " ][ $Mg ]; if ( $Nd ){ echo " <div class='message'> " . implode ( " </div> \n <div class='message'> " , $Nd ) . " </div> \n " ; unset ( $_SESSION [ " messages " ][ $Mg ]);} $l =& get_session ( " dbs " ); if ( DB != " " && $l &&! in_array ( DB , $l , true )) $l = null ; stop_session (); if ( $n ) echo " <div class='error'> $n </div> \n " ; define ( " PAGE_HEADER " , 1 );} function
page_footer ( $Qd = " " ){ global $b ; echo ' </ div >
2012-06-04 16:58:40 +02:00
';switch_lang();echo' < div id = " menu " >
2013-07-27 17:43:34 +02:00
';$b->navigation($Qd);echo' </ div >
< script type = " text/javascript " > setupSubmitHighlight ( document ); </ script >
' ;} function
int32 ( $Td ){ while ( $Td >= 2147483648 ) $Td -= 4294967296 ; while ( $Td <=- 2147483649 ) $Td += 4294967296 ; return ( int ) $Td ;} function
long2str ( $W , $Yg ){ $wf = '' ; foreach ( $W
as $X ) $wf .= pack ( 'V' , $X ); if ( $Yg ) return
substr ( $wf , 0 , end ( $W )); return $wf ;} function
str2long ( $wf , $Yg ){ $W = array_values ( unpack ( 'V*' , str_pad ( $wf , 4 * ceil ( strlen ( $wf ) / 4 ), " \0 " ))); if ( $Yg ) $W [] = strlen ( $wf ); return $W ;} function
xxtea_mx ( $dh , $ch , $Uf , $hd ){ return
int32 ((( $dh >> 5 & 0x7FFFFFF ) ^ $ch << 2 ) + (( $ch >> 3 & 0x1FFFFFFF ) ^ $dh << 4 )) ^ int32 (( $Uf ^ $ch ) + ( $hd ^ $dh ));} function
encrypt_string ( $Pf , $x ){ if ( $Pf == " " ) return " " ; $x = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $x )))); $W = str2long ( $Pf , true ); $Td = count ( $W ) - 1 ; $dh = $W [ $Td ]; $ch = $W [ 0 ]; $F = floor ( 6 + 52 / ( $Td + 1 )); $Uf = 0 ; while ( $F --> 0 ){ $Uf = int32 ( $Uf + 0x9E3779B9 ); $Kb = $Uf >> 2 & 3 ; for ( $ze = 0 ; $ze < $Td ; $ze ++ ){ $ch = $W [ $ze + 1 ]; $Sd = xxtea_mx ( $dh , $ch , $Uf , $x [ $ze & 3 ^ $Kb ]); $dh = int32 ( $W [ $ze ] + $Sd ); $W [ $ze ] = $dh ;} $ch = $W [ 0 ]; $Sd = xxtea_mx ( $dh , $ch , $Uf , $x [ $ze & 3 ^ $Kb ]); $dh = int32 ( $W [ $Td ] + $Sd ); $W [ $Td ] = $dh ;} return
long2str ( $W , false );} function
decrypt_string ( $Pf , $x ){ if ( $Pf == " " ) return " " ; if ( ! $x ) return
false ; $x = array_values ( unpack ( " V* " , pack ( " H* " , md5 ( $x )))); $W = str2long ( $Pf , false ); $Td = count ( $W ) - 1 ; $dh = $W [ $Td ]; $ch = $W [ 0 ]; $F = floor ( 6 + 52 / ( $Td + 1 )); $Uf = int32 ( $F * 0x9E3779B9 ); while ( $Uf ){ $Kb = $Uf >> 2 & 3 ; for ( $ze = $Td ; $ze > 0 ; $ze -- ){ $dh = $W [ $ze - 1 ]; $Sd = xxtea_mx ( $dh , $ch , $Uf , $x [ $ze & 3 ^ $Kb ]); $ch = int32 ( $W [ $ze ] - $Sd ); $W [ $ze ] = $ch ;} $dh = $W [ $Td ]; $Sd = xxtea_mx ( $dh , $ch , $Uf , $x [ $ze & 3 ^ $Kb ]); $ch = int32 ( $W [ 0 ] - $Sd ); $W [ 0 ] = $ch ; $Uf = int32 ( $Uf - 0x9E3779B9 );} return
long2str ( $W , true );} $i = '' ; $S = $_SESSION [ " token " ]; if ( ! $_SESSION [ " token " ]) $_SESSION [ " token " ] = rand ( 1 , 1e6 ); $Ie = array (); if ( $_COOKIE [ " adminer_permanent " ]){ foreach ( explode ( " " , $_COOKIE [ " adminer_permanent " ]) as $X ){ list ( $x ) = explode ( " : " , $X ); $Ie [ $x ] = $X ;}} $d = $_POST [ " auth " ]; if ( $d ){ session_regenerate_id (); $_SESSION [ " pwds " ][ $d [ " driver " ]][ $d [ " server " ]][ $d [ " username " ]] = $d [ " password " ]; $_SESSION [ " db " ][ $d [ " driver " ]][ $d [ " server " ]][ $d [ " username " ]][ $d [ " db " ]] = true ; if ( $d [ " permanent " ]){ $x = base64_encode ( $d [ " driver " ]) . " - " . base64_encode ( $d [ " server " ]) . " - " . base64_encode ( $d [ " username " ]) . " - " . base64_encode ( $d [ " db " ]); $Te = $b -> permanentLogin ( true ); $Ie [ $x ] = " $x : " . base64_encode ( $Te ? encrypt_string ( $d [ " password " ], $Te ) : " " ); cookie ( " adminer_permanent " , implode ( " " , $Ie ));} if ( count ( $_POST ) == 1 || DRIVER != $d [ " driver " ] || SERVER != $d [ " server " ] || $_GET [ " username " ] !== $d [ " username " ] || DB != $d [ " db " ]) redirect ( auth_url ( $d [ " driver " ], $d [ " server " ], $d [ " username " ], $d [ " db " ]));} elseif ( $_POST [ " logout " ]){ if ( $S && $_POST [ " token " ] != $S ){ page_header ( lang ( 57 ), lang ( 63 )); page_footer ( " db " ); exit ;} else { foreach ( array ( " pwds " , " db " , " dbs " , " queries " ) as $x ) set_session ( $x , null ); unset_permanent (); redirect ( substr ( preg_replace ( '~(username|db|ns)=[^&]*&~' , '' , ME ), 0 , - 1 ), lang ( 64 ));}} elseif ( $Ie &&! $_SESSION [ " pwds " ]){ session_regenerate_id (); $Te = $b -> permanentLogin (); foreach ( $Ie
as $x => $X ){ list (, $Ra ) = explode ( " : " , $X ); list ( $Db , $M , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $x )); $_SESSION [ " pwds " ][ $Db ][ $M ][ $V ] = decrypt_string ( base64_decode ( $Ra ), $Te ); $_SESSION [ " db " ][ $Db ][ $M ][ $V ][ $m ] = true ;}} function
unset_permanent (){ global $Ie ; foreach ( $Ie
as $x => $X ){ list ( $Db , $M , $V , $m ) = array_map ( 'base64_decode' , explode ( " - " , $x )); if ( $Db == DRIVER && $M == SERVER && $V == $_GET [ " username " ] && $m == DB ) unset ( $Ie [ $x ]);} cookie ( " adminer_permanent " , implode ( " " , $Ie ));} function
auth_error ( $bc = null ){ global $i , $b , $S ; $Gf = session_name (); $n = " " ; if ( ! $_COOKIE [ $Gf ] && $_GET [ $Gf ] && ini_bool ( " session.use_only_cookies " )) $n = lang ( 65 ); elseif ( isset ( $_GET [ " username " ])){ if (( $_COOKIE [ $Gf ] || $_GET [ $Gf ]) &&! $S ) $n = lang ( 66 ); else { $E =& get_session ( " pwds " ); if ( $E !== null ){ $n = h ( $bc ? $bc -> getMessage () : ( is_string ( $i ) ? $i : lang ( 67 ))); if ( $E === false ) $n .= '<br>' . lang ( 68 , '<code>permanentLogin()</code>' ); $E = null ;} unset_permanent ();}} page_header ( lang ( 26 ), $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 " );} if ( isset ( $_GET [ " username " ])){ if ( ! class_exists ( " Min_DB " )){ unset ( $_SESSION [ " pwds " ][ DRIVER ]); unset_permanent (); page_header ( lang ( 69 ), lang ( 70 , implode ( " , " , $Ne )), false ); page_footer ( " auth " ); exit ;} $i = connect ();} if ( is_string ( $i ) ||! $b -> login ( $_GET [ " username " ], get_session ( " pwds " ))){ auth_error (); exit ;} $S = $_SESSION [ " token " ]; if ( $d && $_POST [ " token " ]) $_POST [ " token " ] = $S ; $n = '' ; if ( $_POST ){ if ( $_POST [ " token " ] != $S ){ $Xc = " max_input_vars " ; $Hd = ini_get ( $Xc ); if ( extension_loaded ( " suhosin " )){ foreach ( array ( " suhosin.request.max_vars " , " suhosin.post.max_vars " ) as $x ){ $X = ini_get ( $x ); if ( $X && ( ! $Hd || $X < $Hd )){ $Xc = $x ; $Hd = $X ;}}} $n = ( ! $_POST [ " token " ] && $Hd ? lang ( 71 , " ' $Xc ' " ) : lang ( 63 ));}} elseif ( $_SERVER [ " REQUEST_METHOD " ] == " POST " ){ $n = lang ( 72 , " 'post_max_size' " ); if ( isset ( $_GET [ " sql " ])) $n .= ' ' . lang ( 73 );} if ( ! ini_bool ( " session.use_cookies " ) ||@ ini_set ( " session.use_cookies " , false ) !== false ){ session_cache_limiter ( " " ); session_write_close ();} function
connect_error (){ global $b , $i , $S , $n , $Eb ; $l = array (); if ( DB != " " ){ header ( " HTTP/1.1 404 Not Found " ); page_header ( lang ( 25 ) . " : " . h ( DB ), lang ( 74 ), true );} else { if ( $_POST [ " db " ] &&! $n ) queries_redirect ( substr ( ME , 0 , - 1 ), lang ( 75 ), drop_databases ( $_POST [ " db " ])); page_header ( lang ( 76 ), $n , false ); echo " <p><a href=' " . h ( ME ) . " database='> " . lang ( 77 ) . " </a> \n " ; foreach ( array ( 'privileges' => lang ( 54 ), 'processlist' => lang ( 78 ), 'variables' => lang ( 79 ), 'status' => lang ( 80 ),) as $x => $X ){ if ( support ( $x )) echo " <a href=' " . h ( ME ) . " $x ='> $X </a> \n " ;} echo " <p> " . lang ( 81 , $Eb [ DRIVER ], " <b> $i->server_info </b> " , " <b> $i->extension </b> " ) . " \n " , " <p> " . lang ( 82 , " <b> " . h ( logged_user ()) . " </b> " ) . " \n " ; $hf = " <a href=' " . h ( ME ) . " refresh=1'> " . lang ( 83 ) . " </a> \n " ; $l = $b -> databases (); if ( $l ){ $zf = support ( " scheme " ); $Xa = collations (); echo " <form action='' method='post'> \n " , " <table cellspacing='0' class='checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'> \n " , " <thead><tr><td> <th> " . lang ( 25 ) . " <td> " . lang ( 84 ) . " <td> " . lang ( 85 ) . " </thead> \n " ; foreach ( $l
as $m ){ $rf = h ( ME ) . " db= " . urlencode ( $m ); echo " <tr " . odd () . " ><td> " . checkbox ( " db[] " , $m , in_array ( $m ,( array ) $_POST [ " db " ])), " <th><a href=' $rf '> " . h ( $m ) . " </a> " , " <td><a href=' $rf " . ( $zf ? " &ns= " : " " ) . " &database=' title=' " . lang ( 50 ) . " '> " . nbsp ( db_collation ( $m , $Xa )) . " </a> " , " <td align='right'><a href=' $rf &schema=' id='tables- " . h ( $m ) . " ' title=' " . lang ( 53 ) . " '>?</a> " , " \n " ;} echo " </table> \n " , " <script type='text/javascript'>tableCheck();</script> \n " , " <p><input type='submit' name='drop' value=' " . lang ( 86 ) . " ' " . confirm ( " formChecked(this, /db/) " ) . " > \n " , " <input type='hidden' name='token' value=' $S '> \n " , $hf , " </form> \n " ;} else
echo " <p> $hf " ;} page_footer ( " db " ); if ( $l ) echo " <script type='text/javascript'>ajaxSetHtml(' " . js_escape ( ME ) . " script=connect');</script> \n " ;} if ( isset ( $_GET [ " status " ])) $_GET [ " variables " ] = $_GET [ " status " ]; if ( ! ( DB != " " ? $i -> 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 ( 87 ) . " : " . h ( $_GET [ " ns " ]), lang ( 88 ), true ); page_footer ( " ns " ); exit ;}} function
select ( $H , $j = null , $Nc = " " , $se = array ()){ $yd = array (); $v = array (); $g = array (); $Ia = array (); $U = array (); $I = array (); odd ( '' ); for ( $s = 0 ; $J = $H -> fetch_row (); $s ++ ){ if ( ! $s ){ echo " <table cellspacing='0' class='nowrap'> \n " , " <thead><tr> " ; for ( $gd = 0 ; $gd < count ( $J ); $gd ++ ){ $o = $H -> fetch_field (); $B = $o -> name ; $re = $o -> orgtable ; $qe = $o -> orgname ; $I [ $o -> table ] = $re ; if ( $Nc ) $yd [ $gd ] = ( $B == " table " ? " table= " : ( $B == " possible_keys " ? " indexes= " : null )); elseif ( $re != " " ){ if ( ! isset ( $v [ $re ])){ $v [ $re ] = array (); foreach ( indexes ( $re , $j ) as $u ){ if ( $u [ " type " ] == " PRIMARY " ){ $v [ $re ] = array_flip ( $u [ " columns " ]); break ;}} $g [ $re ] = $v [ $re ];} if ( isset ( $g [ $re ][ $qe ])){ unset ( $g [ $re ][ $qe ]); $v [ $re ][ $qe ] = $gd ; $yd [ $gd ] = $re ;}} if ( $o -> charsetnr == 63 ) $Ia [ $gd ] = true ; $U [ $gd ] = $o -> type ; $B = h ( $B ); echo " <th " . ( $re != " " || $o -> name != $qe ? " title=' " . h (( $re != " " ? " $re . " : " " ) . $qe ) . " ' " : " " ) . " > " . ( $Nc ? " <a href=' $Nc " . strtolower ( $B ) . " ' target='_blank' rel='noreferrer' class='help'> $B </a> " : $B );} echo " </thead> \n " ;} echo " <tr " . odd () . " > " ; foreach ( $J
as $x => $X ){ if ( $X === null ) $X = " <i>NULL</i> " ; elseif ( $Ia [ $x ] &&! is_utf8 ( $X )) $X = " <i> " . lang ( 35 , strlen ( $X )) . " </i> " ; elseif ( ! strlen ( $X )) $X = " " ; else { $X = h ( $X ); if ( $U [ $x ] == 254 ) $X = " <code> $X </code> " ;} if ( isset ( $yd [ $x ]) &&! $g [ $yd [ $x ]]){ if ( $Nc ){ $P = $J [ array_search ( " table= " , $yd )]; $z = $yd [ $x ] . urlencode ( $se [ $P ] != " " ? $se [ $P ] : $P );} else { $z = " edit= " . urlencode ( $yd [ $x ]); foreach ( $v [ $yd [ $x ]] as $Va => $gd ) $z .= " &where " . urlencode ( " [ " . bracket_escape ( $Va ) . " ] " ) . " = " . urlencode ( $J [ $gd ]);} $X = " <a href=' " . h ( ME . $z ) . " '> $X </a> " ;} echo " <td> $X " ;}} echo ( $s ? " </table> " : " <p class='message'> " . lang ( 89 )) . " \n " ; return $I ;} function
referencable_primary ( $Bf ){ $I = array (); foreach ( table_status ( '' , true ) as $Yf => $P ){ if ( $Yf != $Bf && fk_support ( $P )){ foreach ( fields ( $Yf ) as $o ){ if ( $o [ " primary " ]){ if ( $I [ $Yf ]){ unset ( $I [ $Yf ]); break ;} $I [ $Yf ] = $o ;}}}} return $I ;} function
textarea ( $B , $Y , $K = 10 , $Ya = 80 ){ echo " <textarea name=' $B ' rows=' $K ' cols=' $Ya ' class='sqlarea' spellcheck='false' wrap='off' onkeydown='return textareaKeydown(this, event);'> " ; if ( is_array ( $Y )){ foreach ( $Y
as $X ) echo
h ( $X [ 0 ]) . " \n \n \n " ;} else
echo
h ( $Y ); echo " </textarea> " ;} function
edit_type ( $x , $o , $Xa , $vc = array ()){ global $Qf , $U , $Kg , $he ; echo '<td><select name="' , $x , '[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);">' , optionlist (( ! $o [ " type " ] || isset ( $U [ $o [ " type " ]]) ? array () : array ( $o [ " type " ])) + $Qf + ( $vc ? array ( lang ( 90 ) => $vc ) : array ()), $o [ " type " ]), ' </ select >
< td >< input name = " ', $x ,'[length] " value = " ',h( $o["length"] ),' " size = " 3 " onfocus = " editingLengthFocus(this); " >< td class = " options " > ';echo"<select name=' $x " . " [ collation ] '".(ereg(' ( char | text | enum | set ) $ ',$o["type"])?"":" class=' hidden '").' >< option value = " " > ( '.lang(91).' ) '.optionlist($Xa,$o["collation"]).' </ select > ',($Kg?"<select name=' $x " . " [ unsigned ] '".(!$o["type"]||ereg(' (( ^| [ ^ o ]) int | float | double | decimal ) $ ',$o["type"])?"":" class=' hidden '").' >< option > '.optionlist($Kg,$o["unsigned"]).' </ select > ':' '),(isset($o[' on_update '])?"<select name=' $x " . " [ on_update ] '".($o["type"]=="timestamp"?"":" class=' hidden '").' > '.optionlist(array(""=>"(".lang(92).")","CURRENT_TIMESTAMP"),$o["on_update"]).' </ select > ':' '),($vc?"<select name=' $x " . " [ on_delete ] '".(ereg("`",$o["type"])?"":" class=' hidden '")."><option value=' ' > ( " .lang(93). " ) " .optionlist(explode( " | " , $he ), $o["on_delete"] ). " </ select > " : " " );}function
process_length ( $vd ){ global $Vb ; return ( preg_match ( " ~^ \\ s*(?: $Vb )(?: \\ s*, \\ s*(?: $Vb ))* \\ s* \$ ~ " , $vd ) && preg_match_all ( " ~ $Vb ~ " , $vd , $Bd ) ? implode ( " , " , $Bd [ 0 ]) : preg_replace ( '~[^0-9,+-]~' , '' , $vd ));} function
process_type ( $o , $Wa = " COLLATE " ){ global $Kg ; return " $o[type] " . ( $o [ " length " ] != " " ? " ( " . process_length ( $o [ " length " ]) . " ) " : " " ) . ( ereg ( '(^|[^o])int|float|double|decimal' , $o [ " type " ]) && in_array ( $o [ " unsigned " ], $Kg ) ? " $o[unsigned] " : " " ) . ( ereg ( 'char|text|enum|set' , $o [ " type " ]) && $o [ " collation " ] ? " $Wa " . q ( $o [ " collation " ]) : " " );} function
process_field ( $o , $Cg ){ return
array ( idf_escape ( trim ( $o [ " field " ])), process_type ( $Cg ),( $o [ " null " ] ? " NULL " : " NOT NULL " ),( isset ( $o [ " default " ]) ? " DEFAULT " . (( ereg ( " time " , $o [ " type " ]) && eregi ( '^CURRENT_TIMESTAMP$' , $o [ " default " ])) || ( $o [ " type " ] == " bit " && ereg ( " ^([0-9]+|b'[0-1]+') \$ " , $o [ " default " ])) ? $o [ " default " ] : q ( $o [ " default " ])) : " " ),( $o [ " type " ] == " timestamp " && $o [ " on_update " ] ? " ON UPDATE $o[on_update] " : " " ),( support ( " comment " ) && $o [ " comment " ] != " " ? " COMMENT " . q ( $o [ " comment " ]) : " " ),( $o [ " auto_increment " ] ? auto_increment () : null ),);} function
type_class ( $T ){ foreach ( array ( 'char' => 'text' , 'date' => 'time|year' , 'binary' => 'blob' , 'enum' => 'set' ,) as $x => $X ){ if ( ereg ( " $x | $X " , $T )) return " class=' $x ' " ;}} function
edit_fields ( $p , $Xa , $T = " TABLE " , $vc = array (), $cb = false ){ global $i , $Yc ; echo ' < thead >< tr class = " wrap " >
';if($T=="PROCEDURE"){echo' < td >& nbsp ; ';}echo' < th > ',($T=="TABLE"?lang(94):lang(95)),' < td > ',lang(96),' < textarea id = " enum-edit " rows = " 4 " cols = " 12 " wrap = " off " style = " display: none; " onblur = " editingLengthBlur(this); " ></ textarea >
< td > ',lang(97),' < td > ',lang(98);if($T=="TABLE"){echo' < td > NULL
< td >< input type = " radio " name = " auto_increment_col " value = " " >< acronym title = " ',lang(99),' " > AI </ acronym >
< td > ',lang(100),(support("comment")?"<td".($cb?"":" class=' hidden '").">".lang(101):"");}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 = 3.7 . 1 ' alt=' + ' title=' " .lang(102). " '>",' < script type = " text/javascript " > row_count = ',count($p),' ; </ script >
2012-06-04 16:58:40 +02:00
</ thead >
< tbody onkeydown = " return editingKeydown(event); " >
' ; foreach ( $p
2013-07-27 17:43:34 +02:00
as $s => $o ){ $s ++ ; $te = $o [( $_POST ? " orig " : " field " )]; $Bb = ( isset ( $_POST [ " add " ][ $s - 1 ]) || ( isset ( $o [ " field " ]) &&! $_POST [ " drop_col " ][ $s ])) && ( support ( " drop_col " ) || $te == " " ); echo '<tr' ,( $Bb ? " " : " style='display: none;' " ), ' >
2013-07-27 17:52:25 +02:00
',($T=="PROCEDURE"?"<td>".adminer_html_select("fields[$s][inout]",explode("|",$Yc),$o["inout"]):""),' < th > ';if($Bb){echo' < input name = " fields[', $s ,'][field] " value = " ',h( $o["field"] ),' " onchange = " ',( $o["field"] != " " ||count( $p )>1? " " : " editingAddRow ( this ); " ),'editingNameChange(this); " maxlength = " 64 " autocapitalize = " off " > ';}echo' < input type = " hidden " name = " fields[', $s ,'][orig] " value = " ',h( $te ),' " >
2013-07-27 17:43:34 +02:00
';edit_type("fields[$s]",$o,$Xa,$vc);if($T=="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
echo
checkbox ( " fields[ $s ][has_default] " , 1 , $o [ " has_default " ]), '<input name="fields[' , $s , '][default]" value="' , h ( $o [ " default " ]), ' " onchange= " this . previousSibling . checked = true ; " >
',(support("comment")?"<td".($cb?"":" class=' hidden '")."><input name=' fields [ $s ][ comment ] ' value=' " .h( $o["comment"] ). " ' maxlength=' " .( $i->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 = 3.7 . 1 ' alt=' + ' title=' " .lang(102). " ' onclick=' return ! editingAddRow ( this , 1 ); '> "."<input type=' image ' class=' icon ' name=' up [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = up . gif & amp ; version = 3.7 . 1 ' alt=' ^ ' title=' " .lang(103). " '> "."<input type=' image ' class=' icon ' name=' down [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = down . gif & amp ; version = 3.7 . 1 ' alt=' v ' title=' " .lang(104). " '> ":""),($te==""||support("drop_col")?"<input type=' image ' class=' icon ' name=' drop_col [ $s ] ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = cross . gif & amp ; version = 3.7 . 1 ' alt=' x ' title=' " .lang(105). " ' onclick=' return ! editingRemoveRow ( this ); ' > " : " " ), " \n " ;}}function
process_fields ( & $p ){ ksort ( $p ); $C = 0 ; if ( $_POST [ " up " ]){ $pd = 0 ; foreach ( $p
as $x => $o ){ if ( key ( $_POST [ " up " ]) == $x ){ unset ( $p [ $x ]); array_splice ( $p , $pd , 0 , array ( $o )); break ;} if ( isset ( $o [ " field " ])) $pd = $C ; $C ++ ;}} elseif ( $_POST [ " down " ]){ $xc = false ; foreach ( $p
as $x => $o ){ if ( isset ( $o [ " field " ]) && $xc ){ unset ( $p [ key ( $_POST [ " down " ])]); array_splice ( $p , $C , 0 , array ( $xc )); break ;} if ( key ( $_POST [ " down " ]) == $x ) $xc = $o ; $C ++ ;}} elseif ( $_POST [ " add " ]){ $p = array_values ( $p ); array_splice ( $p , key ( $_POST [ " add " ]), 0 , array ( array ()));} elseif ( ! $_POST [ " drop_col " ]) return
false ; return
true ;} function
normalize_enum ( $A ){ return " ' " . str_replace ( " ' " , " '' " , addcslashes ( stripcslashes ( str_replace ( $A [ 0 ][ 0 ] . $A [ 0 ][ 0 ], $A [ 0 ][ 0 ], substr ( $A [ 0 ], 1 , - 1 ))), '\\' )) . " ' " ;} function
grant ( $Dc , $Ve , $g , $ge ){ if ( ! $Ve ) return
true ; if ( $Ve == array ( " ALL PRIVILEGES " , " GRANT OPTION " )) return ( $Dc == " GRANT " ? queries ( " $Dc ALL PRIVILEGES $ge WITH GRANT OPTION " ) : queries ( " $Dc ALL PRIVILEGES $ge " ) && queries ( " $Dc GRANT OPTION $ge " )); return
queries ( " $Dc " . preg_replace ( '~(GRANT OPTION)\\([^)]*\\)~' , '\\1' , implode ( " $g , " , $Ve ) . $g ) . $ge );} function
drop_create ( $Fb , $k , $Gb , $ig , $Hb , $_ , $Md , $Kd , $Ld , $de , $Wd ){ if ( $_POST [ " drop " ]) query_redirect ( $Fb , $_ , $Md ); elseif ( $de == " " ) query_redirect ( $k , $_ , $Ld ); elseif ( $de != $Wd ){ $lb = queries ( $k ); queries_redirect ( $_ , $Kd , $lb && queries ( $Fb )); if ( $lb ) queries ( $Gb );} else
queries_redirect ( $_ , $Kd , queries ( $ig ) && queries ( $Hb ) && queries ( $Fb ) && queries ( $k ));} function
create_trigger ( $ge , $J ){ global $w ; $mg = " $J[Timing] $J[Event] " ; return " CREATE TRIGGER " . idf_escape ( $J [ " Trigger " ]) . ( $w == " mssql " ? $ge . $mg : $mg . $ge ) . rtrim ( " $J[Type] \n $J[Statement] " , " ; " ) . " ; " ;} function
create_routine ( $sf , $J ){ global $Yc ; $N = array (); $p = ( array ) $J [ " fields " ]; ksort ( $p ); foreach ( $p
as $o ){ if ( $o [ " field " ] != " " ) $N [] = ( ereg ( " ^( $Yc ) \$ " , $o [ " inout " ]) ? " $o[inout] " : " " ) . idf_escape ( $o [ " field " ]) . process_type ( $o , " CHARACTER SET " );} return " CREATE $sf " . idf_escape ( trim ( $J [ " name " ])) . " ( " . implode ( " , " , $N ) . " ) " . ( isset ( $_GET [ " function " ]) ? " RETURNS " . process_type ( $J [ " returns " ], " CHARACTER SET " ) : " " ) . ( $J [ " language " ] ? " LANGUAGE $J[language] " : " " ) . rtrim ( " \n $J[definition] " , " ; " ) . " ; " ;} function
remove_definer ( $G ){ return
preg_replace ( '~^([A-Z =]+) DEFINER=`' . preg_replace ( '~@(.*)~' , '`@`(%|\\1)' , logged_user ()) . '`~' , '\\1' , $G );} function
tar_file ( $pc , $rg ){ $I = pack ( " a100a8a8a8a12a12 " , $pc , 644 , 0 , 0 , decoct ( $rg -> size ), decoct ( time ())); $Qa = 8 * 32 ; for ( $s = 0 ; $s < strlen ( $I ); $s ++ ) $Qa += ord ( $I [ $s ]); $I .= sprintf ( " %06o " , $Qa ) . " \0 " ; echo $I , str_repeat ( " \0 " , 512 - strlen ( $I )); $rg -> send (); echo
str_repeat ( " \0 " , 511 - ( $rg -> size + 511 ) % 512 );} function
ini_bytes ( $Xc ){ $X = ini_get ( $Xc ); switch ( strtolower ( substr ( $X , - 1 ))){ case 'g' : $X *= 1024 ; case 'm' : $X *= 1024 ; case 'k' : $X *= 1024 ;} return $X ;} $he = " RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT " ; class
TmpFile { var $handler ; var $size ; function
TmpFile (){ $this -> handler = tmpfile ();} function
write ( $gb ){ $this -> size += strlen ( $gb ); fwrite ( $this -> handler , $gb );} function
send (){ fseek ( $this -> handler , 0 ); fpassthru ( $this -> handler ); fclose ( $this -> handler );}} $Vb = " '(?:''|[^' \\ \\ ]| \\ \\ .)*+' " ; $Yc = " 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 " ])); echo $i -> result ( " SELECT " . limit ( idf_escape ( $_GET [ " field " ]) . " FROM " . table ( $a ), " WHERE " . where ( $_GET , $p ), 1 )); exit ;} elseif ( isset ( $_GET [ " table " ])){ $a = $_GET [ " table " ]; $p = fields ( $a ); if ( ! $p ) $n = error (); $Q = table_status1 ( $a , true ); page_header (( $p && is_view ( $Q ) ? lang ( 106 ) : lang ( 107 )) . " : " . h ( $a ), $n ); $b -> selectLinks ( $Q ); $bb = $Q [ " Comment " ]; if ( $bb != " " ) echo " <p> " . lang ( 101 ) . " : " . h ( $bb ) . " \n " ; if ( $p ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 108 ) . " <td> " . lang ( 96 ) . ( support ( " comment " ) ? " <td> " . lang ( 101 ) : " " ) . " </thead> \n " ; foreach ( $p
as $o ){ echo " <tr " . odd () . " ><th> " . h ( $o [ " field " ]), " <td title=' " . h ( $o [ " collation " ]) . " '> " . h ( $o [ " full_type " ]) . ( $o [ " null " ] ? " <i>NULL</i> " : " " ) . ( $o [ " auto_increment " ] ? " <i> " . lang ( 99 ) . " </i> " : " " ),( isset ( $o [ " default " ]) ? " [<b> " . h ( $o [ " default " ]) . " </b>] " : " " ),( support ( " comment " ) ? " <td> " . nbsp ( $o [ " comment " ]) : " " ), " \n " ;} echo " </table> \n " ; if ( ! is_view ( $Q )){ echo " <h3 id='indexes'> " . lang ( 109 ) . " </h3> \n " ; $v = indexes ( $a ); if ( $v ){ echo " <table cellspacing='0'> \n " ; foreach ( $v
as $B => $u ){ ksort ( $u [ " columns " ]); $Se = array (); foreach ( $u [ " columns " ] as $x => $X ) $Se [] = " <i> " . h ( $X ) . " </i> " . ( $u [ " lengths " ][ $x ] ? " ( " . $u [ " lengths " ][ $x ] . " ) " : " " ) . ( $u [ " descs " ][ $x ] ? " DESC " : " " ); echo " <tr title=' " . h ( $B ) . " '><th> $u[type] <td> " . implode ( " , " , $Se ) . " \n " ;} echo " </table> \n " ;} echo '<p><a href="' . h ( ME ) . 'indexes=' . urlencode ( $a ) . '">' . lang ( 110 ) . " </a> \n " ; if ( fk_support ( $Q )){ echo " <h3 id='foreign-keys'> " . lang ( 90 ) . " </h3> \n " ; $vc = foreign_keys ( $a ); if ( $vc ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 111 ) . " <td> " . lang ( 112 ) . " <td> " . lang ( 93 ) . " <td> " . lang ( 92 ) . ( $w != " sqlite " ? " <td> " : " " ) . " </thead> \n " ; foreach ( $vc
as $B => $q ){ echo " <tr title=' " . h ( $B ) . " '> " , " <th><i> " . implode ( " </i>, <i> " , array_map ( 'h' , $q [ " source " ])) . " </i> " , " <td><a href=' " . h ( $q [ " db " ] != " " ? preg_replace ( '~db=[^&]*~' , " db= " . urlencode ( $q [ " db " ]), ME ) : ( $q [ " ns " ] != " " ? preg_replace ( '~ns=[^&]*~' , " ns= " . urlencode ( $q [ " ns " ]), ME ) : ME )) . " table= " . urlencode ( $q [ " table " ]) . " '> " . ( $q [ " db " ] != " " ? " <b> " . h ( $q [ " db " ]) . " </b>. " : " " ) . ( $q [ " ns " ] != " " ? " <b> " . h ( $q [ " ns " ]) . " </b>. " : " " ) . h ( $q [ " table " ]) . " </a> " , " (<i> " . implode ( " </i>, <i> " , array_map ( 'h' , $q [ " target " ])) . " </i>) " , " <td> " . nbsp ( $q [ " on_delete " ]) . " \n " , " <td> " . nbsp ( $q [ " on_update " ]) . " \n " ,( $w == " sqlite " ? " " : '<td><a href="' . h ( ME . 'foreign=' . urlencode ( $a ) . '&name=' . urlencode ( $B )) . '">' . lang ( 113 ) . '</a>' );} echo " </table> \n " ;} if ( $w != " sqlite " ) echo '<p><a href="' . h ( ME ) . 'foreign=' . urlencode ( $a ) . '">' . lang ( 114 ) . " </a> \n " ;} if ( support ( " trigger " )){ echo " <h3 id='triggers'> " . lang ( 115 ) . " </h3> \n " ; $Bg = triggers ( $a ); if ( $Bg ){ echo " <table cellspacing='0'> \n " ; foreach ( $Bg
as $x => $X ) echo " <tr valign='top'><td> $X[0] <td> $X[1] <th> " . h ( $x ) . " <td><a href=' " . h ( ME . 'trigger=' . urlencode ( $a ) . '&name=' . urlencode ( $x )) . " '> " . lang ( 113 ) . " </a> \n " ; echo " </table> \n " ;} echo '<p><a href="' . h ( ME ) . 'trigger=' . urlencode ( $a ) . '">' . lang ( 116 ) . " </a> \n " ;}}}} elseif ( isset ( $_GET [ " schema " ])){ page_header ( lang ( 53 ), " " , array (), DB . ( $_GET [ " ns " ] ? " . $_GET[ns] " : " " )); $ag = array (); $bg = array (); $B = " adminer_schema " ; $ea = ( $_GET [ " schema " ] ? $_GET [ " schema " ] : $_COOKIE [( $_COOKIE [ " $B - " . DB ] ? " $B - " . DB : $B )]); preg_match_all ( '~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~' , $ea , $Bd , PREG_SET_ORDER ); foreach ( $Bd
as $s => $A ){ $ag [ $A [ 1 ]] = array ( $A [ 2 ], $A [ 3 ]); $bg [] = " \n \t ' " . js_escape ( $A [ 1 ]) . " ': [ $A[2] , $A[3] ] " ;} $tg = 0 ; $Fa =- 1 ; $yf = array (); $gf = array (); $td = array (); foreach ( table_status ( '' , true ) as $P => $Q ){ if ( is_view ( $Q )) continue ; $Ke = 0 ; $yf [ $P ][ " fields " ] = array (); foreach ( fields ( $P ) as $B => $o ){ $Ke += 1.25 ; $o [ " pos " ] = $Ke ; $yf [ $P ][ " fields " ][ $B ] = $o ;} $yf [ $P ][ " pos " ] = ( $ag [ $P ] ? $ag [ $P ] : array ( $tg , 0 )); foreach ( $b -> foreignKeys ( $P ) as $X ){ if ( ! $X [ " db " ]){ $rd = $Fa ; if ( $ag [ $P ][ 1 ] || $ag [ $X [ " table " ]][ 1 ]) $rd = min ( floatval ( $ag [ $P ][ 1 ]), floatval ( $ag [ $X [ " table " ]][ 1 ])) - 1 ; else $Fa -=. 1 ; while ( $td [( string ) $rd ]) $rd -=. 0001 ; $yf [ $P ][ " references " ][ $X [ " table " ]][( string ) $rd ] = array ( $X [ " source " ], $X [ " target " ]); $gf [ $X [ " table " ]][ $P ][( string ) $rd ] = $X [ " target " ]; $td [( string ) $rd ] = true ;}} $tg = max ( $tg , $yf [ $P ][ " pos " ][ 0 ] + 2.5 + $Ke );} echo '<div id="schema" style="height: ' , $tg , ' em ; " onselectstart= " return false ; " >
2012-06-04 16:58:40 +02:00
< script type = " text/javascript " >
2013-07-27 17:43:34 +02:00
var tablePos = { ',implode(",",$bg)."\n",' };
var em = document . getElementById ( \ 'schema\').offsetHeight / ' , $tg , ' ;
2012-06-04 16:58:40 +02:00
document . onmousemove = schemaMousemove ;
document . onmouseup = function ( ev ) {
schemaMouseup ( ev , \ '' , js_escape ( DB ), ' \ ' );
};
</ script >
2013-07-27 17:43:34 +02:00
' ; foreach ( $yf
as $B => $P ){ echo " <div class='table' style='top: " . $P [ " pos " ][ 0 ] . " em; left: " . $P [ " pos " ][ 1 ] . " em;' onmousedown='schemaMousedown(this, event);'> " , '<a href="' . h ( ME ) . 'table=' . urlencode ( $B ) . '"><b>' . h ( $B ) . " </b></a> " ; foreach ( $P [ " 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 ) $P [ " references " ] as $gg => $if ){ foreach ( $if
as $rd => $df ){ $sd = $rd - $ag [ $B ][ 1 ]; $s = 0 ; foreach ( $df [ 0 ] as $If ) echo " \n <div class='references' title=' " . h ( $gg ) . " ' id='refs $rd - " . ( $s ++ ) . " ' style='left: $sd " . " em; top: " . $P [ " fields " ][ $If ][ " pos " ] . " em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: " . ( - $sd ) . " em;'></div></div> " ;}} foreach (( array ) $gf [ $B ] as $gg => $if ){ foreach ( $if
as $rd => $g ){ $sd = $rd - $ag [ $B ][ 1 ]; $s = 0 ; foreach ( $g
as $fg ) echo " \n <div class='references' title=' " . h ( $gg ) . " ' id='refd $rd - " . ( $s ++ ) . " ' style='left: $sd " . " em; top: " . $P [ " fields " ][ $fg ][ " pos " ] . " em; height: 1.25em; background: url( " . h ( preg_replace ( " ~ \\ ?.*~ " , " " , ME )) . " ?file=arrow.gif) no-repeat right center;&version=3.7.1'><div style='height: .5em; border-bottom: 1px solid Gray; width: " . ( - $sd ) . " em;'></div></div> " ;}} echo " \n </div> \n " ;} foreach ( $yf
as $B => $P ){ foreach (( array ) $P [ " references " ] as $gg => $if ){ foreach ( $if
as $rd => $df ){ $Pd = $tg ; $Fd =- 10 ; foreach ( $df [ 0 ] as $x => $If ){ $Le = $P [ " pos " ][ 0 ] + $P [ " fields " ][ $If ][ " pos " ]; $Me = $yf [ $gg ][ " pos " ][ 0 ] + $yf [ $gg ][ " fields " ][ $df [ 1 ][ $x ]][ " pos " ]; $Pd = min ( $Pd , $Le , $Me ); $Fd = max ( $Fd , $Le , $Me );} echo " <div class='references' id='refl $rd ' style='left: $rd " . " em; top: $Pd " . " em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: " . ( $Fd - $Pd ) . " em;'></div></div> \n " ;}}} echo ' </ div >
< p >< a href = " ',h(ME. " schema = " .urlencode( $ea )),' " id = " schema-link " > ',lang(117),' </ a >
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$n){$ib="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$x)$ib.="&$x=".urlencode($_POST[$x]);cookie("adminer_export",substr($ib,1));$R=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$hc=dump_headers((count($R)==1?key($R):DB),(DB==""||count($R)>1));$dd=ereg(' sql ' , $_POST [ " format " ]); if ( $dd ) echo " -- Adminer $ia " . $Eb [ DRIVER ] . " dump
2012-06-04 16:58:40 +02:00
2013-07-27 17:43:34 +02:00
" .( $w != " sql " ? " " : " SET NAMES utf8 ;
" .( $_POST["data_style"] ? " SET foreign_key_checks = 0 ;
SET time_zone = " .q(substr(preg_replace('~^[^-]~','+ \0 ', $i->result ( " SELECT TIMEDIFF ( NOW (), UTC_TIMESTAMP ) " )),0,6)). " ;
2012-06-04 16:58:40 +02:00
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' ;
2013-07-27 17:43:34 +02:00
" : " " ). "
" ); $Rf = $_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 ( $i -> select_db ( $m )){ if ( $dd && ereg ( 'CREATE' , $Rf ) && ( $k = $i -> result ( " SHOW CREATE DATABASE " . idf_escape ( $m ), 1 ))){ if ( $Rf == " DROP+CREATE " ) echo " DROP DATABASE IF EXISTS " . idf_escape ( $m ) . " ; \n " ; echo " $k ; \n " ;} if ( $dd ){ if ( $Rf ) echo
use_sql ( $m ) . " ; \n \n " ; $xe = " " ; if ( $_POST [ " routines " ]){ foreach ( array ( " FUNCTION " , " PROCEDURE " ) as $sf ){ foreach ( get_rows ( " SHOW $sf STATUS WHERE Db = " . q ( $m ), null , " -- " ) as $J ) $xe .= ( $Rf != 'DROP+CREATE' ? " DROP $sf IF EXISTS " . idf_escape ( $J [ " Name " ]) . " ;; \n " : " " ) . remove_definer ( $i -> result ( " SHOW CREATE $sf " . idf_escape ( $J [ " Name " ]), 2 )) . " ;; \n \n " ;}} if ( $_POST [ " events " ]){ foreach ( get_rows ( " SHOW EVENTS " , null , " -- " ) as $J ) $xe .= ( $Rf != 'DROP+CREATE' ? " DROP EVENT IF EXISTS " . idf_escape ( $J [ " Name " ]) . " ;; \n " : " " ) . remove_definer ( $i -> result ( " SHOW CREATE EVENT " . idf_escape ( $J [ " Name " ]), 3 )) . " ;; \n \n " ;} if ( $xe ) echo " DELIMITER ;; \n \n $xe " . " DELIMITER ; \n \n " ;} if ( $_POST [ " table_style " ] || $_POST [ " data_style " ]){ $Wg = array (); foreach ( table_status ( '' , true ) as $B => $Q ){ $P = ( DB == " " || in_array ( $B ,( array ) $_POST [ " tables " ])); $ob = ( DB == " " || in_array ( $B ,( array ) $_POST [ " data " ])); if ( $P || $ob ){ if ( $hc == " tar " ){ $rg = new
TmpFile ; ob_start ( array ( $rg , 'write' ), 1e5 );} $b -> dumpTable ( $B ,( $P ? $_POST [ " table_style " ] : " " ),( is_view ( $Q ) ? 2 : 0 )); if ( is_view ( $Q )) $Wg [] = $B ; elseif ( $ob ){ $p = fields ( $B ); $b -> dumpData ( $B , $_POST [ " data_style " ], " SELECT * " . convert_fields ( $p , $p ) . " FROM " . table ( $B ));} if ( $dd && $_POST [ " triggers " ] && $P && ( $Bg = trigger_sql ( $B , $_POST [ " table_style " ]))) echo " \n DELIMITER ;; \n $Bg\nDELIMITER ; \n " ; if ( $hc == " tar " ){ ob_end_flush (); tar_file (( DB != " " ? " " : " $m / " ) . " $B .csv " , $rg );} elseif ( $dd ) echo " \n " ;}} foreach ( $Wg
as $Vg ) $b -> dumpTable ( $Vg , $_POST [ " table_style " ], 1 ); if ( $hc == " tar " ) echo
pack ( " x512 " );}}} if ( $dd ) echo " -- " . $i -> result ( " SELECT NOW() " ) . " \n " ; exit ;} page_header ( lang ( 118 ), $n ,( $_GET [ " export " ] != " " ? array ( " table " => $_GET [ " export " ]) : array ()), DB ); echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
< table cellspacing = " 0 " >
2013-07-27 17:52:25 +02:00
';$sb=array(' ',' USE ',' DROP + CREATE ',' CREATE ');$cg=array(' ',' DROP + CREATE ',' CREATE ');$pb=array(' ',' TRUNCATE + INSERT ',' INSERT ');if($w=="sql")$pb[]=' INSERT + UPDATE ';parse_str($_COOKIE["adminer_export"],$J);if(!$J)$J=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($J["events"])){$J["routines"]=$J["events"]=($_GET["dump"]=="");$J["triggers"]=$J["table_style"];}echo"<tr><th>".lang(119)."<td>".adminer_html_select("output",$b->dumpOutput(),$J["output"],0)."\n";echo"<tr><th>".lang(120)."<td>".adminer_html_select("format",$b->dumpFormat(),$J["format"],0)."\n";echo($w=="sqlite"?"":"<tr><th>".lang(25)."<td>".adminer_html_select(' db_style ',$sb,$J["db_style"]).(support("routine")?checkbox("routines",1,$J["routines"],lang(121)):"").(support("event")?checkbox("events",1,$J["events"],lang(122)):"")),"<tr><th>".lang(85)."<td>".adminer_html_select(' table_style ',$cg,$J["table_style"]).checkbox("auto_increment",1,$J["auto_increment"],lang(99)).(support("trigger")?checkbox("triggers",1,$J["triggers"],lang(115)):""),"<tr><th>".lang(123)."<td>".adminer_html_select(' data_style ',$pb,$J["data_style"]),' </ table >
2013-07-27 17:43:34 +02:00
< p >< input type = " submit " value = " ',lang(118),' " >
< input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
< table cellspacing = " 0 " >
2013-07-27 17:43:34 +02:00
';$Pe=array();if(DB!=""){$Pa=($a!=""?"":" checked");echo"<thead><tr>","<th style=' text - align : left ; '><label class=' block '><input type=' checkbox ' id=' check - tables '$Pa onclick=' formCheck ( this , /^ tables\\ [ / ); '>".lang(85)."</label>","<th style=' text - align : right ; '><label class=' block '>".lang(123)."<input type=' checkbox ' id=' check - data '$Pa onclick=' formCheck ( this , /^ data\\ [ / ); ' ></ label > " , " </ thead > \n " ; $Wg = " " ; $dg =tables_list();foreach( $dg
as $B => $T ){ $Oe = ereg_replace ( " _.* " , " " , $B ); $Pa = ( $a == " " || $a == ( substr ( $a , - 1 ) == " % " ? " $Oe % " : $B )); $Se = " <tr><td> " . checkbox ( " tables[] " , $B , $Pa , $B , " checkboxClick(event, this); formUncheck('check-tables'); " , " block " ); if ( $T !== null &&! eregi ( " table " , $T )) $Wg .= " $Se\n " ; else
echo " $Se <td align='right'><label class='block'><span id='Rows- " . h ( $B ) . " '></span> " . checkbox ( " data[] " , $B , $Pa , " " , " checkboxClick(event, this); formUncheck('check-data'); " ) . " </label> \n " ; $Pe [ $Oe ] ++ ;} echo $Wg ; if ( $dg ) 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 ( 25 ) . " </label></thead> \n " ; $l = $b -> databases (); if ( $l ){ foreach ( $l
as $m ){ if ( ! information_schema ( $m )){ $Oe = ereg_replace ( " _.* " , " " , $m ); echo " <tr><td> " . checkbox ( " databases[] " , $m , $a == " " || $a == " $Oe % " , $m , " formUncheck('check-databases'); " , " block " ) . " \n " ; $Pe [ $Oe ] ++ ;}}} else
echo " <tr><td><textarea name='databases' rows='10' cols='20'></textarea> " ;} echo ' </ table >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
' ; $rc = true ; foreach ( $Pe
as $x => $X ){ if ( $x != " " && $X > 1 ){ echo ( $rc ? " <p> " : " " ) . " <a href=' " . h ( ME ) . " dump= " . urlencode ( " $x % " ) . " '> " . h ( $x ) . " </a> " ; $rc = false ;}}} elseif ( isset ( $_GET [ " privileges " ])){ page_header ( lang ( 54 )); $H = $i -> query ( " SELECT User, Host FROM mysql. " . ( DB == " " ? " user " : " db WHERE " . q ( DB ) . " LIKE Db " ) . " ORDER BY Host, User " ); $Dc = $H ; if ( ! $H ) $H = $i -> 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 " ,( $Dc ? " " : " <input type='hidden' name='grant' value=''> \n " ), " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 23 ) . " <th> " . lang ( 22 ) . " <th> </thead> \n " ; while ( $J = $H -> fetch_assoc ()) echo '<tr' . odd () . '><td>' . h ( $J [ " User " ]) . " <td> " . h ( $J [ " Host " ]) . '<td><a href="' . h ( ME . 'user=' . urlencode ( $J [ " User " ]) . '&host=' . urlencode ( $J [ " Host " ])) . '">' . lang ( 34 ) . " </a> \n " ; if ( ! $Dc || DB != " " ) echo " <tr " . odd () . " ><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value=' " . lang ( 34 ) . " '> \n " ; echo " </table> \n " , " </form> \n " , '<p><a href="' . h ( ME ) . 'user=">' . lang ( 124 ) . " </a> " ;} elseif ( isset ( $_GET [ " sql " ])){ if ( ! $n && $_POST [ " export " ]){ dump_headers ( " sql " ); $b -> dumpTable ( " " , " " ); $b -> dumpData ( " " , " table " , $_POST [ " query " ]); exit ;} restart_session (); $Lc =& get_session ( " queries " ); $Kc =& $Lc [ DB ]; if ( ! $n && $_POST [ " clear " ]){ $Kc = array (); redirect ( remove_from_uri ( " history " ));} page_header ( lang ( 47 ), $n ); if ( ! $n && $_POST ){ $zc = false ; $G = $_POST [ " query " ]; if ( $_POST [ " webfile " ]){ $zc =@ fopen (( file_exists ( " adminer.sql " ) ? " adminer.sql " : " compress.zlib://adminer.sql.gz " ), " rb " ); $G = ( $zc ? fread ( $zc , 1e6 ) : false );} elseif ( $_FILES && $_FILES [ " sql_file " ][ " error " ][ 0 ] != 4 ) $G = get_file ( " sql_file " , true ); if ( is_string ( $G )){ if ( function_exists ( 'memory_get_usage' )) @ ini_set ( " memory_limit " , max ( ini_bytes ( " memory_limit " ), 2 * strlen ( $G ) + memory_get_usage () + 8e6 )); if ( $G != " " && strlen ( $G ) < 1e6 ){ $F = $G . ( ereg ( " ;[ \t \r \n ]* \$ " , $G ) ? " " : " ; " ); if ( ! $Kc || reset ( end ( $Kc )) != $F ){ restart_session (); $Kc [] = array ( $F , time ()); set_session ( " queries " , $Lc ); stop_session ();}} $Jf = " (?: \\ s|/ \\ *.* \\ */|(?:#|-- )[^ \n ]* \n |-- \n ) " ; $wb = " ; " ; $C = 0 ; $Rb = true ; $j = connect (); if ( is_object ( $j ) && DB != " " ) $j -> select_db ( DB ); $ab = 0 ; $Xb = array (); $xd = 0 ; $Be = '[\'"' . ( $w == " sql " ? '`#' : ( $w == " sqlite " ? '`[' : ( $w == " mssql " ? '[' : '' ))) . ']|/\\*|-- |$' . ( $w == " pgsql " ? '|\\$[^$]*\\$' : '' ); $ug = microtime (); parse_str ( $_COOKIE [ " adminer_export " ], $qa ); $Jb = $b -> dumpFormat (); unset ( $Jb [ " sql " ]); while ( $G != " " ){ if ( ! $C && preg_match ( " ~^ $Jf *DELIMITER \\ s+( \\ S+)~i " , $G , $A )){ $wb = $A [ 1 ]; $G = substr ( $G , strlen ( $A [ 0 ]));} else { preg_match ( '(' . preg_quote ( $wb ) . " \\ s*| $Be ) " , $G , $A , PREG_OFFSET_CAPTURE , $C ); list ( $xc , $Ke ) = $A [ 0 ]; if ( ! $xc && $zc &&! feof ( $zc )) $G .= fread ( $zc , 1e5 ); else { if ( ! $xc && rtrim ( $G ) == " " ) break ; $C = $Ke + strlen ( $xc ); if ( $xc && rtrim ( $xc ) != $wb ){ while ( preg_match ( '(' . ( $xc == '/*' ? '\\*/' : ( $xc == '[' ? ']' : ( ereg ( '^-- |^#' , $xc ) ? " \n " : preg_quote ( $xc ) . " | \\ \\ . " ))) . '|$)s' , $G , $A , PREG_OFFSET_CAPTURE , $C )){ $wf = $A [ 0 ][ 0 ]; if ( ! $wf && $zc &&! feof ( $zc )) $G .= fread ( $zc , 1e5 ); else { $C = $A [ 0 ][ 1 ] + strlen ( $wf ); if ( $wf [ 0 ] != " \\ " ) break ;}}} else { $Rb = false ; $F = substr ( $G , 0 , $Ke ); $ab ++ ; $Se = " <pre id='sql- $ab '><code class='jush- $w '> " . shorten_utf8 ( trim ( $F ), 1000 ) . " </code></pre> \n " ; if ( ! $_POST [ " only_errors " ]){ echo $Se ; ob_flush (); flush ();} $Mf = microtime (); if ( $i -> multi_query ( $F ) && is_object ( $j ) && preg_match ( " ~^ $Jf *USE \\ b~isU " , $F )) $j -> query ( $F ); do { $H = $i -> store_result (); $Sb = microtime (); $lg = " <span class='time'>( " . format_time ( $Mf , $Sb ) . " )</span> " . ( strlen ( $F ) < 1000 ? " <a href=' " . h ( ME ) . " sql= " . urlencode ( trim ( $F )) . " '> " . lang ( 34 ) . " </a> " : " " ); if ( $i -> error ){ echo ( $_POST [ " only_errors " ] ? $Se : " " ), " <p class='error'> " . lang ( 125 ) . ( $i -> errno ? " ( $i->errno ) " : " " ) . " : " . error () . " \n " ; $Xb [] = " <a href='#sql- $ab '> $ab </a> " ; if ( $_POST [ " error_stops " ]) break
2013-07-27 17:52:25 +02:00
2 ;} elseif ( is_object ( $H )){ $se = select ( $H , $j ); if ( ! $_POST [ " only_errors " ]){ echo " <form action='' method='post'> \n " , " <p> " . ( $H -> num_rows ? lang ( 126 , $H -> num_rows ) : " " ) . $lg ; $Oc = " export- $ab " ; $gc = " , <a href='# $Oc ' onclick= \" return !toggle(' $Oc '); \" > " . lang ( 118 ) . " </a><span id=' $Oc ' class='hidden'>: " . adminer_html_select ( " output " , $b -> dumpOutput (), $qa [ " output " ]) . " " . adminer_html_select ( " format " , $Jb , $qa [ " format " ]) . " <input type='hidden' name='query' value=' " . h ( $F ) . " '> " . " <input type='submit' name='export' value=' " . lang ( 118 ) . " '><input type='hidden' name='token' value=' $S '></span> \n " ; if ( $j && preg_match ( " ~^( $Jf | \\ ()*SELECT \\ b~isU " , $F ) && ( $fc = explain ( $j , $F ))){ $Oc = " explain- $ab " ; echo " , <a href='# $Oc ' onclick= \" return !toggle(' $Oc '); \" >EXPLAIN</a> $gc " , " <div id=' $Oc ' class='hidden'> \n " ; select ( $fc , $j ,( $w == " sql " ? " http://dev.mysql.com/doc/refman/ " . substr ( $i -> server_info , 0 , 3 ) . " /en/explain-output.html#explain_ " : " " ), $se ); echo " </div> \n " ;} else
2013-07-27 17:43:34 +02:00
echo $gc ; echo " </form> \n " ;}} else { if ( preg_match ( " ~^ $Jf *(CREATE|DROP|ALTER) $Jf +(DATABASE|SCHEMA) \\ b~isU " , $F )){ restart_session (); set_session ( " dbs " , null ); stop_session ();} if ( ! $_POST [ " only_errors " ]) echo " <p class='message' title=' " . h ( $i -> info ) . " '> " . lang ( 127 , $i -> affected_rows ) . " $lg\n " ;} $Mf = $Sb ;} while ( $i -> next_result ()); $xd += substr_count ( $F . $xc , " \n " ); $G = substr ( $G , $C ); $C = 0 ;}}}} if ( $Rb ) echo " <p class='message'> " . lang ( 128 ) . " \n " ; elseif ( $_POST [ " only_errors " ]){ echo " <p class='message'> " . lang ( 129 , $ab - count ( $Xb )), " <span class='time'>( " . format_time ( $ug , microtime ()) . " )</span> \n " ;} elseif ( $Xb && $ab > 1 ) echo " <p class='error'> " . lang ( 125 ) . " : " . implode ( " " , $Xb ) . " \n " ;} else
echo " <p class='error'> " . upload_error ( $G ) . " \n " ;} echo '
< form action = " " method = " post " enctype = " multipart/form-data " id = " form " >
< p > ';$F=$_GET["sql"];if($_POST)$F=$_POST["query"];elseif($_GET["history"]=="all")$F=$Kc;elseif($_GET["history"]!="")$F=$Kc[$_GET["history"]][0];textarea("query",$F,20);echo($_POST?"":"<script type=' text / javascript '>focus(document.getElementsByTagName(' textarea ')[0]);</script>\n"),"<p>".(ini_bool("file_uploads")?lang(130).' : < input type = " file " name = " sql_file[] " multiple '.($_FILES&&$_FILES["sql_file"]["error"][0]!=4?' ':' onchange = " this.form[ \ 'only_errors \ '].checked = true; " ').' > ( & lt ; '.ini_get("upload_max_filesize").' B ) ':lang(131)),' < p >
< input type = " submit " value = " ',lang(33),' " title = " Ctrl+Enter " >
',checkbox("error_stops",1,$_POST["error_stops"],lang(132))."\n",checkbox("only_errors",1,$_POST["only_errors"],lang(133))."\n";print_fieldset("webfile",lang(134),$_POST["webfile"],"document.getElementById(' form ')[' only_errors ' ] . checked = true ; " );echo
lang ( 135 , " <code>adminer.sql " . ( extension_loaded ( " zlib " ) ? " [.gz] " : " " ) . " </code> " ), ' <input type="submit" name="webfile" value="' . lang ( 136 ) . '">' , " </div></fieldset> \n " ; if ( $Kc ){ print_fieldset ( " history " , lang ( 137 ), $_GET [ " history " ] != " " ); for ( $X = end ( $Kc ); $X ; $X = prev ( $Kc )){ $x = key ( $Kc ); list ( $F , $lg ) = $X ; echo '<a href="' . h ( ME . " sql=&history= $x " ) . '">' . lang ( 34 ) . " </a> <span class='time' title=' " .@ date ( 'Y-m-d' , $lg ) . " '> " .@ date ( " H:i:s " , $lg ) . " </span> <code class='jush- $w '> " . shorten_utf8 ( ltrim ( str_replace ( " \n " , " " , str_replace ( " \r " , " " , preg_replace ( '~^(#|-- ).*~m' , '' , $F )))), 80 , " </code> " ) . " <br> \n " ;} echo " <input type='submit' name='clear' value=' " . lang ( 138 ) . " '> \n " , " <a href=' " . h ( ME . " sql=&history=all " ) . " '> " . lang ( 139 ) . " </a> \n " , " </div></fieldset> \n " ;} echo '<input type="hidden" name="token" value="' , $S , ' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
' ;} 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 )); $Lg = ( isset ( $_GET [ " select " ]) ? $_POST [ " edit " ] : $Z ); foreach ( $p
as $B => $o ){ if ( ! isset ( $o [ " privileges " ][ $Lg ? " update " : " insert " ]) || $b -> fieldName ( $o ) == " " ) unset ( $p [ $B ]);} if ( $_POST &&! $n &&! isset ( $_GET [ " select " ])){ $_ = $_POST [ " referer " ]; if ( $_POST [ " insert " ]) $_ = ( $Lg ? null : $_SERVER [ " REQUEST_URI " ]); elseif ( ! ereg ( '^.+&select=.+$' , $_ )) $_ = ME . " select= " . urlencode ( $a ); $v = indexes ( $a ); $Gg = unique_array ( $_GET [ " where " ], $v ); $af = " \n WHERE $Z " ; if ( isset ( $_POST [ " delete " ])){ $G = " FROM " . table ( $a ); query_redirect ( " DELETE " . ( $Gg ? " $G $af " : limit1 ( $G , $af )), $_ , lang ( 140 ));} else { $N = array (); foreach ( $p
as $B => $o ){ $X = process_input ( $o ); if ( $X !== false && $X !== null ) $N [ idf_escape ( $B )] = ( $Lg ? " \n " . idf_escape ( $B ) . " = $X " : $X );} if ( $Lg ){ if ( ! $N ) redirect ( $_ ); $G = table ( $a ) . " SET " . implode ( " , " , $N ); query_redirect ( " UPDATE " . ( $Gg ? " $G $af " : limit1 ( $G , $af )), $_ , lang ( 141 ));} else { $H = insert_into ( $a , $N ); $qd = ( $H ? last_id () : 0 ); queries_redirect ( $_ , lang ( 142 ,( $qd ? " $qd " : " " )), $H );}}} $Yf = $b -> tableName ( table_status1 ( $a , true )); page_header (( $Lg ? lang ( 34 ) : lang ( 143 )), $n , array ( " select " => array ( $a , $Yf )), $Yf ); $J = null ; if ( $_POST [ " save " ]) $J = ( array ) $_POST [ " fields " ]; elseif ( $Z ){ $L = array (); foreach ( $p
as $B => $o ){ if ( isset ( $o [ " privileges " ][ " select " ])){ $ya = convert_field ( $o ); if ( $_POST [ " clone " ] && $o [ " auto_increment " ]) $ya = " '' " ; if ( $w == " sql " && ereg ( " enum|set " , $o [ " type " ])) $ya = " 1* " . idf_escape ( $B ); $L [] = ( $ya ? " $ya AS " : " " ) . idf_escape ( $B );}} $J = array (); if ( $L ){ $K = get_rows ( " SELECT " . limit ( implode ( " , " , $L ) . " FROM " . table ( $a ), " WHERE $Z " ,( isset ( $_GET [ " select " ]) ? 2 : 1 ))); $J = ( isset ( $_GET [ " select " ]) && count ( $K ) != 1 ? null : reset ( $K ));}} if ( $J === false ) echo " <p class='error'> " . lang ( 89 ) . " \n " ; echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " enctype = " multipart/form-data " id = " form " >
2013-07-27 17:43:34 +02:00
';if(!$p)echo"<p class=' error '>".lang(144)."\n";else{echo"<table cellspacing=' 0 ' onkeydown=' return editingKeydown ( event ); ' > \n " ;foreach( $p
as $B => $o ){ echo " <tr><th> " . $b -> fieldName ( $o ); $vb = $_GET [ " set " ][ bracket_escape ( $B )]; if ( $vb === null ){ $vb = $o [ " default " ]; if ( $o [ " type " ] == " bit " && ereg ( " ^b'([01]*)' \$ " , $vb , $jf )) $vb = $jf [ 1 ];} $Y = ( $J !== null ? ( $J [ $B ] != " " && $w == " sql " && ereg ( " enum|set " , $o [ " type " ]) ? ( is_array ( $J [ $B ]) ? array_sum ( $J [ $B ]) :+ $J [ $B ]) : $J [ $B ]) : ( ! $Lg && $o [ " auto_increment " ] ? " " : ( isset ( $_GET [ " select " ]) ? false : $vb ))); if ( ! $_POST [ " save " ] && is_string ( $Y )) $Y = $b -> editVal ( $Y , $o ); $r = ( $_POST [ " save " ] ? ( string ) $_POST [ " function " ][ $B ] : ( $Lg && $o [ " on_update " ] == " CURRENT_TIMESTAMP " ? " now " : ( $Y === false ? null : ( $Y !== null ? '' : 'NULL' )))); if ( ereg ( " time " , $o [ " type " ]) && $Y == " CURRENT_TIMESTAMP " ){ $Y = " " ; $r = " now " ;} input ( $o , $Y , $r ); echo " \n " ;} echo " </table> \n " ;} echo ' < p >
';if($p){echo"<input type=' submit ' value=' " .lang(145). " '>\n";if(!isset($_GET["select"]))echo"<input type=' submit ' name=' insert ' value=' " .( $Lg ?lang(146):lang(147)). " ' title=' Ctrl + Shift + Enter '>\n";}echo($Lg?"<input type=' submit ' name=' delete ' value=' " .lang(148). " ' onclick=\"return confirm(' " .lang(0). " ');\">\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"] ),' " >
2012-06-04 16:58:40 +02:00
< input type = " hidden " name = " save " value = " 1 " >
2013-07-27 17:43:34 +02:00
< input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["create"])){$a=$_GET["create"];$Ce=array(' HASH ',' LINEAR HASH ',' KEY ',' LINEAR KEY ',' RANGE ',' LIST ' ); $ff = referencable_primary ( $a ); $vc = array (); foreach ( $ff
as $Yf => $o ) $vc [ str_replace ( " ` " , " `` " , $Yf ) . " ` " . str_replace ( " ` " , " `` " , $o [ " field " ])] = $Yf ; $ve = array (); $Q = array (); if ( $a != " " ){ $ve = fields ( $a ); $Q = table_status ( $a ); if ( ! $Q ) $n = lang ( 7 );} $J = $_POST ; $J [ " fields " ] = ( array ) $J [ " fields " ]; if ( $J [ " auto_increment_col " ]) $J [ " fields " ][ $J [ " auto_increment_col " ]][ " auto_increment " ] = true ; if ( $_POST &&! process_fields ( $J [ " fields " ]) &&! $n ){ if ( $_POST [ " drop " ]) query_redirect ( " DROP TABLE " . table ( $a ), substr ( ME , 0 , - 1 ), lang ( 149 )); else { $p = array (); $wa = array (); $Ng = false ; $tc = array (); ksort ( $J [ " fields " ]); $ue = reset ( $ve ); $ua = " FIRST " ; foreach ( $J [ " fields " ] as $x => $o ){ $q = $vc [ $o [ " type " ]]; $Cg = ( $q !== null ? $ff [ $q ] : $o ); if ( $o [ " field " ] != " " ){ if ( ! $o [ " has_default " ]) $o [ " default " ] = null ; if ( $x == $J [ " auto_increment_col " ]) $o [ " auto_increment " ] = true ; $Xe = process_field ( $o , $Cg ); $wa [] = array ( $o [ " orig " ], $Xe , $ua ); if ( $Xe != process_field ( $ue , $ue )){ $p [] = array ( $o [ " orig " ], $Xe , $ua ); if ( $o [ " orig " ] != " " || $ua ) $Ng = true ;} if ( $q !== null ) $tc [ idf_escape ( $o [ " field " ])] = ( $a != " " && $w != " sqlite " ? " ADD " : " " ) . " FOREIGN KEY ( " . idf_escape ( $o [ " field " ]) . " ) REFERENCES " . table ( $vc [ $o [ " type " ]]) . " ( " . idf_escape ( $Cg [ " field " ]) . " ) " . ( ereg ( " ^( $he ) \$ " , $o [ " on_delete " ]) ? " ON DELETE $o[on_delete] " : " " ); $ua = " AFTER " . idf_escape ( $o [ " field " ]);} elseif ( $o [ " orig " ] != " " ){ $Ng = true ; $p [] = array ( $o [ " orig " ]);} if ( $o [ " orig " ] != " " ){ $ue = next ( $ve ); if ( ! $ue ) $ua = " " ;}} $Ee = " " ; if ( in_array ( $J [ " partition_by " ], $Ce )){ $Fe = array (); if ( $J [ " partition_by " ] == 'RANGE' || $J [ " partition_by " ] == 'LIST' ){ foreach ( array_filter ( $J [ " partition_names " ]) as $x => $X ){ $Y = $J [ " partition_values " ][ $x ]; $Fe [] = " \n PARTITION " . idf_escape ( $X ) . " VALUES " . ( $J [ " partition_by " ] == 'RANGE' ? " LESS THAN " : " IN " ) . ( $Y != " " ? " ( $Y ) " : " MAXVALUE " );}} $Ee .= " \n PARTITION BY $J[partition_by] ( $J[partition] ) " . ( $Fe ? " ( " . implode ( " , " , $Fe ) . " \n ) " : ( $J [ " partitions " ] ? " PARTITIONS " . ( + $J [ " partitions " ]) : " " ));} elseif ( support ( " partitioning " ) && ereg ( " partitioned " , $Q [ " Create_options " ])) $Ee .= " \n REMOVE PARTITIONING " ; $Jd = lang ( 150 ); if ( $a == " " ){ cookie ( " adminer_engine " , $J [ " Engine " ]); $Jd = lang ( 151 );} $B = trim ( $J [ " name " ]); queries_redirect ( ME . " table= " . urlencode ( $B ), $Jd , alter_table ( $a , $B ,( $w == " sqlite " && ( $Ng || $tc ) ? $wa : $p ), $tc , $J [ " Comment " ],( $J [ " Engine " ] && $J [ " Engine " ] != $Q [ " Engine " ] ? $J [ " Engine " ] : " " ),( $J [ " Collation " ] && $J [ " Collation " ] != $Q [ " Collation " ] ? $J [ " Collation " ] : " " ),( $J [ " Auto_increment " ] != " " ? + $J [ " Auto_increment " ] : " " ), $Ee ));}} page_header (( $a != " " ? lang ( 31 ) : lang ( 152 )), $n , array ( " table " => $a ), $a ); if ( ! $_POST ){ $J = array ( " Engine " => $_COOKIE [ " adminer_engine " ], " fields " => array ( array ( " field " => " " , " type " => ( isset ( $U [ " int " ]) ? " int " : ( isset ( $U [ " integer " ]) ? " integer " : " " )))), " partition_names " => array ( " " ),); if ( $a != " " ){ $J = $Q ; $J [ " name " ] = $a ; $J [ " fields " ] = array (); if ( ! $_GET [ " auto_increment " ]) $J [ " Auto_increment " ] = " " ; foreach ( $ve
as $o ){ $o [ " has_default " ] = isset ( $o [ " default " ]); $J [ " fields " ][] = $o ;} if ( support ( " partitioning " )){ $_c = " FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q ( DB ) . " AND TABLE_NAME = " . q ( $a ); $H = $i -> query ( " SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $_c ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1 " ); list ( $J [ " partition_by " ], $J [ " partitions " ], $J [ " partition " ]) = $H -> fetch_row (); $Fe = get_key_vals ( " SELECT PARTITION_NAME, PARTITION_DESCRIPTION $_c AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION " ); $Fe [ " " ] = " " ; $J [ " partition_names " ] = array_keys ( $Fe ); $J [ " partition_values " ] = array_values ( $Fe );}}} $Xa = collations (); $Ub = engines (); foreach ( $Ub
as $Tb ){ if ( ! strcasecmp ( $Tb , $J [ " Engine " ])){ $J [ " Engine " ] = $Tb ; break ;}} echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " id = " form " >
< p >
2013-07-27 17:43:34 +02:00
',lang(153),' : < input name = " name " maxlength = " 64 " value = " ',h( $J["name"] ),' " autocapitalize = " off " >
2013-07-27 17:52:25 +02:00
';if($a==""&&!$_POST){?><script type=' text / javascript '>focus(document.getElementById(' form ')[' name ']);</script><?php }echo($Ub?adminer_html_select("Engine",array(""=>"(".lang(154).")")+$Ub,$J["Engine"]):""),' ',($Xa&&!ereg("sqlite|mssql",$w)?adminer_html_select("Collation",array(""=>"(".lang(91).")")+$Xa,$J["Collation"]):""),' < input type = " submit " value = " ',lang(145),' " >
2012-06-04 16:58:40 +02:00
< table cellspacing = " 0 " id = " edit-fields " class = " nowrap " >
2013-07-27 17:43:34 +02:00
';$cb=($_POST?$_POST["comments"]:$J["Comment"]!="");if(!$_POST&&!$cb){foreach($J["fields"]as$o){if($o["comment"]!=""){$cb=true;break;}}}edit_fields($J["fields"],$Xa,"TABLE",$vc,$cb);echo' </ table >
2012-06-04 16:58:40 +02:00
< p >
2013-07-27 17:43:34 +02:00
',lang(99),' : < input type = " number " name = " Auto_increment " size = " 6 " value = " ',h( $J["Auto_increment"] ),' " >
',checkbox("defaults",1,true,lang(100),"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();\"".($cb?" checked":"").">".lang(101)."</label>".' < input name = " Comment " id = " Comment " value = " '.h( $J["Comment"] ).' " maxlength = " '.( $i->server_info >=5.5?2048:60).' " '.($cb?' ':' class = " hidden " ').' > ':' '),' < p >
< input type = " submit " value = " ',lang(145),' " >
';if($_GET["create"]!=""){echo' < input type = " submit " name = " drop " value = " ',lang(86),' " ',confirm(),' > ';}if(support("partitioning")){$De=ereg(' RANGE | LIST ',$J["partition_by"]);print_fieldset("partition",lang(155),$J["partition_by"]);echo' < p >
2013-07-27 17:52:25 +02:00
',adminer_html_select("partition_by",array(-1=>"")+$Ce,$J["partition_by"],"partitionByChange(this);"),' ( < input name = " partition " value = " ',h( $J["partition"] ),' " > )
2013-07-27 17:43:34 +02:00
',lang(156),' : < input type = " number " name = " partitions " class = " size " value = " ',h( $J["partitions"] ),' " ',($De||!$J["partition_by"]?" class=' hidden '":""),' >
< table cellspacing = " 0 " id = " partition-table " ',($De?"":" class=' hidden '"),' >
< thead >< tr >< th > ',lang(157),' < th > ',lang(158),' </ thead >
';foreach($J["partition_names"]as$x=>$X){echo' < tr > ',' < td >< input name = " partition_names[] " value = " '.h( $X ).' " '.($x==count($J["partition_names"])-1?' onchange = " partitionNameChange(this); " ':' ').' autocapitalize = " off " > ',' < td >< input name = " partition_values[] " value = " '.h( $J["partition_values"] [ $x ]).' " > ';}echo' </ table >
2012-06-04 16:58:40 +02:00
</ div ></ fieldset >
2013-07-27 17:43:34 +02:00
';}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
</ form >
' ;} elseif ( isset ( $_GET [ " indexes " ])){ $a = $_GET [ " indexes " ]; $Tc = array ( " PRIMARY " , " UNIQUE " , " INDEX " ); $Q = table_status ( $a , true ); if ( eregi ( " MyISAM|M?aria " . ( $i -> server_info >= 5.6 ? " |InnoDB " : " " ), $Q [ " Engine " ])) $Tc [] = " FULLTEXT " ; $v = indexes ( $a ); if ( $w == " sqlite " ){ unset ( $Tc [ 0 ]); unset ( $v [ " " ]);} $J = $_POST ; if ( $_POST &&! $n &&! $_POST [ " add " ]){ $c = array (); foreach ( $J [ " indexes " ] as $u ){ $B = $u [ " name " ]; if ( in_array ( $u [ " type " ], $Tc )){ $g = array (); $wd = array (); $yb = array (); $N = array (); ksort ( $u [ " columns " ]); foreach ( $u [ " columns " ] as $x => $f ){ if ( $f != " " ){ $vd = $u [ " lengths " ][ $x ]; $xb = $u [ " descs " ][ $x ]; $N [] = idf_escape ( $f ) . ( $vd ? " ( " . ( + $vd ) . " ) " : " " ) . ( $xb ? " DESC " : " " ); $g [] = $f ; $wd [] = ( $vd ? $vd : null ); $yb [] = $xb ;}} if ( $g ){ $ec = $v [ $B ]; if ( $ec ){ ksort ( $ec [ " columns " ]); ksort ( $ec [ " lengths " ]); ksort ( $ec [ " descs " ]); if ( $u [ " type " ] == $ec [ " type " ] && array_values ( $ec [ " columns " ]) === $g && ( ! $ec [ " lengths " ] || array_values ( $ec [ " lengths " ]) === $wd ) && array_values ( $ec [ " descs " ]) === $yb ){ unset ( $v [ $B ]); continue ;}} $c [] = array ( $u [ " type " ], $B , " ( " . implode ( " , " , $N ) . " ) " );}}} foreach ( $v
as $B => $ec ) $c [] = array ( $ec [ " type " ], $B , " DROP " ); if ( ! $c ) redirect ( ME . " table= " . urlencode ( $a )); queries_redirect ( ME . " table= " . urlencode ( $a ), lang ( 159 ), alter_indexes ( $a , $c ));} page_header ( lang ( 109 ), $n , array ( " table " => $a ), $a ); $p = array_keys ( fields ( $a )); if ( $_POST [ " add " ]){ foreach ( $J [ " indexes " ] as $x => $u ){ if ( $u [ " columns " ][ count ( $u [ " columns " ])] != " " ) $J [ " indexes " ][ $x ][ " columns " ][] = " " ;} $u = end ( $J [ " indexes " ]); if ( $u [ " type " ] || array_filter ( $u [ " columns " ], 'strlen' ) || array_filter ( $u [ " lengths " ], 'strlen' ) || array_filter ( $u [ " descs " ])) $J [ " indexes " ][] = array ( " columns " => array ( 1 => " " ));} if ( ! $J ){ foreach ( $v
as $x => $u ){ $v [ $x ][ " name " ] = $x ; $v [ $x ][ " columns " ][] = " " ;} $v [] = array ( " columns " => array ( 1 => " " )); $J [ " indexes " ] = $v ;} echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
< table cellspacing = " 0 " class = " nowrap " >
2013-07-27 17:43:34 +02:00
< thead >< tr >< th > ',lang(160),' < th > ',lang(161),' < th > ',lang(162),' </ thead >
2013-07-27 17:52:25 +02:00
';$gd=1;foreach($J["indexes"]as$u){echo"<tr><td>".adminer_html_select("indexes[$gd][type]",array(-1=>"")+$Tc,$u["type"],($gd==count($J["indexes"])?"indexesAddRow(this);":1))."<td>";ksort($u["columns"]);$s=1;foreach($u["columns"]as$x=>$f){echo"<span>".adminer_html_select("indexes[$gd][columns][$s]",array(-1=>"")+$p,$f,($s==count($u["columns"])?"indexesAddColumn":"indexesChangeColumn")."(this, ' " .js_escape( $w == " sql " ? " " : $_GET["indexes"] . " _ " ). " ');"),($w=="sql"||$w=="mssql"?"<input type=' number ' name=' indexes [ $gd ][ lengths ][ $s ] ' class=' size ' value=' " .h( $u["lengths"] [ $x ]). " '>":""),($w!="sql"?checkbox("indexes[$gd][descs][$s]",1,$u["descs"][$x],lang(42)):"")," </span>";$s++;}echo"<td><input name=' indexes [ $gd ][ name ] ' value=' " .h( $u["name"] ). " ' autocapitalize=' off '>\n";$gd++;}echo' </ table >
2012-06-04 16:58:40 +02:00
< p >
2013-07-27 17:43:34 +02:00
< input type = " submit " value = " ',lang(145),' " >
< noscript >< p >< input type = " submit " name = " add " value = " ',lang(102),' " ></ noscript >
< input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["database"])){$J=$_POST;if($_POST&&!$n&&!isset($_POST["add_x"])){restart_session();$B=trim($J["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(163),drop_databases(array(DB)));}elseif(DB!==$B){if(DB!=""){$_GET["db"]=$B;queries_redirect(preg_replace(' ~ db = [ ^& ] *&~ ',' ' , ME ) . " db= " . urlencode ( $B ), lang ( 164 ), rename_database ( $B , $J [ " collation " ]));} else { $l = explode ( " \n " , str_replace ( " \r " , " " , $B )); $Sf = true ; $pd = " " ; foreach ( $l
as $m ){ if ( count ( $l ) == 1 || $m != " " ){ if ( ! create_database ( $m , $J [ " collation " ])) $Sf = false ; $pd = $m ;}} queries_redirect ( ME . " db= " . urlencode ( $pd ), lang ( 165 ), $Sf );}} else { if ( ! $J [ " collation " ]) redirect ( substr ( ME , 0 , - 1 )); query_redirect ( " ALTER DATABASE " . idf_escape ( $B ) . ( eregi ( '^[a-z0-9_]+$' , $J [ " collation " ]) ? " COLLATE $J[collation] " : " " ), substr ( ME , 0 , - 1 ), lang ( 166 ));}} page_header ( DB != " " ? lang ( 50 ) : lang ( 167 ), $n , array (), DB ); $Xa = collations (); $B = DB ; if ( $_POST ) $B = $J [ " name " ]; elseif ( DB != " " ) $J [ " collation " ] = db_collation ( DB , $Xa ); elseif ( $w == " sql " ){ foreach ( get_vals ( " SHOW GRANTS " ) as $Dc ){ if ( preg_match ( '~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~' , $Dc , $A ) && $A [ 1 ]){ $B = stripcslashes ( idf_unescape ( " ` $A[2] ` " )); break ;}}} echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
< p >
2013-07-27 17:52:25 +02:00
',($_POST["add_x"]||strpos($B,"\n")?' < textarea id = " name " name = " name " rows = " 10 " cols = " 40 " > '.h($B).' </ textarea >< br > ':' < input name = " name " id = " name " value = " '.h( $B ).' " maxlength = " 64 " autocapitalize = " off " > ' ) . " \n " . ( $Xa ? adminer_html_select ( " collation " , array ( " " => " ( " . lang ( 91 ) . " ) " ) + $Xa , $J [ " collation " ]) : " " ); ?>
2013-07-27 17:43:34 +02:00
< script type = 'text/javascript' > focus ( document . getElementById ( 'name' )); </ script >
2012-06-04 16:58:40 +02:00
< input type = " submit " value = " <?php echo
2013-07-27 17:43:34 +02:00
lang ( 145 ), ' " >
';if(DB!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(86). " '".confirm().">\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type=' image ' name=' add ' src=' " .h(preg_replace( " ~ \\ ? .*~ " , " " ,ME)). " ? file = plus . gif & amp ; version = 3.7 . 1 ' alt=' + ' title=' " .lang(102). " '>\n";echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["scheme"])){$J=$_POST;if($_POST&&!$n){$z=preg_replace(' ~ ns = [ ^& ] *&~ ',' ' , ME ) . " ns= " ; if ( $_POST [ " drop " ]) query_redirect ( " DROP SCHEMA " . idf_escape ( $_GET [ " ns " ]), $z , lang ( 168 )); else { $B = trim ( $J [ " name " ]); $z .= urlencode ( $B ); if ( $_GET [ " ns " ] == " " ) query_redirect ( " CREATE SCHEMA " . idf_escape ( $B ), $z , lang ( 169 )); elseif ( $_GET [ " ns " ] != $B ) query_redirect ( " ALTER SCHEMA " . idf_escape ( $_GET [ " ns " ]) . " RENAME TO " . idf_escape ( $B ), $z , lang ( 170 )); else
redirect ( $z );}} page_header ( $_GET [ " ns " ] != " " ? lang ( 51 ) : lang ( 52 ), $n ); if ( ! $J ) $J [ " name " ] = $_GET [ " ns " ]; echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
2013-07-27 17:43:34 +02:00
< p >< input name = " name " id = " name " value = " ',h( $J["name"] );?> " autocapitalize = " off " >
< script type = 'text/javascript' > focus ( document . getElementById ( 'name' )); </ script >
< input type = " submit " value = " <?php echo
lang ( 145 ), ' " >
';if($_GET["ns"]!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(86). " '".confirm().">\n";echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header(lang(171).": ".h($da),$n);$sf=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Rc=array();$xe=array();foreach($sf["fields"]as$s=>$o){if(substr($o["inout"],-3)=="OUT")$xe[$s]="@".idf_escape($o["field"])." AS ".idf_escape($o["field"]);if(!$o["inout"]||substr($o["inout"],0,2)=="IN")$Rc[]=$s;}if(!$n&&$_POST){$Ma=array();foreach($sf["fields"]as$x=>$o){if(in_array($x,$Rc)){$X=process_input($o);if($X===false)$X="' '";if(isset($xe[$x]))$i->query("SET @".idf_escape($o["field"])." = $X");}$Ma[]=(isset($xe[$x])?"@".idf_escape($o["field"]):$X);}$G=(isset($_GET["callf"])?"SELECT":"CALL")." ".idf_escape($da)."(".implode(", ",$Ma).")";echo"<p><code class=' jush - $w '>".h($G)."</code> <a href=' " .h(ME). " sql = " .urlencode( $G ). " '>".lang(34)."</a>\n";if(!$i->multi_query($G))echo"<p class=' error ' > " .error(). " \n " ;else { $j =connect();if(is_object( $j )) $j->select_db (DB);do { $H = $i->store_result ();if(is_object( $H ))select( $H , $j );else
echo " <p class='message'> " . lang ( 172 , $i -> affected_rows ) . " \n " ;} while ( $i -> next_result ()); if ( $xe ) select ( $i -> query ( " SELECT " . implode ( " , " , $xe )));}} echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
2013-07-27 17:43:34 +02:00
';if($Rc){echo"<table cellspacing=' 0 ' > \n " ;foreach( $Rc
as $x ){ $o = $sf [ " fields " ][ $x ]; $B = $o [ " field " ]; echo " <tr><th> " . $b -> fieldName ( $o ); $Y = $_POST [ " fields " ][ $B ]; if ( $Y != " " ){ if ( $o [ " type " ] == " enum " ) $Y =+ $Y ; if ( $o [ " type " ] == " set " ) $Y = array_sum ( $Y );} input ( $o , $Y ,( string ) $_POST [ " function " ][ $B ]); echo " \n " ;} echo " </table> \n " ;} echo ' < p >
< input type = " submit " value = " ',lang(171),' " >
< input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$B=$_GET["name"];$J=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){if($_POST["drop"])query_redirect("ALTER TABLE ".table($a)."\nDROP ".($w=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($B),ME."table=".urlencode($a),lang(173));else{$If=array_filter($J["source"],' strlen ' ); ksort ( $If ); $fg = array (); foreach ( $If
as $x => $X ) $fg [ $x ] = $J [ " target " ][ $x ]; query_redirect ( " ALTER TABLE " . table ( $a ) . ( $B != " " ? " \n DROP " . ( $w == " sql " ? " FOREIGN KEY " : " CONSTRAINT " ) . idf_escape ( $B ) . " , " : " " ) . " \n ADD FOREIGN KEY ( " . implode ( " , " , array_map ( 'idf_escape' , $If )) . " ) REFERENCES " . table ( $J [ " table " ]) . " ( " . implode ( " , " , array_map ( 'idf_escape' , $fg )) . " ) " . ( ereg ( " ^( $he ) \$ " , $J [ " on_delete " ]) ? " ON DELETE $J[on_delete] " : " " ) . ( ereg ( " ^( $he ) \$ " , $J [ " on_update " ]) ? " ON UPDATE $J[on_update] " : " " ), ME . " table= " . urlencode ( $a ),( $B != " " ? lang ( 174 ) : lang ( 175 ))); $n = lang ( 176 ) . " <br> $n " ;}} page_header ( lang ( 177 ), $n , array ( " table " => $a ), $a ); if ( $_POST ){ ksort ( $J [ " source " ]); if ( $_POST [ " add " ]) $J [ " source " ][] = " " ; elseif ( $_POST [ " change " ] || $_POST [ " change-js " ]) $J [ " target " ] = array ();} elseif ( $B != " " ){ $vc = foreign_keys ( $a ); $J = $vc [ $B ]; $J [ " source " ][] = " " ;} else { $J [ " table " ] = $a ; $J [ " source " ] = array ( " " );} $If = array_keys ( fields ( $a )); $fg = ( $a === $J [ " table " ] ? $If : array_keys ( fields ( $J [ " table " ]))); $ef = array_keys ( array_filter ( table_status ( '' , true ), 'fk_support' )); echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
< p >
2013-07-27 17:43:34 +02:00
' ; if ( $J [ " db " ] == " " && $J [ " ns " ] == " " ){ echo
lang ( 178 ), ' :
2013-07-27 17:52:25 +02:00
',adminer_html_select("table",$ef,$J["table"],"this.form[' change - js '].value = ' 1 '; this.form.submit();"),' < input type = " hidden " name = " change-js " value = " " >
2013-07-27 17:43:34 +02:00
< noscript >< p >< input type = " submit " name = " change " value = " ',lang(179),' " ></ noscript >
2012-06-04 16:58:40 +02:00
< table cellspacing = " 0 " >
2013-07-27 17:43:34 +02:00
< thead >< tr >< th > ',lang(111),' < th > ',lang(112),' </ thead >
2013-07-27 17:52:25 +02:00
';$gd=0;foreach($J["source"]as$x=>$X){echo"<tr>","<td>".adminer_html_select("source[".(+$x)."]",array(-1=>"")+$If,$X,($gd==count($J["source"])-1?"foreignAddRow(this);":1)),"<td>".adminer_html_select("target[".(+$x)."]",$fg,$J["target"][$x]);$gd++;}echo' </ table >
2012-06-04 16:58:40 +02:00
< p >
2013-07-27 17:52:25 +02:00
',lang(93),' : ',adminer_html_select("on_delete",array(-1=>"")+explode("|",$he),$J["on_delete"]),' ',lang(92),' : ',adminer_html_select("on_update",array(-1=>"")+explode("|",$he),$J["on_update"]),' < p >
2013-07-27 17:43:34 +02:00
< input type = " submit " value = " ',lang(145),' " >
< noscript >< p >< input type = " submit " name = " add " value = " ',lang(180),' " ></ noscript >
';}if($B!=""){echo' < input type = " submit " name = " drop " value = " ',lang(86),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$J=$_POST;if($_POST&&!$n){$B=trim($J["name"]);$ya=" AS\n$J[select]";$_=ME."table=".urlencode($B);$Jd=lang(181);if(!$_POST["drop"]&&$a==$B&&$w!="sqlite")query_redirect(($w=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($B).$ya,$_,$Jd);else{$hg=$B."_adminer_".uniqid();drop_create("DROP VIEW ".table($a),"CREATE VIEW ".table($B).$ya,"DROP VIEW ".table($B),"CREATE VIEW ".table($hg).$ya,"DROP VIEW ".table($hg),($_POST["drop"]?substr(ME,0,-1):$_),lang(182),$Jd,lang(183),$a,$B);}}if(!$_POST&&$a!=""){$J=view($a);$J["name"]=$a;if(!$n)$n=$i->error;}page_header(($a!=""?lang(30):lang(184)),$n,array("table"=>$a),$a);echo'
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
2013-07-27 17:43:34 +02:00
< p > ',lang(162),' : < input name = " name " value = " ',h( $J["name"] ),' " maxlength = " 64 " autocapitalize = " off " >
< p > ';textarea("select",$J["select"]);echo' < p >
< input type = " submit " value = " ',lang(145),' " >
';if($_GET["view"]!=""){echo' < input type = " submit " name = " drop " value = " ',lang(86),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$bd=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Of=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$J=$_POST;if($_POST&&!$n){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(185));elseif(in_array($J["INTERVAL_FIELD"],$bd)&&isset($Of[$J["STATUS"]])){$xf="\nON SCHEDULE ".($J["INTERVAL_VALUE"]?"EVERY ".q($J["INTERVAL_VALUE"])." $J[INTERVAL_FIELD]".($J["STARTS"]?" STARTS ".q($J["STARTS"]):"").($J["ENDS"]?" ENDS ".q($J["ENDS"]):""):"AT ".q($J["STARTS"]))." ON COMPLETION".($J["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(186):lang(187)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$xf.($aa!=$J["EVENT_NAME"]?"\nRENAME TO ".idf_escape($J["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($J["EVENT_NAME"]).$xf)."\n".$Of[$J["STATUS"]]." COMMENT ".q($J["EVENT_COMMENT"]).rtrim(" DO\n$J[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(188).": ".h($aa):lang(189)),$n);if(!$J&&$aa!=""){$K=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$J=reset($K);}echo'
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
< table cellspacing = " 0 " >
2013-07-27 17:43:34 +02:00
< tr >< th > ',lang(162),' < td >< input name = " EVENT_NAME " value = " ',h( $J["EVENT_NAME"] ),' " maxlength = " 64 " autocapitalize = " off " >
< tr >< th title = " datetime " > ',lang(190),' < td >< input name = " STARTS " value = " ',h( " $J [ EXECUTE_AT ] $J [ STARTS ] " ),' " >
< tr >< th title = " datetime " > ',lang(191),' < td >< input name = " ENDS " value = " ',h( $J["ENDS"] ),' " >
2013-07-27 17:52:25 +02:00
< tr >< th > ',lang(192),' < td >< input type = " number " name = " INTERVAL_VALUE " value = " ',h( $J["INTERVAL_VALUE"] ),' " class = " size " > ',adminer_html_select("INTERVAL_FIELD",$bd,$J["INTERVAL_FIELD"]),' < tr >< th > ',lang(80),' < td > ',adminer_html_select("STATUS",$Of,$J["STATUS"]),' < tr >< th > ',lang(101),' < td >< input name = " EVENT_COMMENT " value = " ',h( $J["EVENT_COMMENT"] ),' " maxlength = " 64 " >
2013-07-27 17:43:34 +02:00
< tr >< th >& nbsp ; < td > ',checkbox("ON_COMPLETION","PRESERVE",$J["ON_COMPLETION"]=="PRESERVE",lang(193)),' </ table >
< p > ';textarea("EVENT_DEFINITION",$J["EVENT_DEFINITION"]);echo' < p >
< input type = " submit " value = " ',lang(145),' " >
';if($aa!=""){echo' < input type = " submit " name = " drop " value = " ',lang(86),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$sf=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$J=$_POST;$J["fields"]=(array)$J["fields"];if($_POST&&!process_fields($J["fields"])&&!$n){$hg="$J[name]_adminer_".uniqid();drop_create("DROP $sf ".idf_escape($da),create_routine($sf,$J),"DROP $sf ".idf_escape($J["name"]),create_routine($sf,array("name"=>$hg)+$J),"DROP $sf ".idf_escape($hg),substr(ME,0,-1),lang(194),lang(195),lang(196),$da,$J["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(197):lang(198)).": ".h($da):(isset($_GET["function"])?lang(199):lang(200))),$n);if(!$_POST&&$da!=""){$J=routine($da,$sf);$J["name"]=$da;}$Xa=get_vals("SHOW CHARACTER SET");sort($Xa);$tf=routine_languages();echo'
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " id = " form " >
2013-07-27 17:43:34 +02:00
< p > ',lang(162),' : < input name = " name " value = " ',h( $J["name"] ),' " maxlength = " 64 " autocapitalize = " off " >
2013-07-27 17:52:25 +02:00
',($tf?lang(9).": ".adminer_html_select("language",$tf,$J["language"]):""),' < table cellspacing = " 0 " class = " nowrap " >
2013-07-27 17:43:34 +02:00
';edit_fields($J["fields"],$Xa,$sf);if(isset($_GET["function"])){echo"<tr><td>".lang(201);edit_type("returns",$J["returns"],$Xa);}echo' </ table >
< p > ';textarea("definition",$J["definition"]);echo' < p >
< input type = " submit " value = " ',lang(145),' " >
';if($da!=""){echo' < input type = " submit " name = " drop " value = " ',lang(86),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
' ;} elseif ( isset ( $_GET [ " sequence " ])){ $fa = $_GET [ " sequence " ]; $J = $_POST ; if ( $_POST &&! $n ){ $z = substr ( ME , 0 , - 1 ); $B = trim ( $J [ " name " ]); if ( $_POST [ " drop " ]) query_redirect ( " DROP SEQUENCE " . idf_escape ( $fa ), $z , lang ( 202 )); elseif ( $fa == " " ) query_redirect ( " CREATE SEQUENCE " . idf_escape ( $B ), $z , lang ( 203 )); elseif ( $fa != $B ) query_redirect ( " ALTER SEQUENCE " . idf_escape ( $fa ) . " RENAME TO " . idf_escape ( $B ), $z , lang ( 204 )); else
redirect ( $z );} page_header ( $fa != " " ? lang ( 205 ) . " : " . h ( $fa ) : lang ( 206 ), $n ); if ( ! $J ) $J [ " name " ] = $fa ; echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
2013-07-27 17:43:34 +02:00
< p >< input name = " name " value = " ',h( $J["name"] ),' " autocapitalize = " off " >
< input type = " submit " value = " ',lang(145),' " >
';if($fa!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(86). " '".confirm().">\n";echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
' ;} elseif ( isset ( $_GET [ " type " ])){ $ga = $_GET [ " type " ]; $J = $_POST ; if ( $_POST &&! $n ){ $z = substr ( ME , 0 , - 1 ); if ( $_POST [ " drop " ]) query_redirect ( " DROP TYPE " . idf_escape ( $ga ), $z , lang ( 207 )); else
query_redirect ( " CREATE TYPE " . idf_escape ( trim ( $J [ " name " ])) . " $J[as] " , $z , lang ( 208 ));} page_header ( $ga != " " ? lang ( 209 ) . " : " . h ( $ga ) : lang ( 210 ), $n ); if ( ! $J ) $J [ " as " ] = " AS " ; echo '
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
< p >
2013-07-27 17:43:34 +02:00
';if($ga!="")echo"<input type=' submit ' name=' drop ' value=' " .lang(86). " '".confirm().">\n";else{echo"<input name=' name ' value=' " .h( $J['name'] ). " ' autocapitalize=' off '>\n";textarea("as",$J["as"]);echo"<p><input type=' submit ' value=' " .lang(145). " '>\n";}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$B=$_GET["name"];$Ag=trigger_options();$zg=array("INSERT","UPDATE","DELETE");$J=(array)trigger($B)+array("Trigger"=>$a."_bi");if($_POST){if(!$n&&in_array($_POST["Timing"],$Ag["Timing"])&&in_array($_POST["Event"],$zg)&&in_array($_POST["Type"],$Ag["Type"])){$ge=" ON ".table($a);$Fb="DROP TRIGGER ".idf_escape($B).($w=="pgsql"?$ge:"");$_=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($Fb,$_,lang(211));else{if($B!="")queries($Fb);queries_redirect($_,($B!=""?lang(212):lang(213)),queries(create_trigger($ge,$_POST)));if($B!="")queries(create_trigger($ge,$J+array("Type"=>reset($Ag["Type"]))));}}$J=$_POST;}page_header(($B!=""?lang(214).": ".h($B):lang(215)),$n,array("table"=>$a));echo'
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " id = " form " >
< table cellspacing = " 0 " >
2013-07-27 17:52:25 +02:00
< tr >< th > ',lang(216),' < td > ',adminer_html_select("Timing",$Ag["Timing"],$J["Timing"],"if (/^".preg_quote($a,"/")."_[ba][iud]$/.test(this.form[' Trigger '].value)) this.form[' Trigger '].value = ' " .js_escape( $a ). " _ ' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form[' Event ']).charAt(0).toLowerCase();"),' < tr >< th > ',lang(217),' < td > ',adminer_html_select("Event",$zg,$J["Event"],"this.form[' Timing '].onchange();"),' < tr >< th > ',lang(96),' < td > ',adminer_html_select("Type",$Ag["Type"],$J["Type"]),' </ table >
2013-07-27 17:43:34 +02:00
< p > ',lang(162),' : < input name = " Trigger " value = " ',h( $J["Trigger"] ),' " maxlength = " 64 " autocapitalize = " off " >
< p > ';textarea("Statement",$J["Statement"]);echo' < p >
< input type = " submit " value = " ',lang(145),' " >
';if($B!=""){echo' < input type = " submit " name = " drop " value = " ',lang(86),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$Ve=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$J){foreach(explode(",",($J["Privilege"]=="Grant option"?"":$J["Context"]))as$hb)$Ve[$hb][$J["Privilege"]]=$J["Comment"];}$Ve["Server Admin"]+=$Ve["File access on server"];$Ve["Databases"]["Create routine"]=$Ve["Procedures"]["Create routine"];unset($Ve["Procedures"]["Create routine"]);$Ve["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$Ve["Columns"][$X]=$Ve["Tables"][$X];unset($Ve["Server Admin"]["Usage"]);foreach($Ve["Tables"]as$x=>$X)unset($Ve["Databases"][$x]);$Vd=array();if($_POST){foreach($_POST["objects"]as$x=>$X)$Vd[$X]=(array)$Vd[$X]+(array)$_POST["grants"][$x];}$Ec=array();$ee="";if(isset($_GET["host"])&&($H=$i->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($J=$H->fetch_row()){if(preg_match(' ~ GRANT ( .* ) ON ( .* ) TO ~ ',$J[0],$A)&&preg_match_all(' ~ * ([ ^ (,] * [ ^ ,(])( * \\ ([ ^ )] + \\ )) ? ~ ' , $A [ 1 ], $Bd , PREG_SET_ORDER )){ foreach ( $Bd
as $X ){ if ( $X [ 1 ] != " USAGE " ) $Ec [ " $A[2] $X[2] " ][ $X [ 1 ]] = true ; if ( ereg ( ' WITH GRANT OPTION' , $J [ 0 ])) $Ec [ " $A[2] $X[2] " ][ " GRANT OPTION " ] = true ;}} if ( preg_match ( " ~ IDENTIFIED BY PASSWORD '([^']+)~ " , $J [ 0 ], $A )) $ee = $A [ 1 ];}} if ( $_POST &&! $n ){ $fe = ( isset ( $_GET [ " host " ]) ? q ( $ha ) . " @ " . q ( $_GET [ " host " ]) : " '' " ); if ( $_POST [ " drop " ]) query_redirect ( " DROP USER $fe " , ME . " privileges= " , lang ( 218 )); else { $Xd = q ( $_POST [ " user " ]) . " @ " . q ( $_POST [ " host " ]); $Ge = $_POST [ " pass " ]; if ( $Ge != '' &&! $_POST [ " hashed " ]){ $Ge = $i -> result ( " SELECT PASSWORD( " . q ( $Ge ) . " ) " ); $n =! $Ge ;} $lb = false ; if ( ! $n ){ if ( $fe != $Xd ){ $lb = queries (( $i -> server_info < 5 ? " GRANT USAGE ON *.* TO " : " CREATE USER " ) . " $Xd IDENTIFIED BY PASSWORD " . q ( $Ge )); $n =! $lb ;} elseif ( $Ge != $ee ) queries ( " SET PASSWORD FOR $Xd = " . q ( $Ge ));} if ( ! $n ){ $pf = array (); foreach ( $Vd
as $ae => $Dc ){ if ( isset ( $_GET [ " grant " ])) $Dc = array_filter ( $Dc ); $Dc = array_keys ( $Dc ); if ( isset ( $_GET [ " grant " ])) $pf = array_diff ( array_keys ( array_filter ( $Vd [ $ae ], 'strlen' )), $Dc ); elseif ( $fe == $Xd ){ $ce = array_keys (( array ) $Ec [ $ae ]); $pf = array_diff ( $ce , $Dc ); $Dc = array_diff ( $Dc , $ce ); unset ( $Ec [ $ae ]);} if ( preg_match ( '~^(.+)\\s*(\\(.*\\))?$~U' , $ae , $A ) && ( ! grant ( " REVOKE " , $pf , $A [ 2 ], " ON $A[1] FROM $Xd " ) ||! grant ( " GRANT " , $Dc , $A [ 2 ], " ON $A[1] TO $Xd " ))){ $n = true ; break ;}}} if ( ! $n && isset ( $_GET [ " host " ])){ if ( $fe != $Xd ) queries ( " DROP USER $fe " ); elseif ( ! isset ( $_GET [ " grant " ])){ foreach ( $Ec
as $ae => $pf ){ if ( preg_match ( '~^(.+)(\\(.*\\))?$~U' , $ae , $A )) grant ( " REVOKE " , array_keys ( $pf ), $A [ 2 ], " ON $A[1] FROM $Xd " );}}} queries_redirect ( ME . " privileges= " ,( isset ( $_GET [ " host " ]) ? lang ( 219 ) : lang ( 220 )), ! $n ); if ( $lb ) $i -> query ( " DROP USER $Xd " );}} page_header (( isset ( $_GET [ " host " ]) ? lang ( 23 ) . " : " . h ( " $ha @ $_GET[host] " ) : lang ( 124 )), $n , array ( " privileges " => array ( '' , lang ( 54 )))); if ( $_POST ){ $J = $_POST ; $Ec = $Vd ;} else { $J = $_GET + array ( " host " => $i -> result ( " SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1) " )); $J [ " pass " ] = $ee ; if ( $ee != " " ) $J [ " hashed " ] = true ; $Ec [( DB == " " || $Ec ? " " : idf_escape ( addcslashes ( DB , " %_ \\ " ))) . " .* " ] = array ();} echo ' < form action = " " method = " post " >
2012-06-04 16:58:40 +02:00
< table cellspacing = " 0 " >
2013-07-27 17:43:34 +02:00
< tr >< th > ',lang(22),' < td >< input name = " host " maxlength = " 60 " value = " ',h( $J["host"] ),' " autocapitalize = " off " >
< tr >< th > ',lang(23),' < td >< input name = " user " maxlength = " 16 " value = " ',h( $J["user"] ),' " autocapitalize = " off " >
< tr >< th > ',lang(24),' < td >< input name = " pass " id = " pass " value = " ',h( $J["pass"] ),' " >
';if(!$J["hashed"]){echo' < script type = " text/javascript " > typePassword ( document . getElementById ( \ 'pass\'));</script>' ;} echo
checkbox ( " hashed " , 1 , $J [ " hashed " ], lang ( 221 ), " typePassword(this.form['pass'], this.checked); " ), ' </ table >
2012-06-04 16:58:40 +02:00
2013-07-27 17:43:34 +02:00
';echo"<table cellspacing=' 0 '>\n","<thead><tr><th colspan=' 2 '><a href=' http :// dev . mysql . com / doc / refman / " .substr( $i->server_info ,0,3). " / en / grant . html #priv_level' target='_blank' rel='noreferrer' class='help'>".lang(54)."</a>";$s=0;foreach($Ec
as $ae => $Dc ){ echo '<th>' . ( $ae != " *.* " ? " <input name='objects[ $s ]' value=' " . h ( $ae ) . " ' size='10' autocapitalize='off'> " : " <input type='hidden' name='objects[ $s ]' value='*.*' size='10'>*.* " ); $s ++ ;} echo " </thead> \n " ; foreach ( array ( " " => " " , " Server Admin " => lang ( 22 ), " Databases " => lang ( 25 ), " Tables " => lang ( 107 ), " Columns " => lang ( 108 ), " Procedures " => lang ( 222 ),) as $hb => $xb ){ foreach (( array ) $Ve [ $hb ] as $Ue => $bb ){ echo " <tr " . odd () . " ><td " . ( $xb ? " > $xb <td " : " colspan='2' " ) . ' lang="en" title="' . h ( $bb ) . '">' . h ( $Ue ); $s = 0 ; foreach ( $Ec
as $ae => $Dc ){ $B = " 'grants[ $s ][ " . h ( strtoupper ( $Ue )) . " ]' " ; $Y = $Dc [ strtoupper ( $Ue )]; if ( $hb == " Server Admin " && $ae != ( isset ( $Ec [ " *.* " ]) ? " *.* " : " .* " )) echo " <td> " ; elseif ( isset ( $_GET [ " grant " ])) echo " <td><select name= $B ><option><option value='1' " . ( $Y ? " selected " : " " ) . " > " . lang ( 223 ) . " <option value='0' " . ( $Y == " 0 " ? " selected " : " " ) . " > " . lang ( 224 ) . " </select> " ; else
echo " <td align='center'><label class='block'><input type='checkbox' name= $B value='1' " . ( $Y ? " checked " : " " ) . ( $Ue == " All privileges " ? " id='grants- $s -all' " : ( $Ue == " Grant option " ? " " : " onclick= \" if (this.checked) formUncheck('grants- $s -all'); \" " )) . " ></label> " ; $s ++ ;}}} echo " </table> \n " , ' < p >
< input type = " submit " value = " ',lang(145),' " >
';if(isset($_GET["host"])){echo' < input type = " submit " name = " drop " value = " ',lang(86),' " ',confirm(),' > ';}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$n){$ld=0;foreach((array)$_POST["kill"]as$X){if(queries("KILL ".(+$X)))$ld++;}queries_redirect(ME."processlist=",lang(225,$ld),$ld||!$_POST["kill"]);}page_header(lang(78),$n);echo'
2012-06-04 16:58:40 +02:00
< form action = " " method = " post " >
2013-07-27 17:43:34 +02:00
< table cellspacing = " 0 " onclick = " tableClick(event); " ondblclick = " tableClick(event, true); " class = " nowrap checkable " >
';$s=-1;foreach(process_list()as$s=>$J){if(!$s){echo"<thead><tr lang=' en ' > " .(support( " kill " )? " < th >& nbsp ; " : " " );foreach( $J
as $x => $X ) echo " <th> " . ( $w == " sql " ? " <a href='http://dev.mysql.com/doc/refman/ " . substr ( $i -> server_info , 0 , 3 ) . " /en/show-processlist.html#processlist_ " . strtolower ( $x ) . " ' target='_blank' rel='noreferrer' class='help'> $x </a> " : $x ); echo " </thead> \n " ;} echo " <tr " . odd () . " > " . ( support ( " kill " ) ? " <td> " . checkbox ( " kill[] " , $J [ " Id " ], 0 ) : " " ); foreach ( $J
as $x => $X ) echo " <td> " . (( $w == " sql " && $x == " Info " && ereg ( " Query|Killed " , $J [ " 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 . ( $J [ " db " ] != " " ? " db= " . urlencode ( $J [ " db " ]) . " & " : " " ) . " sql= " . urlencode ( $X )) . '">' . lang ( 226 ) . '</a>' : nbsp ( $X )); echo " \n " ;} echo ' </ table >
< script type = \ ' text / javascript\ ' > tableCheck (); </ script >
< p >
';if(support("kill")){echo($s+1)."/".lang(227,$i->result("SELECT @@max_connections")),"<p><input type=' submit ' value=' " .lang(228). " '>\n";}echo' < input type = " hidden " name = " token " value = " ', $S ,' " >
2012-06-04 16:58:40 +02:00
</ form >
2013-07-27 17:43:34 +02:00
' ;} elseif ( isset ( $_GET [ " select " ])){ $a = $_GET [ " select " ]; $Q = table_status1 ( $a ); $v = indexes ( $a ); $p = fields ( $a ); $vc = column_foreign_keys ( $a ); $be = " " ; if ( $Q [ " Oid " ]){ $be = ( $w == " sqlite " ? " rowid " : " oid " ); $v [] = array ( " type " => " PRIMARY " , " columns " => array ( $be ));} parse_str ( $_COOKIE [ " adminer_import " ], $ra ); $qf = array (); $g = array (); $kg = null ; foreach ( $p
as $x => $o ){ $B = $b -> fieldName ( $o ); if ( isset ( $o [ " privileges " ][ " select " ]) && $B != " " ){ $g [ $x ] = html_entity_decode ( strip_tags ( $B ), ENT_QUOTES ); if ( is_shortable ( $o )) $kg = $b -> selectLengthProcess ();} $qf += $o [ " privileges " ];} list ( $L , $Fc ) = $b -> selectColumnsProcess ( $g , $v ); $cd = count ( $Fc ) < count ( $L ); $Z = $b -> selectSearchProcess ( $p , $v ); $pe = $b -> selectOrderProcess ( $p , $v ); $y = $b -> selectLimitProcess (); $_c = ( $L ? implode ( " , " , $L ) : " * " . ( $be ? " , $be " : " " )) . convert_fields ( $g , $p , $L ) . " \n FROM " . table ( $a ); $Gc = ( $Fc && $cd ? " \n GROUP BY " . implode ( " , " , $Fc ) : " " ) . ( $pe ? " \n ORDER BY " . implode ( " , " , $pe ) : " " ); if ( $_GET [ " val " ] && is_ajax ()){ header ( " Content-Type: text/plain; charset=utf-8 " ); foreach ( $_GET [ " val " ] as $Hg => $J ){ $ya = convert_field ( $p [ key ( $J )]); echo $i -> result ( " SELECT " . limit ( $ya ? $ya : idf_escape ( key ( $J )) . " FROM " . table ( $a ), " WHERE " . where_check ( $Hg , $p ) . ( $Z ? " AND " . implode ( " AND " , $Z ) : " " ) . ( $pe ? " ORDER BY " . implode ( " , " , $pe ) : " " ), 1 ));} exit ;} if ( $_POST &&! $n ){ $ah = $Z ; if ( is_array ( $_POST [ " check " ])) $ah [] = " (( " . implode ( " ) OR ( " , array_map ( 'where_check' , $_POST [ " check " ])) . " )) " ; $ah = ( $ah ? " \n WHERE " . implode ( " AND " , $ah ) : " " ); $Qe = $Jg = null ; foreach ( $v
as $u ){ if ( $u [ " type " ] == " PRIMARY " ){ $Qe = array_flip ( $u [ " columns " ]); $Jg = ( $L ? $Qe : array ()); break ;}} foreach (( array ) $Jg
as $x => $X ){ if ( in_array ( idf_escape ( $x ), $L )) unset ( $Jg [ $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 " ]) || $Jg === array ()) $G = " SELECT $_c $ah $Gc " ; else { $Fg = array (); foreach ( $_POST [ " check " ] as $X ) $Fg [] = " (SELECT " . limit ( $_c , " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $p ) . $Gc , 1 ) . " ) " ; $G = implode ( " UNION ALL " , $Fg );} $b -> dumpData ( $a , " table " , $G ); exit ;} if ( ! $b -> selectEmailProcess ( $Z , $vc )){ if ( $_POST [ " save " ] || $_POST [ " delete " ]){ $H = true ; $sa = 0 ; $G = table ( $a ); $N = array (); if ( ! $_POST [ " delete " ]){ foreach ( $g
as $B => $X ){ $X = process_input ( $p [ $B ]); if ( $X !== null ){ if ( $_POST [ " clone " ]) $N [ idf_escape ( $B )] = ( $X !== false ? $X : idf_escape ( $B )); elseif ( $X !== false ) $N [] = idf_escape ( $B ) . " = $X " ;}} $G .= ( $_POST [ " clone " ] ? " ( " . implode ( " , " , array_keys ( $N )) . " ) \n SELECT " . implode ( " , " , $N ) . " \n FROM " . table ( $a ) : " SET \n " . implode ( " , \n " , $N ));} if ( $_POST [ " delete " ] || $N ){ $Za = " UPDATE " ; if ( $_POST [ " delete " ]){ $Za = " DELETE " ; $G = " FROM $G " ;} if ( $_POST [ " clone " ]){ $Za = " INSERT " ; $G = " INTO $G " ;} if ( $_POST [ " all " ] || ( $Jg === array () && is_array ( $_POST [ " check " ])) || $cd ){ $H = queries ( " $Za $G $ah " ); $sa = $i -> affected_rows ;} else { foreach (( array ) $_POST [ " check " ] as $X ){ $H = queries ( $Za . limit1 ( $G , " \n WHERE " . ( $Z ? implode ( " AND " , $Z ) . " AND " : " " ) . where_check ( $X , $p ))); if ( ! $H ) break ; $sa += $i -> affected_rows ;}}} $Jd = lang ( 229 , $sa ); if ( $_POST [ " clone " ] && $H && $sa == 1 ){ $qd = last_id (); if ( $qd ) $Jd = lang ( 142 , " $qd " );} queries_redirect ( remove_from_uri ( $_POST [ " all " ] && $_POST [ " delete " ] ? " page " : " " ), $Jd , $H );} elseif ( ! $_POST [ " import " ]){ if ( ! $_POST [ " val " ]) $n = lang ( 230 ); else { $H = true ; $sa = 0 ; foreach ( $_POST [ " val " ] as $Hg => $J ){ $N = array (); foreach ( $J
as $x => $X ){ $x = bracket_escape ( $x , 1 ); $N [] = idf_escape ( $x ) . " = " . ( ereg ( 'char|text' , $p [ $x ][ " type " ]) || $X != " " ? $b -> processInput ( $p [ $x ], $X ) : " NULL " );} $G = table ( $a ) . " SET " . implode ( " , " , $N ); $Zg = " WHERE " . where_check ( $Hg , $p ) . ( $Z ? " AND " . implode ( " AND " , $Z ) : " " ); $H = queries ( " UPDATE " . ( $cd || $Jg === array () ? " $G $Zg " : limit1 ( $G , $Zg ))); if ( ! $H ) break ; $sa += $i -> affected_rows ;} queries_redirect ( remove_from_uri (), lang ( 229 , $sa ), $H );}} elseif ( ! is_string ( $oc = get_file ( " csv_file " , true ))) $n = upload_error ( $oc ); elseif ( ! preg_match ( '~~u' , $oc )) $n = lang ( 231 ); else { cookie ( " adminer_import " , " output= " . urlencode ( $ra [ " output " ]) . " &format= " . urlencode ( $_POST [ " separator " ])); $H = true ; $Ya = array_keys ( $p ); preg_match_all ( '~(?>"[^"]*"|[^"\\r\\n]+)+~' , $oc , $Bd ); $sa = count ( $Bd [ 0 ]); begin (); $Cf = ( $_POST [ " separator " ] == " csv " ? " , " : ( $_POST [ " separator " ] == " tsv " ? " \t " : " ; " )); foreach ( $Bd [ 0 ] as $x => $X ){ preg_match_all ( " ~((?> \" [^ \" ]* \" )+|[^ $Cf ]*) $Cf ~ " , $X . $Cf , $Cd ); if ( ! $x &&! array_diff ( $Cd [ 1 ], $Ya )){ $Ya = $Cd [ 1 ]; $sa -- ;} else { $N = array (); foreach ( $Cd [ 1 ] as $s => $Va ) $N [ idf_escape ( $Ya [ $s ])] = ( $Va == " " && $p [ $Ya [ $s ]][ " null " ] ? " NULL " : q ( str_replace ( '""' , '"' , preg_replace ( '~^"|"$~' , '' , $Va )))); $H = insert_update ( $a , $N , $Qe ); if ( ! $H ) break ;}} if ( $H ) queries ( " COMMIT " ); queries_redirect ( remove_from_uri ( " page " ), lang ( 232 , $sa ), $H ); queries ( " ROLLBACK " );}}} $Yf = $b -> tableName ( $Q ); if ( is_ajax ()) ob_start (); page_header ( lang ( 36 ) . " : $Yf " , $n ); $N = null ; if ( isset ( $qf [ " insert " ])){ $N = " " ; foreach (( array ) $_GET [ " where " ] as $X ){ if ( count ( $vc [ $X [ " col " ]]) == 1 && ( $X [ " op " ] == " = " || ( ! $X [ " op " ] &&! ereg ( '[_%]' , $X [ " val " ])))) $N .= " &set " . urlencode ( " [ " . bracket_escape ( $X [ " col " ]) . " ] " ) . " = " . urlencode ( $X [ " val " ]);}} $b -> selectLinks ( $Q , $N ); if ( ! $g ) echo " <p class='error'> " . lang ( 233 ) . ( $p ? " . " : " : " . error ()) . " \n " ; else { echo " <form action='' id='form'> \n " , " <div style='display: none;'> " ; hidden_fields_get (); echo ( DB != " " ? '<input type="hidden" name="db" value="' . h ( DB ) . '">' . ( isset ( $_GET [ " ns " ]) ? '<input type="hidden" name="ns" value="' . h ( $_GET [ " ns " ]) . '">' : " " ) : " " ); echo '<input type="hidden" name="select" value="' . h ( $a ) . '">' , " </div> \n " ; $b -> selectColumnsPrint ( $L , $g ); $b -> selectSearchPrint ( $Z , $g , $v ); $b -> selectOrderPrint ( $pe , $g , $v ); $b -> selectLimitPrint ( $y ); $b -> selectLengthPrint ( $kg ); $b -> selectActionPrint ( $v ); echo " </form> \n " ; $D = $_GET [ " page " ]; if ( $D == " last " ){ $yc = $i -> result ( " SELECT COUNT(*) FROM " . table ( $a ) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " )); $D = floor ( max ( 0 , $yc - 1 ) / $y );} $G = $b -> selectQueryBuild ( $L , $Z , $Fc , $pe , $y , $D ); if ( ! $G ) $G = " SELECT " . limit (( + $y && $Fc && $cd && $w == " sql " ? " SQL_CALC_FOUND_ROWS " : " " ) . $_c ,( $Z ? " \n WHERE " . implode ( " AND " , $Z ) : " " ) . $Gc ,( $y != " " ? + $y : null ),( $D ? $y * $D : 0 ), " \n " ); echo $b -> selectQuery ( $G ); $H = $i -> query ( $G ); if ( ! $H ) echo " <p class='error'> " . error () . " \n " ; else { if ( $w == " mssql " && $D ) $H -> seek ( $y * $D ); $Qb = array (); echo " <form action='' method='post' enctype='multipart/form-data'> \n " ; $K = array (); while ( $J = $H -> fetch_assoc ()){ if ( $D && $w == " oracle " ) unset ( $J [ " RNUM " ]); $K [] = $J ;} if ( $_GET [ " page " ] != " last " ) $yc = ( + $y && $Fc && $cd ? ( $w == " sql " ? $i -> result ( " SELECT FOUND_ROWS() " ) : $i -> result ( " SELECT COUNT(*) FROM ( $G ) x " )) : count ( $K )); if ( ! $K ) echo " <p class='message'> " . lang ( 89 ) . " \n " ; else { $Ea = $b -> backwardKeys ( $a , $Yf ); echo " <table id='table' cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);' onkeydown='return editingKeydown(event);'> \n " , " <thead><tr> " . ( ! $Fc && $L ? " " : " <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 ( 234 ) . " </a> " ); $Ud = array (); $Cc = array (); reset ( $L ); $bf = 1 ; foreach ( $K [ 0 ] as $x => $X ){ if ( $x != $be ){ $X = $_GET [ " columns " ][ key ( $L )]; $o = $p [ $L ? ( $X ? $X [ " col " ] : current ( $L )) : $x ]; $B = ( $o ? $b -> fieldName ( $o , $bf ) : " * " ); if ( $B != " " ){ $bf ++ ; $Ud [ $x ] = $B ; $f = idf_escape ( $x ); $Nc = remove_from_uri ( '(order|desc)[^=]*|page' ) . '&order%5B0%5D=' . urlencode ( $x ); $xb = " &desc%5B0%5D=1 " ; echo '<th onmouseover="columnMouse(this);" onmouseout="columnMouse(this, \' hidden\');">' , '<a href="' . h ( $Nc . ( $pe [ 0 ] == $f || $pe [ 0 ] == $x || ( ! $pe && $cd && $Fc [ 0 ] == $f ) ? $xb : '' )) . '">' ; echo ( ! $L || $X ? apply_sql_function ( $X [ " fun " ], $B ) : h ( current ( $L ))) . " </a> " ; echo " <span class='column hidden'> " , " <a href=' " . h ( $Nc . $xb ) . " ' title=' " . lang ( 42 ) . " ' class='text'> ↓</a> "
as $J ){ foreach ( $J
as $x => $X ) $wd [ $x ] = max ( $wd [ $x ], min ( 40 , strlen ( utf8_decode ( $X ))));}} echo ( $Ea ? " <th> " . lang ( 235 ) : " " ) . " </thead> \n " ; if ( is_ajax ()){ if ( $y % 2 == 1 && $D % 2 == 1 ) odd (); ob_end_clean ();} foreach ( $b -> rowDescriptions ( $K , $vc ) as $Td => $J ){ $Gg = unique_array ( $K [ $Td ], $v ); if ( ! $Gg ){ $Gg = array (); foreach ( $K [ $Td ] as $x => $X ){ if ( ! preg_match ( '~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~' , $x )) $Gg [ $x ] = $X ;}} $Hg = " " ; foreach ( $Gg
as $x => $X ){ if ( strlen ( $X ) > 64 ){ $x = " MD5( " . ( strpos ( $x , '(' ) ? $x : idf_escape ( $x )) . " ) " ; $X = md5 ( $X );} $Hg .= " & " . ( $X !== null ? urlencode ( " where[ " . bracket_escape ( $x ) . " ] " ) . " = " . urlencode ( $X ) : " null%5B%5D= " . urlencode ( $x ));} echo " <tr " . odd () . " > " . ( ! $Fc && $L ? " " : " <td> " . checkbox ( " check[] " , substr ( $Hg , 1 ), in_array ( substr ( $Hg , 1 ),( array ) $_POST [ " check " ]), " " , " this.form['all'].checked = false; formUncheck('all-page'); " ) . ( $cd || information_schema ( DB ) ? " " : " <a href=' " . h ( ME . " edit= " . urlencode ( $a ) . $Hg ) . " '> " . lang ( 234 ) . " </a> " )); foreach ( $J
as $x => $X ){ if ( isset ( $Ud [ $x ])){ $o = $p [ $x ]; if ( $X != " " && ( ! isset ( $Qb [ $x ]) || $Qb [ $x ] != " " )) $Qb [ $x ] = ( is_mail ( $X ) ? $Ud [ $x ] : " " ); $z = " " ; $X = $b -> editVal ( $X , $o ); if ( $X !== null ){ if ( ereg ( 'blob|bytea|raw|file' , $o [ " type " ]) && $X != " " ) $z = ME . 'download=' . urlencode ( $a ) . '&field=' . urlencode ( $x ) . $Hg ; if ( $X === " " ) $X = " " ; elseif ( $kg != " " && is_shortable ( $o )) $X = shorten_utf8 ( $X , max ( 0 , + $kg )); else $X = h ( $X ); if ( ! $z ){ foreach (( array ) $vc [ $x ] as $q ){ if ( count ( $vc [ $x ]) == 1 || end ( $q [ " source " ]) == $x ){ $z = " " ; foreach ( $q [ " source " ] as $s => $If ) $z .= where_link ( $s , $q [ " target " ][ $s ], $K [ $Td ][ $If ]); $z = ( $q [ " db " ] != " " ? preg_replace ( '~([?&]db=)[^&]+~' , '\\1' . urlencode ( $q [ " db " ]), ME ) : ME ) . 'select=' . urlencode ( $q [ " table " ]) . $z ; if ( count ( $q [ " source " ]) == 1 ) break ;}}} if ( $x == " COUNT(*) " ){ $z = ME . " select= " . urlencode ( $a ); $s = 0 ; foreach (( array ) $_GET [ " where " ] as $W ){ if ( ! array_key_exists ( $W [ " col " ], $Gg )) $z .= where_link ( $s ++ , $W [ " col " ], $W [ " val " ], $W [ " op " ]);} foreach ( $Gg
as $hd => $W ) $z .= where_link ( $s ++ , $hd , $W );}} if ( ! $z && ( $z = $b -> selectLink ( $J [ $x ], $o )) === null ){ if ( is_mail ( $J [ $x ])) $z = " mailto: $J[$x] " ; if ( $Ye = is_url ( $J [ $x ])) $z = ( $Ye == " http " && $ba ? $J [ $x ] : " $Ye ://www.adminer.org/redirect/?url= " . urlencode ( $J [ $x ]));} $Oc = h ( " val[ $Hg ][ " . bracket_escape ( $x ) . " ] " ); $Y = $_POST [ " val " ][ $Hg ][ bracket_escape ( $x )]; $Ic = h ( $Y !== null ? $Y : $J [ $x ]); $_d = strpos ( $X , " <i>...</i> " ); $Mb = is_utf8 ( $X ) && $K [ $Td ][ $x ] == $J [ $x ] &&! $Cc [ $x ]; $jg = ereg ( 'text|lob' , $o [ " type " ]); echo (( $_GET [ " modify " ] && $Mb ) || $Y !== null ? " <td> " . ( $jg ? " <textarea name=' $Oc ' cols='30' rows=' " . ( substr_count ( $J [ $x ], " \n " ) + 1 ) . " '> $Ic </textarea> " : " <input name=' $Oc ' value=' $Ic ' size=' $wd[$x] '> " ) : " <td id=' $Oc ' onclick= \" selectClick(this, event, " . ( $_d ? 2 : ( $jg ? 1 : 0 )) . ( $Mb ? " " : " , ' " . h ( lang ( 236 )) . " ' " ) . " ); \" > " . $b -> selectVal ( $X , $z , $o ));}} if ( $Ea ) echo " <td> " ; $b -> backwardKeysPrint ( $Ea , $K [ $Td ]); echo " </tr> \n " ;} if ( is_ajax ()) exit ; echo " </table> \n " ,( ! $Fc && $L ? " " : " <script type='text/javascript'>tableCheck();</script> \n " );} if (( $K || $D ) &&! is_ajax ()){ $ac = true ; if ( $_GET [ " page " ] != " last " &&+ $y &&! $cd && ( $yc >= $y || $D )){ $yc = found_rows ( $Q , $Z ); if ( $yc < max ( 1e4 , 2 * ( $D + 1 ) * $y )) $yc = reset ( slow_query ( " SELECT COUNT(*) FROM " . table ( $a ) . ( $Z ? " WHERE " . implode ( " AND " , $Z ) : " " ))); else $ac = false ;} if ( + $y && ( $yc === false || $yc > $y || $D )){ echo " <p class='pages'> " ; $Ed = ( $yc === false ? $D + ( count ( $K ) >= $y ? 2 : 1 ) : floor (( $yc - 1 ) / $y )); echo '<a href="' . h ( remove_from_uri ( " page " )) . " \" onclick= \" pageClick(this.href, +prompt(' " . lang ( 237 ) . " ', ' " . ( $D + 1 ) . " '), event); return false; \" > " . lang ( 237 ) . " </a>: " , pagination ( 0 , $D ) . ( $D > 5 ? " ... " : " " ); for ( $s = max ( 1 , $D - 4 ); $s < min ( $Ed , $D + 5 ); $s ++ ) echo
pagination ( $s , $D ); if ( $Ed > 0 ){ echo ( $D + 5 < $Ed ? " ... " : " " ),( $ac && $yc !== false ? pagination ( $Ed , $D ) : " <a href=' " . h ( remove_from_uri ( " page " ) . " &page=last " ) . " ' title='~ $Ed '> " . lang ( 238 ) . " </a> " );} echo (( $yc === false ? count ( $K ) + 1 : $yc - $D * $y ) > $y ? ' <a href="' . h ( remove_from_uri ( " page " ) . " &page= " . ( $D + 1 )) . '" onclick="return !selectLoadMore(this, ' . ( + $y ) . ', \'' . lang ( 239 ) . '\');">' . lang ( 240 ) . '</a>' : '' );} echo " <p> \n " ,( $yc !== false ? " ( " . ( $ac ? " " : " ~ " ) . lang ( 126 , $yc ) . " ) " : " " ), checkbox ( " all " , 1 , 0 , lang ( 241 )) . " \n " ; if ( $b -> selectCommandPrint ()){ echo '<fieldset><legend>' , lang ( 34 ), ' </ legend >< div >
< input type = " submit " value = " ',lang(145),' " ',($_GET["modify"]?' ':' title = " '.lang(230).' " class = " jsonly " '),' >
< input type = " submit " name = " edit " value = " ',lang(34),' " >
< input type = " submit " name = " clone " value = " ',lang(226),' " >
< input type = " submit " name = " delete " value = " ',lang(148),' " onclick = " return confirm( \ '',lang(0);?> (' + (this.form['all'].checked ? <?php echo $yc ,' : formChecked(this, /check/)) + \ ') \ '); " >
2012-06-04 16:58:40 +02:00
</ div ></ fieldset >
2013-07-27 17:52:25 +02:00
';}$wc=$b->dumpFormat();foreach((array)$_GET["columns"]as$f){if($f["fun"]){unset($wc[' sql ']);break;}}if($wc){print_fieldset("export",lang(118));$ye=$b->dumpOutput();echo($ye?adminer_html_select("output",$ye,$ra["output"])." ":""),adminer_html_select("format",$wc,$ra["format"])," <input type=' submit ' name=' export ' value=' " .lang(118). " '>\n","</div></fieldset>\n";}}if($b->selectImportPrint()){print_fieldset("import",lang(55),!$K);echo"<input type=' file ' name=' csv_file '> ",adminer_html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$ra["format"],1);echo" <input type=' submit ' name=' import ' value=' " .lang(55). " '>","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($Qb,' strlen '),$g);echo"<p><input type=' hidden ' name=' token ' value=' $S '></p>\n","</form>\n";}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$Nf=isset($_GET["status"]);page_header($Nf?lang(80):lang(79));$Tg=($Nf?show_status():show_variables());if(!$Tg)echo"<p class=' message '>".lang(89)."\n";else{echo"<table cellspacing=' 0 ' > \n " ;foreach( $Tg
2013-07-27 17:43:34 +02:00
as $x => $X ){ echo " <tr> " , " <th><code class='jush- " . $w . ( $Nf ? " 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 " ){ $Vf = array ( " Data_length " => 0 , " Index_length " => 0 , " Data_free " => 0 ); foreach ( table_status () as $B => $Q ){ $Oc = js_escape ( $B ); json_row ( " Comment- $Oc " , nbsp ( $Q [ " Comment " ])); if ( ! is_view ( $Q )){ foreach ( array ( " Engine " , " Collation " ) as $x ) json_row ( " $x - $Oc " , nbsp ( $Q [ $x ])); foreach ( $Vf + array ( " Auto_increment " => 0 , " Rows " => 0 ) as $x => $X ){ if ( $Q [ $x ] != " " ){ $X = number_format ( $Q [ $x ], 0 , '.' , lang ( 8 )); json_row ( " $x - $Oc " ,( $x == " Rows " && $X && $Q [ " Engine " ] == ( $Kf == " pgsql " ? " table " : " InnoDB " ) ? " ~ $X " : $X )); if ( isset ( $Vf [ $x ])) $Vf [ $x ] += ( $Q [ " Engine " ] != " InnoDB " || $x != " Data_free " ? $Q [ $x ] : 0 );} elseif ( array_key_exists ( $x , $Q )) json_row ( " $x - $Oc " );}}} foreach ( $Vf
as $x => $X ) json_row ( " sum- $x " , number_format ( $X , 0 , '.' , lang ( 8 ))); json_row ( " " );} elseif ( $_GET [ " script " ] == " kill " ) $i -> query ( " KILL " . ( + $_POST [ " kill " ])); else { foreach ( count_tables ( $b -> databases ()) as $m => $X ) json_row ( " tables- " . js_escape ( $m ), $X ); json_row ( " " );} exit ;} else { $eg = array_merge (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ]); if ( $eg &&! $n &&! $_POST [ " search " ]){ $H = true ; $Jd = " " ; 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 " ]) $H = truncate_tables ( $_POST [ " tables " ]); $Jd = lang ( 242 );} elseif ( $_POST [ " move " ]){ $H = move_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $Jd = lang ( 243 );} elseif ( $_POST [ " copy " ]){ $H = copy_tables (( array ) $_POST [ " tables " ],( array ) $_POST [ " views " ], $_POST [ " target " ]); $Jd = lang ( 244 );} elseif ( $_POST [ " drop " ]){ if ( $_POST [ " views " ]) $H = drop_views ( $_POST [ " views " ]); if ( $H && $_POST [ " tables " ]) $H = drop_tables ( $_POST [ " tables " ]); $Jd = lang ( 245 );} elseif ( $w != " sql " ){ $H = ( $w == " sqlite " ? queries ( " VACUUM " ) : apply_queries ( " VACUUM " . ( $_POST [ " optimize " ] ? " " : " ANALYZE " ), $_POST [ " tables " ])); $Jd = lang ( 246 );} elseif ( ! $_POST [ " tables " ]) $Jd = lang ( 7 ); elseif ( $H = queries (( $_POST [ " optimize " ] ? " OPTIMIZE " : ( $_POST [ " check " ] ? " CHECK " : ( $_POST [ " repair " ] ? " REPAIR " : " ANALYZE " ))) . " TABLE " . implode ( " , " , array_map ( 'idf_escape' , $_POST [ " tables " ])))){ while ( $J = $H -> fetch_assoc ()) $Jd .= " <b> " . h ( $J [ " Table " ]) . " </b>: " . h ( $J [ " Msg_text " ]) . " <br> " ;} queries_redirect ( substr ( ME , 0 , - 1 ), $Jd , $H );} page_header (( $_GET [ " ns " ] == " " ? lang ( 25 ) . " : " . h ( DB ) : lang ( 87 ) . " : " . h ( $_GET [ " ns " ])), $n , true ); if ( $b -> homepage ()){ if ( $_GET [ " ns " ] !== " " ){ echo " <h3 id='tables-views'> " . lang ( 247 ) . " </h3> \n " ; $dg = tables_list (); if ( ! $dg ) echo " <p class='message'> " . lang ( 7 ) . " \n " ; else { echo " <form action='' method='post'> \n " , " <p> " . lang ( 248 ) . " : <input type='search' name='query' value=' " . h ( $_POST [ " query " ]) . " '> <input type='submit' name='search' value=' " . lang ( 39 ) . " '> \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)\[/);">' , '<th>' . lang ( 107 ), '<td>' . lang ( 249 ), '<td>' . lang ( 84 ), '<td>' . lang ( 250 ), '<td>' . lang ( 251 ), '<td>' . lang ( 252 ), '<td>' . lang ( 99 ), '<td>' . lang ( 253 ),( support ( " comment " ) ? '<td>' . lang ( 101 ) : '' ), " </thead> \n " ; foreach ( $dg
2013-07-27 17:52:25 +02:00
as $B => $T ){ $Vg = ( $T !== null &&! eregi ( " table " , $T )); echo '<tr' . odd () . '><td>' . checkbox (( $Vg ? " views[] " : " tables[] " ), $B , in_array ( $B , $eg , true ), " " , " formUncheck('check-all'); " ), '<th><a href="' . h ( ME ) . 'table=' . urlencode ( $B ) . '" title="' . lang ( 29 ) . '">' . h ( $B ) . '</a>' ; if ( $Vg ){ echo '<td colspan="6"><a href="' . h ( ME ) . " view= " . urlencode ( $B ) . '" title="' . lang ( 30 ) . '">' . lang ( 106 ) . '</a>' , '<td align="right"><a href="' . h ( ME ) . " select= " . urlencode ( $B ) . '" title="' . lang ( 28 ) . '">?</a>' ;} else { foreach ( array ( " Engine " => array (), " Collation " => array (), " Data_length " => array ( " create " , lang ( 31 )), " Index_length " => array ( " indexes " , lang ( 110 )), " Data_free " => array ( " edit " , lang ( 32 )), " Auto_increment " => array ( " auto_increment=1&create " , lang ( 31 )), " Rows " => array ( " select " , lang ( 28 )),) as $x => $z ) echo ( $z ? " <td align='right'><a href=' " . h ( ME . " $z[0] = " ) . urlencode ( $B ) . " ' id=' $x - " . h ( $B ) . " ' title=' $z[1] '>?</a> " : " <td id=' $x - " . h ( $B ) . " '> " );} echo ( support ( " comment " ) ? " <td id='Comment- " . h ( $B ) . " '> " : " " );} echo " <tr><td> <th> " . lang ( 227 , count ( $dg )), " <td> " . nbsp ( $w == " sql " ? $i -> 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 " , " <script type='text/javascript'>tableCheck();</script> \n " ; if ( ! information_schema ( DB )){ echo " <p> " . ( ereg ( '^(sql|sqlite|pgsql)$' , $w ) ? ( $w != " sqlite " ? " <input type='submit' value=' " . lang ( 254 ) . " '> " : " " ) . " <input type='submit' name='optimize' value=' " . lang ( 255 ) . " '> " : " " ) . ( $w == " sql " ? " <input type='submit' name='check' value=' " . lang ( 256 ) . " '> <input type='submit' name='repair' value=' " . lang ( 257 ) . " '> " : " " ) . " <input type='submit' name='truncate' value=' " . lang ( 258 ) . " ' " . confirm ( " formChecked(this, /tables/) " ) . " > <input type='submit' name='drop' value=' " . lang ( 86 ) . " ' " . confirm ( " formChecked(this, /tables|views/) " ) . " > \n " ; $l = ( support ( " scheme " ) ? schemas () : $b -> databases ()); if ( count ( $l ) != 1 && $w != " sqlite " ){ $m = ( isset ( $_POST [ " target " ]) ? $_POST [ " target " ] : ( support ( " scheme " ) ? $_GET [ " ns " ] : DB )); echo " <p> " . lang ( 259 ) . " : " ,( $l ? adminer_html_select ( " target " , $l , $m ) : '<input name="target" value="' . h ( $m ) . '" autocapitalize="off">' ), " <input type='submit' name='move' value=' " . lang ( 260 ) . " '> " ,( support ( " copy " ) ? " <input type='submit' name='copy' value=' " . lang ( 261 ) . " '> " : " " ), " \n " ;} echo " <input type='hidden' name='token' value=' $S '> \n " ;} echo " </form> \n " ;} echo '<p><a href="' . h ( ME ) . 'create=">' . lang ( 152 ) . " </a> \n " ; if ( support ( " view " )) echo '<a href="' . h ( ME ) . 'view=">' . lang ( 184 ) . " </a> \n " ; if ( support ( " routine " )){ echo " <h3 id='routines'> " . lang ( 121 ) . " </h3> \n " ; $uf = routines (); if ( $uf ){ echo " <table cellspacing='0'> \n " , '<thead><tr><th>' . lang ( 162 ) . '<td>' . lang ( 96 ) . '<td>' . lang ( 201 ) . " <td> </thead> \n " ; odd ( '' ); foreach ( $uf
2013-07-27 17:43:34 +02:00
as $J ){ echo '<tr' . odd () . '>' , '<th><a href="' . h ( ME ) . ( $J [ " ROUTINE_TYPE " ] != " PROCEDURE " ? 'callf=' : 'call=' ) . urlencode ( $J [ " ROUTINE_NAME " ]) . '">' . h ( $J [ " ROUTINE_NAME " ]) . '</a>' , '<td>' . h ( $J [ " ROUTINE_TYPE " ]), '<td>' . h ( $J [ " DTD_IDENTIFIER " ]), '<td><a href="' . h ( ME ) . ( $J [ " ROUTINE_TYPE " ] != " PROCEDURE " ? 'function=' : 'procedure=' ) . urlencode ( $J [ " ROUTINE_NAME " ]) . '">' . lang ( 113 ) . " </a> " ;} echo " </table> \n " ;} echo '<p>' . ( support ( " procedure " ) ? '<a href="' . h ( ME ) . 'procedure=">' . lang ( 200 ) . '</a> ' : '' ) . '<a href="' . h ( ME ) . 'function=">' . lang ( 199 ) . " </a> \n " ;} if ( support ( " sequence " )){ echo " <h3 id='sequences'> " . lang ( 262 ) . " </h3> \n " ; $Df = get_vals ( " SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() " ); if ( $Df ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 162 ) . " </thead> \n " ; odd ( '' ); foreach ( $Df
as $X ) echo " <tr " . odd () . " ><th><a href=' " . h ( ME ) . " sequence= " . urlencode ( $X ) . " '> " . h ( $X ) . " </a> \n " ; echo " </table> \n " ;} echo " <p><a href=' " . h ( ME ) . " sequence='> " . lang ( 206 ) . " </a> \n " ;} if ( support ( " type " )){ echo " <h3 id='user-types'> " . lang ( 13 ) . " </h3> \n " ; $Pg = types (); if ( $Pg ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 162 ) . " </thead> \n " ; odd ( '' ); foreach ( $Pg
as $X ) echo " <tr " . odd () . " ><th><a href=' " . h ( ME ) . " type= " . urlencode ( $X ) . " '> " . h ( $X ) . " </a> \n " ; echo " </table> \n " ;} echo " <p><a href=' " . h ( ME ) . " type='> " . lang ( 210 ) . " </a> \n " ;} if ( support ( " event " )){ echo " <h3 id='events'> " . lang ( 122 ) . " </h3> \n " ; $K = get_rows ( " SHOW EVENTS " ); if ( $K ){ echo " <table cellspacing='0'> \n " , " <thead><tr><th> " . lang ( 162 ) . " <td> " . lang ( 263 ) . " <td> " . lang ( 190 ) . " <td> " . lang ( 191 ) . " <td></thead> \n " ; foreach ( $K
as $J ){ echo " <tr> " , " <th> " . h ( $J [ " Name " ]), " <td> " . ( $J [ " Execute at " ] ? lang ( 264 ) . " <td> " . $J [ " Execute at " ] : lang ( 192 ) . " " . $J [ " Interval value " ] . " " . $J [ " Interval field " ] . " <td> $J[Starts] " ), " <td> $J[Ends] " , '<td><a href="' . h ( ME ) . 'event=' . urlencode ( $J [ " Name " ]) . '">' . lang ( 113 ) . '</a>' ;} echo " </table> \n " ; $Zb = $i -> result ( " SELECT @@event_scheduler " ); if ( $Zb && $Zb != " ON " ) echo " <p class='error'><code class='jush-sqlset'>event_scheduler</code>: " . h ( $Zb ) . " \n " ;} echo '<p><a href="' . h ( ME ) . 'event=">' . lang ( 189 ) . " </a> \n " ;} if ( $dg ) echo " <script type='text/javascript'>ajaxSetHtml(' " . js_escape ( ME ) . " script=db');</script> \n " ;}}} page_footer ();