mirror of
https://github.com/YunoHost-Apps/adminer_ynh.git
synced 2024-09-03 18:06:06 +02:00
1680 lines
379 KiB
PHP
1680 lines
379 KiB
PHP
|
<?php
|
|||
|
/** Adminer - Compact database management
|
|||
|
* @link http://www.adminer.org/
|
|||
|
* @author Jakub Vrana, http://www.vrana.cz/
|
|||
|
* @copyright 2007 Jakub Vrana
|
|||
|
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
|||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
|||
|
* @version 4.1.0
|
|||
|
*/error_reporting(6135);$Gc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Gc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Ch=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Ch)$$X=$Ch;}}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>XPaJ<>0<18><><EFBFBD>8<>#R<>T<EFBFBD><54>z`<60>#.<2E><>c<EFBFBD>X<EFBFBD><58>Ȁ?<3F>-\0<05>Im?<3F>.<16>M<EFBFBD><16>\0ȯ(̉<><1E>/(%<25>\0");}elseif($_GET["file"]=="default.css"){header("Content-Type: text/css; charset=utf-8");echo
|
|||
|
lzw_decompress("\n1̇<>ٌ<EFBFBD>l7<6C><37>B1<42>4vb0<62><30>fs<66><73><EFBFBD>n2B<32>ѱ٘<D1B1>n:<0E>#(<28>b.\rDc)<29><>a7E<><13><><EFBFBD>l<0C>ñ<EFBFBD><C3B1>i1̎s<03><><EFBFBD>-4<><34>f<EFBFBD> <09><>i7<0E><03><><EFBFBD><07><><EFBFBD>Fé<46>vt2<74><0E><>!<21>r0<72><30><EFBFBD><EFBFBD>t~<7E>U<1D>'3M<33><4D>W<EFBFBD>B<EFBFBD>'c<>P<EFBFBD>:6T\rc<EFBFBD>A<EFBFBD>zr_<>WK<57>\r-<2D>VNFS%~<7E>c<EFBFBD><63><EFBFBD>&<26>\\^<5E>r<EFBFBD><72><EFBFBD><EFBFBD>u<>ŎÞ<C58E>ً4'7k<37><6B><EFBFBD><EFBFBD><EFBFBD>Q<EFBFBD><51>h<16>'g\rFB\ryT7SS<53>P<EFBFBD>1=ǤcI<63><49>:<18>d<EFBFBD><64>m><3E>S8L<>J<EFBFBD><4A>t.M<><01><> ϋ`'C<><43><EFBFBD><EFBFBD>889<38><39> <11>Q<7F><51><EFBFBD><EFBFBD>2<EFBFBD>#8А<38><D090><EFBFBD><EFBFBD>6m<><6D><11><>j<1E><>h<EFBFBD><<3C><><EFBFBD><EFBFBD><EFBFBD>9/<2F><><EFBFBD>:<0E>J<EFBFBD>)ʂ<>\0d>!\0Z<18><0F>v<EFBFBD><76>n<EFBFBD><6E><EFBFBD><EFBFBD>o(<28><><EFBFBD><EFBFBD>k<EFBFBD>7<EFBFBD><37>s<EFBFBD><73>><3E><0B><>!<21>R\"*nS<6E>\0@P\"<03><><EFBFBD>(<28>#[<5B><><0F>@g<0C>o<EFBFBD><01><>zn<7A>9k<39>8<18>n<EFBFBD><6E><10>1<EFBFBD>I*<2A><>=<3D>n<EFBFBD><6E><EFBFBD><0E><><EFBFBD>0<EFBFBD>c(<28>;<3B>à<EFBFBD><C3A0>!<21><><EFBFBD>*c<><63>>Ύ<>E7D<37>LJ<4C><4A>1<EFBFBD>J=<11><><EFBFBD>1L<31><4C>?<0F>s=#`<60>3\$4<EFBFBD><EFBFBD><EFBFBD><EFBFBD>uȱ<><C8B1>zG<0F>C YAt<>?;<3B>Q<EFBFBD>k&<26><><EFBFBD>YP<59>u<EFBFBD><75>ǯ}UaHV%G;<3B>s<EFBFBD><73><A\0\\<19><>P<EFBFBD>\\<EFBFBD><12>&ª<>V<16><>\n<EFBFBD>SU<13>t<EFBFBD><15><>r<EFBFBD><72><EFBFBD><EFBFBD>2<EFBFBD> l^<5E>Z6<5A>ej<65><6A><EFBFBD><EFBFBD>A<0C>d<EFBFBD>[<5B>sն<73>JP<4A><50><11><><EFBFBD>ҝ<EFBFBD><D29D>8<EFBFBD>=<3D><><EFBFBD><EFBFBD>6#˂74*<2A><0E><>#e<><65><EFBFBD>!<21>7{<EFBFBD>6<EFBFBD><EFBFBD><o<03>C<EFBFBD>9v[<5B>M<EFBFBD><4D>-`<60><>k<EFBFBD>><3E>l<>ڴ<><DAB4>I<EFBFBD><49>H<EFBFBD>3<EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>w0t6<74><36>%MR%<25><>jh<>B<EFBFBD><<05>\0<EFBFBD>AQ<P<:<3A><>u/<2F>;\\><3E><>-<2D><>ʈ<EFBFBD><CA88>QH\nv<>L+v<>æ<EFBFBD><<3C>\r<EFBFBD><EFBFBD>v<EFBFBD><EFBFBD><EFBFBD><15>\\*<2A><><EFBFBD><EFBFBD>Ӵݢg<DDA2><67>n˩<6E><0C>TЩ2P<32>\r<EFBFBD><EFBFBD>ߋ\"+z<>8<0E><><EFBFBD>:#<23><><1E><><08>2<EFBFBD><32>J[<5B>i<EFBFBD><69><EFBFBD><EFBFBD>;z<><7A><EFBFBD><EFBFBD><EFBFBD>r<EFBFBD>3#<23>ى<EFBFBD>:<3A>n<EFBFBD>\r㽃e<EFBFBD>pdݍ<> <20>2c<32><63>4<EFBFBD>k<EFBFBD><6B><EFBFBD>\rG<><47>E6_<36><5F><05><>މb<DE89><62>/<2F><>HB%<25>0<EFBFBD><30>><3E><><EFBFBD>hoW<6F>nxl֍<>浃CQ^<5E><><16><><EFBFBD><EFBFBD><EFBFBD>\r<EFBFBD><11><><EFBFBD>4lK{<EFBFBD>Z<EFBFBD><EFBFBD>:<3A><><EFBFBD>Ã<>.<2E>p<EFBFBD><70>Ă<EFBFBD>J<EFBFBD>B-<2D>+B<><42><11>(<06>T<EFBFBD><54>%<25><>J<EFBFBD>0<05>l<02>T<EFBFBD>`+<2B>-<01><>@B<><1D>ۄV<DB84><56><1C>\0<EFBFBD><EFBFBD>C<EFBFBD>,<18><>0t<30><74><EFBFBD>F<EFBFBD><46><EFBFBD>?Ġ<>\na@Ɍ><3E><>ZEC<45><43>O<>-<2D><19><>^Q<>&<26><08><>)I)<29><><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>]\r<EFBFBD><EFBFBD>9<EFBFBD>7_<18><>\r<EFBFBD>F80<EFBFBD>Ob<> <09><><EFBFBD>><3E><><EFBFBD>\nR<>_<EFBFBD><5F>8<><38><EFBFBD>٫<EFBFBD>ov0<76>bCA<43>F!<21>t<EFBFBD><74>ă%0<>/<2F>zAYO(4<><34><EFBFBD><EFBFBD><EFBFBD><14> '<27>] I<><49>8hH<08>05<30>3<05>@x&n<><6E>|T<><1C><06>)`<60>.<2E>s6eY<>D<EFBFBD>z<EFBFBD><7A><EFBFBD><12><>Jѓ<4A><D193>.<2E><>{GEb<0E><>Ӌ<EFBFBD><D38B><EFBFBD><EFBFBD>2<EFBFBD><05>{\$**<2A><01>@<40>C<11><>-:zYHZI<5A><49>5F]<5D><>Y<EFBFBD><59>C<>O<EFBFBD>A<><12><0E><>`x'<27>.*9t'{<EFBFBD>(<28><>wP<77><50><EFBFBD><EFBFBD>=<0F>*<0E><><EFBFBD>*<2A>xwr<77><19>*c<><63><EFBFBD>c|<7C>D<EFBFBD><44><EFBFBD>V<EFBFBD><56>\r<EFBFBD>V.<2E>0<EFBFBD><30><0C>V<EFBFBD>d<EFBFBD>?Ҁ<><D280>,E͝`T<><54>6ۈ-<2D><><EFBFBD><EFBFBD><EFBFBD>ڎT[ѐ<>z<><15>.Ar<41><72>̀P<><50>n<EFBFBD>c=a<>9F<>n<EFBFBD>!<21>u<EFBFBD><75>A<><41><0E>0iP<><50><EFBFBD><EFBFBD><EFBFBD>J6e<0B>T]V<>[\rX<EFBFBD><EFBFBD>a<EFBFBD><EFBFBD>v<0B>k<6B>\n+E<><45><0F>ܕ*\0<EFBFBD>~<7E><16><>@g\"<EFBFBD>NCI\$<EFBFBD><EFBFBD>Ɍ<EFBFBD><EFBFBD><EFBFBD>x@W<>y<EFBFBD>*vuD<75>\0<EFBFBD>v<EFBFBD>댆V\0<EFBFBD>V`G<1E><>u<EFBFBD>E<EFBFBD>֕<EFBFBD><D695>f<EFBFBD>l<EFBFBD>h<EFBFBD>@<40>)0@<40>T<EFBFBD><54>7<EFBFBD><37><1B>§RA<52>ٷ<EFBFBD><D9B7>3ۘ<33><11>/Q<>]<5D>,s<>{VR<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F<18><><EFBFBD>A<><41><<3C>vץ<76><D7A5>%@9<><39>F<EFBFBD><46>5t<35>%<25>+<2B>/<0E>8;<3B>W<EFBFBD><57><EFBFBD><EFBFBD>J<1B><>o:<3A>N<EFBFBD>`<08> <09><><EFBFBD><EFBFBD>h<EFBFBD><68>{ܣ<><DCA3> <20>Ԑ8<D490>Eu<19>&<26>W|Ɇ<><C986><EFBFBD>U<EFBFBD>&\r\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>|-udž<75>N<EFBFBD><03>:nc<6E><63>fV<14><><EFBFBD><C28D>#U20<>>\"<EFBFBD><04><>><3E>`<60>k]<5D>-<2D><>x<EFBFBD>S<EFBFBD>͇Т<16><><EFBFBD><EFBFBD>c<EFBFBD><63><15>B<><42>}<12>&`<60><>r+E<><45>\$<EFBFBD>yN<EFBFBD><EFBFBD><EFBFBD>b,<2C><><EFBFBD>Wx <20><03>-9<><39>r<EFBFBD>,<2C><>`<60>+<2B><><EFBFBD>ˊ<><CB8A>C<EFBFBD><43>)<29><>7<02>x\r<EFBFBD><EFBFBD>W<EFBFBD>fM<EFBFBD>SR<EFBFBD>\\<EFBFBD>z<05><>Q<>̓<EFBFBD><CC93>uA<><41><EFBFBD>2<EFBFBD><32><EFBFBD>4<EFBFBD>L&<26>Hi µ<><C2B5><EFBFBD>S\$)e<><65><EFBFBD>g rȌ<72><12>\$]Z<>iYs<59><73><17>kW<6B>n><3E>7E1k8<>d<EFBFBD>r<EFBFBD><72><EFBFBD>k<1B><><EFBFBD><08>E<EFBFBD><45><EFBFBD>w<1C>wcm<>Ty<54><79><EFBFBD><EFBFBD><EFBFBD>a<EFBFBD>\$tx\rB<05><>=<3D><><EFBFBD><EFBFBD>*<05><<07><1C><>l<01>f<>K<EFBFBD><4B>N/<2F><><03> <09>l<><6C><EFBFBD>kH<6B><10>8<EFBFBD>.<2E><><EFBFBD>?f<><1E><><16><>6<EFBFBD>ч<EFBFBD>{gi/\"<EFBFBD>@<40><11>K<><4B>@2<><32>a|#,Z<><5A><EFBFBD> <09><>w<EFBFBD>d<EFBFBD><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6w<36>^&<><7F>t<EFBFBD><74><EFBFBD>P<11><><EFBFBD><EFBFBD><EFBFBD>]<5D><0E><>.<2E><><EFBFBD><0E><>T<11><>kro<72><6F><EFBFBD><EFBFBD>\ro=<3D>%<25><>h`:\0᱂<EFBFBD><EFBFBD><0B><>|ꊣ<>a<0C>Ԯ6*:<04><>*<2A><>rO-^<5E><><EFBFBD><EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD>M<EFBFBD>}<7D><><EFBFBD><EFBFBD>Aya<79><61><EFBFBD>\n<EFBFBD>u^<5E><><EFBFBD>rnO\r<EFBFBD><EFBFBD><EFBFBD>`<60>T~</<2F><>w<EFBFBD>y<EFBFBD>}<7D>:<07>|<7C><><07><><EFBFBD>̡6<CCA1><36><EFBFBD><12><><EFBFBD>v<EFBFBD>\rc<<3C>b#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\$<EFBFBD>s<EFBFBD><EFBFBD>|燇V)<29>h<EFBFBD>TC<><43>(Ľ<><16><>]6<><36>1<15>!1M<31><4D>@a<>/<2F>`<60>>ٸ<>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD><EFBFBD>C/<2F>6ഷ#p@p<0B><><EFBFBD><EFBFBD>`Z<><0F><>ch<63><68>\0<0B><>\0o<EFBFBD><EFBFBD><EFBFBD>4O<34>O<>i\0-\n<EFBFBD><0F><>/<2F>\0<EFBFBD>D<0E>.<2E> <20><><EFBFBD>.<2E>Đ\0fi<08><>ȫ<EFBFBD><C8AB><EFBFBD>\0<EFBFBD><EFBFBD>ID<EFBFBD><0F>\0<EFBFBD><EFBFBD>\r<EFBFBD><EFBFBD>0f<0E><>o<><02><><03><>G<EFBFBD><47><EFBFBD><EFBFBD>eJ|\r<EFBFBD><EFBFBD><0F>l <08>3<08>~<0B>iP<><07>&<26><><02>/<2F>\0<EFBFBD>9 ^\0r<EFBFBD>0]<02><> <20>o<><0C>.<2E>\"<EFBFBD> <09><><EFBFBD>M<04><><0B>v<EFBFBD>P<EFBFBD>Z<EFBFBD><5A>mp<>P<0E><><03>ڜ<EFBFBD>ޏ<08><0F><>{<EFBFBD><EFBFBD>C?<02><>k<EFBFBD><6B>ϼ}<7D><><EFBFBD>d<EFBFBD><0C>ʏ<EFBFBD>~=<3D>.<2E><10>- <20> <09>m1>h<><0E><>Е1;QI<13>OP<>\r<EFBFBD><EFBFBD>c<07>pApV<08>k\rQ*<0B>Q}<15><><10>q><3E><>u<10>15<11>BqQ[1f<31><66>l<EFBFBD><6C><05>ap<><12><>\0<EFBFBD><08>*<2A>J<EFBFBD>Q=<1B><><08><><19>G<11><0B><0E><><02><10><><18>_<13><><19>b<EFBFBD>GHF.<2E>0<EFBFBD><30> = 2P<14><><EFBFBD><01><><0B><14><>P!<21>#(3 \n<EFBFBD>!1&72f<32><66>`<60>/<2F><>\0<EFBFBD><EFBFBD>\"P<EFBFBD>U<0F>\$<EFBFBD>\r0<><0B><>,QrU&2f<32><66>_<1F>X<0B><><0C>]<0E>9\"<EFBFBD>S'<27><>'<27>y<05>8\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>kW)O<>)<29><>*Ra%<25>\\i<>%<25><>&ҳ+r<><0E>3<1A>S`<60>,<2C>v<EFBFBD><76>&2<>L<>&Pu*<2A><>-<2D><>0\"<EFBFBD>%HĬԞ<><D49E>@ؓ<><D893>H<EFBFBD>B<EFBFBD>P(<28><11>\$p&<26>,1M<> <20>ح<EFBFBD><08>;\rn<EFBFBD>.<2E><> I<>.<10>',1<02><>)<29>4<EFBFBD><34><EFBFBD>2<EFBFBD>u+<2B>3<08><> `<60>S<0C><>pL\nt<EFBFBD><EFBFBD>_*<2A>S3;6r<36>'h35<33>55䜋d2q+6<><36>8<EFBFBD>O7sC\"pm8ҭ<0E><>6<EFBFBD><36>9<EFBFBD>m\n@e0<65><8B<38>8<EFBFBD><,(<28><><EFBFBD>8<03><>\0<EFBFBD> <09>0<EFBFBD>J<EFBFBD><@<40><>I<EFBFBD><49><EFBFBD>R6pԭmG<>\"11<EFBFBD>6<EFBFBD><EFBFBD>.\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>5̂<EFBFBD><04>:<3A><>8b<38>A1<41>;<3B>';<3B>?<*\$<13>,<2C>̍o= <20>T<EFBFBD><54>/3<>#<23><>҆<EFBFBD>");}elseif($_GET["file"]=="functions.js"){header("Content-Type: text/javascript; charset=utf-8");echo
|
|||
|
lzw_decompress("f:<3A><>gCI<43><49>\n0<EFBFBD><0E>S<EFBFBD><0C>a9<61><39>S`<60><><0F><><EFBFBD>&<26>(<28><>n0<6E><30><EFBFBD>QI<51><49>f<EFBFBD><66>\$<EFBFBD>At^ s<>G<07><>tf6e<1C><>y<><79>()L<>S<EFBFBD><53>P'<17><><EFBFBD><EFBFBD><EFBFBD>R'<15>fq]\"<EFBFBD>s> )<29><>`<60>H2<13>Eq9<04><>?<13>*)<29><>t'<27><>ϧ<EFBFBD>\n \r<EFBFBD>s<<3C>Pi2IN<49><13>*(=2<1B>gX<67><58><EFBFBD>.3<EFBFBD>N<EFBFBD>Y4<>B<<3C>L<EFBFBD><4C><08>i<18>̥2<CCA5><05>z=<13>0H<><48><EFBFBD>'<27>ꌚ<EFBFBD>u<EFBFBD>tt:<3A><><EFBFBD><03><><EFBFBD>e<EFBFBD>]`pX9<58><39>o5<6F>g<EFBFBD><67>I<EFBFBD><49>,2O4<4F><34>х<>M<EFBFBD>S<EFBFBD>(<28>a<EFBFBD><61>#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>|<7C>G<>b<7F><62><EFBFBD>x<EFBFBD>^Z[<5B><><EFBFBD>G<EFBFBD><47>uTv<0C>(ҝm@V<><56>(<0B><><0E>bN<<3C><>`<60><>X<><58>1<EFBFBD>+<2B><>9J8<4A>2\r<EFBFBD>K<EFBFBD>9<0B>h<EFBFBD> <09><><EFBFBD>`<13><><EFBFBD><EFBFBD><EFBFBD>I8䛱S<18><><EFBFBD>t<>2<EFBFBD>+,<2C><>I<EFBFBD><49> <20><>p<EFBFBD>9a<><61><EFBFBD>< \\8Cz<43><7A>\r<EFBFBD><EFBFBD>^<17><><EFBFBD>]<0F>1\\7<EFBFBD>C8_Ep^<1F><><EFBFBD><EFBFBD>M1<4D>w\"'4f<34>SX9ES|䛅<>k3<>B@<40><><EFBFBD>Xa=No4t7<74><37>dD3<44>p<><13><13><>:)\\;<3B><03><><EFBFBD><06>\r)8H<38><48>44Pc=\n<EFBFBD>!pd<1A><>QN\r<EFBFBD>H<EFBFBD>'<27><><EFBFBD><EFBFBD>2<EFBFBD>#\"եm-<2D>b,<1A> <09>M.<2E><><EFBFBD>-IK<49>)<29><>e'<27><>\"<EFBFBD><0C><>>2X<32>œe<C593>j:9^<5E>1c<31><63><EFBFBD>ȝ<EFBFBD>:Y<>@<40>u<EFBFBD>㓛4<>X<EFBFBD>&<26><>|<7C>)ђ<><D192>-K<>x<><78><0B><>S<><53>1<EFBFBD><31>\$<EFBFBD><07>@\\<15>!x]\0<EFBFBD><EFBFBD><1D><05><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F<15>CO<43>:<13>1K<><4B>*<2A>F4a<><61><16>k<EFBFBD><6B><0C>KϚ<4B><CF9A><EFBFBD><1C>2l<32>p<EFBFBD>3J<<3C><>,2<><32>8#<23> <20><>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <14><>h<18><><EFBFBD><EFBFBD>F<EFBFBD><46>݉2P<10><><1C><>l(<28>\$ְ\nJ۷-<2D><>ǰcc~<7E>F<1B><><1E>r<EFBFBD><72>tb<><62><EFBFBD>m{h<EFBFBD>.<2E>{<EFBFBD>tk<>B<07>Kc<4B>z4<7A>C<EFBFBD>9<>۫~><0F><><EFBFBD><14><>`Ɠ<>C <>s:<3A><><EFBFBD>!c<><63><04>ڵ<EFBFBD>*W<>HX:W<><10>;N<><14><>j*<2A>/(<28>_p3<70><33>HI<04>Kl<4B>n!tr<><72>G㭺<47>tC<> v<>?m㤣<6D><E3A4A3><EFBFBD><EFBFBD><EFBFBD>\0C<EFBFBD><EFBFBD><EFBFBD><EFBFBD>oܥcbf6I<EFBFBD><EFBFBD>'\r<EFBFBD>b<EFBFBD><EFBFBD>7h<EFBFBD>`<60><>9<EFBFBD>i<EFBFBD>d5<64><35>taM<61>={ɩ<EFBFBD><EFBFBD>`NoK<6F> !d4<64><02>zWXdmH<6D><48>*<2A><><1A>S ]<5D><>3&\0ڰ d%A<>-<2D><> <09><>(<28><><EFBFBD><16><><EFBFBD><12>Q<>}<7D><><EFBFBD>U!t7<0B>䋆<EFBFBD>>x<><78>t{mY<EFBFBD><EFBFBD>0<EFBFBD>@^<5E><>\"<EFBFBD>=<0C><><EFBFBD>@t\r<EFBFBD><EFBFBD><EFBFBD><02>+Y<>.<06><><EFBFBD>X<EFBFBD>\n<EFBFBD>I'KT<4B><02>^(<07>D.@<40><0C><>++@<40>3<EFBFBD><33><EFBFBD>X<EFBFBD> aE<61>!,<2C>Y<EFBFBD><59>2-432Ԍ<0B>MO<4D><4F>I\$q% ċG<C48B>X9<58><39><EFBFBD>[R\0n<EFBFBD><EFBFBD>и P<EFBFBD>Jy\r <20>B<EFBFBD>p\\H<EFBFBD>pgSɼ<15>Faejk<6A>.4<><34>C.^<5E>yi<79><69>9<EFBFBD>PĈe\"ΔNY<EFBFBD><EFBFBD><EFBFBD>BH<EFBFBD>#8<>B1\"<EFBFBD>j\\کx<EFBFBD><EFBFBD>#<23><>@G 9<>2<EFBFBD><14>f.Ќpsr<>TJ<54>x<EFBFBD>k<><6B><12>4KIl<49>f<EFBFBD>8z<38><7A>Kȇ>AK<41><4B><EFBFBD>n^<5E><>=&<26><1D>A<EFBFBD><1D>*?'<27><0B>^%;<12><>4܀<34><DC80><EFBFBD>9<10><>Q<EFBFBD><51>h<EFBFBD>N<EFBFBD><4E>>M<>=['<27>vHI<48>J<EFBFBD><4A><1F><><EFBFBD>v<EFBFBD><76><EFBFBD>R<EFBFBD>t<19><><<3C><>Ҳ<EFBFBD>^<5E><>z<EFBFBD>B^<5E>h<EFBFBD>'<07><12>ɩ<EFBFBD>)-'#<23><>9JT<4A>)<29>@jO!<21><1B>c,e<>j<EFBFBD><6A><EFBFBD><EFBFBD>@H,<2C><><EFBFBD>j<EFBFBD>a<EFBFBD><01>v<EFBFBD>Z<>><3E><>ҷ<EFBFBD>)E`\0\n<EFBFBD><EFBFBD>T<EFBFBD>P<EFBFBD>8L<<3C>c<EFBFBD>:F<><46><EFBFBD>\$\n<EFBFBD><EFBFBD>휆<EFBFBD><EFBFBD>CHm\"<EFBFBD>j<EFBFBD>y<>A<EFBFBD>S<EFBFBD><53><12>S<><10>Q<EFBFBD><51><EFBFBD><EFBFBD><EFBFBD><15>{T']W<><57>U<>)_L<5F><4C>i<EFBFBD>m<EFBFBD>O<><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><05>P:g<>{<EFBFBD><01>Zė<5A>.<1B>{<EFBFBD><EFBFBD><EFBFBD>Dh\n<EFBFBD><EFBFBD><EFBFBD><16>a<EFBFBD>\r]9<>t<EFBFBD><74>!XA<58>[Ȱ<><C8B0><EFBFBD>C<EFBFBD><43>ׁ\n:<05><13>ha<07><><EFBFBD><17>\"ݢa2Lm<0C><><EFBFBD>\\ <09><>p5<70>@<40><>@m<><6D>|W<><57><07><>%<25>|u<><75><1D>+hK<14>L&<26><> <20>3<>.XW<0B>ٺ<EFBFBD><D9BA><EFBFBD>*q<0F><>c<><63><EFBFBD>%<25>.K<><4B><EFBFBD><EFBFBD>_<EFBFBD>)<29>u<EFBFBD>2W\$O]<1A>d8<64><38><07>g<>?mFy<46>ly<0C>%Ӊ<01><><EFBFBD><EFBFBD>DQ<><18>.uIJ<75><C4B2><03><1E><><EFBFBD><EFBFBD><EFBFBD>L<EFBFBD><4C>,<2C><0F><><EFBFBD>3<EFBFBD><33>j<EFBFBD>0t a<><<3C>\0Pr<>mNs8ٌk>M9,<2C><13><><EFBFBD><1C>B<EFBFBD><42><EFBFBD>x<EFBFBD>უzo<7A><1C><>uB?`<60><08><0F><>&<26>I<EFBFBD><<3C><><03><>e<EFBFBD>Y<>s<><10>zԇ*<2A>.'t<><74><EFBFBD><EFBFBD>z<EFBFBD>)m*4X=<3D>tI=<17>nѦy<D1A6>ޚ<><DE9A>c2<63><06>`<60><><EFBFBD><EFBFBD>.Y<><59><EFBFBD>:<3A><>K<EFBFBD>N<EFBFBD><4E>r06<30>_rJ<18><>k<EFBFBD>tO<>|^͈<><CD88>z\nϿ鱕<EFBFBD><W<>1n.<2E>X<EFBFBD>`<1F><>g<EFBFBD>VG4Z<34><5A>r<EFBFBD>!<21><><EFBFBD><1E>Y[<0E><><EFBFBD>z:L<02>D<EFBFBD><44>@T <09>0<EFBFBD>`<60><18><>pjSn\"Y<EFBFBD><EFBFBD>g <09>`<60>}Ě<><C49A><14><>\n\n<EFBFBD>4<EFBFBD><EFBFBD>\rg<03><>O7ܿb<DCBF><62><EFBFBD>y<0E><>)<29>E<1D><><EFBFBD>)w><3E>~ur<75><72><EFBFBD>29h<06>t<19>gB#<23><><EFBFBD><EFBFBD><1B>F<EFBFBD>p(<28>@<40>`u0<75>у(flG<6C>a0bZ7J@<40>I_PZ<50><5A>yq^<5E><>7<02><><19><>G<EFBFBD>3d<33><64><EFBFBD><EFBFBD><13>3<EFBFBD>铄0<E99384><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{ָ<12><><EFBFBD><EFBFBD>a6<61>P<14><19>4W <09>d:<02><1B><>W\n<EFBFBD>t4<03><1D><1F>.<2E><>D<EFBFBD>y<EFBFBD>ȧ<EFBFBD>85<38><35>AM<06>L<19>Xw5<01>ese<73><65><EFBFBD>C #<23><><EFBFBD>rrY<72> Ǯ!<21><><EFBFBD><1A><>唟@/\r<EFBFBD> <20>0<EFBFBD>wEl\"<EFBFBD>O<EFBFBD>W<1C><Q<><51>۠<EFBFBD>Ek<45><11>SQi<51>d<EFBFBD><64>\\k٬<><D9AC>8<EFBFBD><38><EFBFBD>H<EFBFBD><48><12><>\"<EFBFBD>bL}<1F>%<25> <09><>-^<5E> _<>h\nF<EFBFBD>-.<0C>2nj<6E><6A><EFBFBD>VM<56>xnj<6E><6A>m\\\$<EFBFBD><18><><EFBFBD>*\n<EFBFBD><EFBFBD><EFBFBD>'<27>~<05><> Z@<40><0B><><EFBFBD><EFBFBD>V<05><><04>L\"<EFBFBD><02><>p<EFBFBD><70>5<EFBFBD><35>O,<2C><><EFBFBD><16>˹\0\n<EFBFBD><EFBFBD>-0<>\r4<EFBFBD>p<0E><>b<EFBFBD>0f<30>p<1C>mg<02>i<08><>O<EFBFBD>.(<28>P9<03>APH+<2B>NHpf<70><66>4?B<>M<EFBFBD><4D><EFBFBD><EFBFBD>JF<4A><46>.<2E><><EFBFBD>\0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD>jƀP<EFBFBD>+(<28>&<26><><EFBFBD>a<><61>%l]'<27><>l^@(<28>5<EFBFBD>N fs<66><73><05><><0F><><07>bz <20><>e><0F>p<EFBFBD><70><EFBFBD>k <20>D<>\r4a<34>N<EFBFBD><4E>Y({<0C>D<EFBFBD><44>nƆ<6E><06><05>>jĨ1<C4A8><31> <09><><<3C>l-<2D>x<EFBFBD><78>\r<EFBFBD>G<06>O Qw<07><12>qw<01>c<08>P<05>b\r<EFBFBD>̶<EFBFBD><EFBFBD><18><> <09><07><17><><0B>d<04><>6<EFBFBD><36><1A><>s<EFBFBD>ࢎ<EFBFBD><12><><13>ж<EFBFBD>r<EFBFBD><72>j><3E><06>J<EFBFBD><4A><EFBFBD><EFBFBD><EFBFBD>Ȯ<05>b<>3<EFBFBD><33>(F<05><0E>zސ<04><>r<EFBFBD>`O<1F><><EFBFBD><EFBFBD>X<07><>\rZ<EFBFBD>q<EFBFBD>\r <20>1\$<EFBFBD><EFBFBD><06>gk<1F>l<EFBFBD><6C>r+<2B><0C><><EFBFBD>kf<6B>'<27>5<14>8<EFBFBD>4<>6<EFBFBD>\0<EFBFBD>-<2D>.i~4<>E<\$<EFBFBD>J<EFBFBD>lru2F;Bn<<3C>%#lq%<08><> b=<3D><>#L<>(HJ1b%\r縼<EFBFBD>z<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>G2<EFBFBD><0E>^8w<10><><EFBFBD><EFBFBD>^%<0E><> <20><><EFBFBD>G<EFBFBD>*g<>7D\0^<18>r<EFBFBD>c<EFBFBD><63>p<0E><>L,<0C><><0E><>*<2A>Xr<58>\$ <20>8<EFBFBD><04>,<2C>*<2A>D<EFBFBD><44><05><><EFBFBD>`<60>\n<EFBFBD><02><>Z<EFBFBD><5A><04>s1l<31>1<EFBFBD>\\{<EFBFBD><EFBFBD>.I~`<60>*3<0C><><10>]1<0F>F͑1X -<2D>%#<23><><EFBFBD>S3L<10>l6\$Cr<EFBFBD>C/<2F><>\r<EFBFBD>%,<2C>|<7C><><EFBFBD> Ȇnj<C886><C78C> <20>su8<75>J<EFBFBD><4A><EFBFBD>䬗9<E4AC97><39><EFBFBD>h<EFBFBD><68><EFBFBD>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<2E><><EFBFBD>P<EFBFBD>Ft<><74>\$<EFBFBD>3\n<EFBFBD>FB/<2F>=4<0E>-<2D><><EFBFBD><0C>͏9<># O:I<><04>]#<07>7B<37><42>,:<3A><><<3C>N<0B>D<EFBFBD>@<40>R<EFBFBD><52>\n<EFBFBD><EFBFBD>#<23><>z<EFBFBD>%8i:\0<EFBFBD>z<EFBFBD>' Y<11>*<2A>&<26><><EFBFBD>/K<>֦<><D6A6><10>U4<55>z<06>a>4<>\0<07>f*\0<EFBFBD>*TK02<30><<3C>0Sf<><66><EFBFBD>?D<>a4X-<03>u<EFBFBD>j\$E6\0N<EFBFBD>i<16><><EFBFBD><EFBFBD>\n<EFBFBD>c9<>H<EFBFBD><48><EFBFBD><0C>HIb<49><62>F<EFBFBD><46><08><><EFBFBD>s<EFBFBD>R~t<>I<EFBFBD><49><EFBFBD>3<EFBFBD><33><02><>L<>;% 0p.B<0C>FBnMK<08><>R<EFBFBD>sD<73>'<27>a<EFBFBD><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D\r1<12>O<EFBFBD>\0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD>gL^̅<><CC85><EFBFBD>O>l<><04>C<D<0E>H<EFBFBD>-4<<3C><><EFBFBD>\"V]`<60>/B<><42>U&<26>ӹ-#w;<3B>^<5E>M<EFBFBD><4D>r<EFBFBD>q<EFBFBD>0<EFBFBD>-<2D>o<EFBFBD>~pK<70><4B><04> p<><0B><>\nq<EFBFBD>,4<>W<06>\$F<EFBFBD>nl\0<EFBFBD>M<EFBFBD>L<03>\n<EFBFBD><EFBFBD>-<2D>m<EFBFBD>\0<EFBFBD>)<29>Z@<40>Z<EFBFBD><5A><EFBFBD><13><0B><>^@<40> <09><>&Սd<D58D><64><EFBFBD>]`<60><><EFBFBD><EFBFBD><EFBFBD>t\r<EFBFBD><EFBFBD>'\$^R<>'<27>O]<5D><>SЬ<53>3<EFBFBD>5ⓘF\"Q[u<>[<5B>H\$<EFBFBD>o`6Zu<5A><75>mo[<5B><>]<5D>X<07>T<EFBFBD> <09>]<5D>Ҟ<EFBFBD><D29E>\\c<EFBFBD>b<EFBFBD>:<3A>b<EFBFBD>U\0<EFBFBD>W2<57>Vb<0F><>e<12>2/<2F>d%<YRt7<74>'f<>0<EFBFBD>u<EFBFBD>ru<72>h<EFBFBD>U@cTs<0F>V<EFBFBD><56>gF<67><0E>{_-_P<5F>E<EFBFBD><45>T:{<EFBFBD><EFBFBD>V<EFBFBD>d<EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D>Ic<49><63><EFBFBD>ȁ<EFBFBD><C881>M<EFBFBD><4D><EFBFBD>iv<07><> J<>\0m3@JX<4A>RMU_<55><1E><><EFBFBD><EFBFBD>p<EFBFBD>5)k<>kl-\$,Ɠ\r&<26>\r<EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>(o<><6F>k+r<> <20>\\<EFBFBD>P7\"*^<5E>P<>\rc<EFBFBD><><3E><>t#~R<>\"<EFBFBD>en<16> <20><02>s<EFBFBD><73><07><>;<3B>D <09>It<49><74>up t@<05><>8d\0<EFBFBD>@<40>lTw<54>r <20>ww<77>~ b<> <09><>J <20><>u<>\n<EFBFBD><EFBFBD>, u;jַ7s<37><73>{*<2A>o<EFBFBD>>q<><-\0<EFBFBD> <09><>\n<EFBFBD><EFBFBD><08><>|¹rc<><63>v7<76>i7O{EC<>(<28><>1<EFBFBD>p<05>y<>҇n<D287><05><><05><><0E>Z<EFBFBD><5A>[r>8<>X<0C><><EFBFBD><EFBFBD><EFBFBD>{<EFBFBD><EFBFBD>~j<>~<7E><>(<28><><05>(Y`<60><05>7_»z%vd<>'<13>%.<2E>\$w/.=<3D>p<>&<26><><EFBFBD><EFBFBD>8V5R=<3D>N<06>4
|
|||
|
lzw_decompress("v0<EFBFBD><EFBFBD>F<EFBFBD><EFBFBD><EFBFBD><EFBFBD>==<3D><>FS <09><>_6MƳ<4D><C6B3><EFBFBD>r:<3A>E<EFBFBD>CI<43><49>o:<3A>C<11><>Xc<58><63>\r<EFBFBD>J(:=<3D>E<EFBFBD><13><>a28<03>x<EFBFBD><78>?<0F>'<27>i<EFBFBD>SANN<02><><EFBFBD>xs<78>NB<><42>Vl0<6C><30><EFBFBD>S <09><>Ul<14>(D|҄<><D284>P<EFBFBD><50>><17>E<EFBFBD>㩶yHch<><68>-3Eb<45><62> <20>b<EFBFBD><62>pE<70>p<EFBFBD>9.<2E><><EFBFBD><EFBFBD>~\n<EFBFBD>?Kb<4B>iw|<7C>`<60><>d.<2E>x8EN<45><4E>!<21><>2<><05>3<EFBFBD><33><EFBFBD>\r<EFBFBD><1C><>Y<EFBFBD><59><EFBFBD>y6GFmY<6D>8o7\n\r<10>0<EFBFBD><30>\0<EFBFBD>Dbc<EFBFBD>!<21>Q7Шd8<64><38><EFBFBD>~<7E><>N)<1D>Eг`<60>Ns<4E><73>`<60>S)<29>O<EFBFBD><4F><0B><>/<2F><<0E>x<EFBFBD>9<EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3n<><6E>2<EFBFBD>!r<>:;<3B>+<2B>9<EFBFBD>CȨ<43><C8A8><EFBFBD>\n<<3C><>`<60><><EFBFBD>b<EFBFBD>\\<EFBFBD>?<3F>`<60>4\r#`<60><<3C>Be<0C>B#<1A>N <20><>\r.D`<60><>j<EFBFBD>4<EFBFBD><34><EFBFBD>p<EFBFBD>ar<61><72>㢺<>><3E>8<EFBFBD>\$<EFBFBD>c<EFBFBD><EFBFBD>1<EFBFBD>c<EFBFBD><EFBFBD><1D>c<EFBFBD><63><EFBFBD><04>{n7<12><><07><08>A<>N<15>RLi\r1<EFBFBD><EFBFBD><EFBFBD>!<21>(<28>j´<6A>+<2B><>62<36>X<>8+<18><05><><EFBFBD>.\r<EFBFBD><18><04><><EFBFBD>!x<><78><0E>h<EFBFBD>'<0C><><EFBFBD>6S<36>\0R<05><><EFBFBD><EFBFBD>O<EFBFBD>\n<EFBFBD><14>1(W0<57><30><EFBFBD><EFBFBD>7q<><71>:N<>E:68n+<2B><>մ5_(<28>s<EFBFBD>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/m<>6P<36>@<40>EQ<45><51><EFBFBD>9\n<EFBFBD>V-<2D><><EFBFBD>\"<EFBFBD>.:<3A>J<EFBFBD><4A>8we<77>q<EFBFBD>|؇<>X<EFBFBD>]<5D><>Y X<>e<EFBFBD>zW<7A><57> <20>7<EFBFBD><37>Z1<5A><31>hQf<51><66>u<EFBFBD>j<EFBFBD>4Z{p\\AU<EFBFBD>J<<3C><>k<><6B>@<40>ɍ<EFBFBD><C98D>@<14>}&<13><><EFBFBD>L7U<>wuYh<59><68>2<EFBFBD><32>@<40>u<EFBFBD> P<>7<EFBFBD>A<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>3Û<><1E>XEͅZ<CD85>]<5D>l<05>@Mplv<>)<01> <20><07>HW<48><05><>y><03>Y<59>-<2D>Y<EFBFBD><59>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><0F>hC<68>[*<2A><>F<EFBFBD><46>#~<1F>!<21>`<60>\r#0P<10>C˝<43>f<03><><EFBFBD><0B><><EFBFBD>\\<EFBFBD><EFBFBD><0E>^<5E>%B<<3C>\\<EFBFBD>f<>ޱ<><DEB1><EFBFBD><EFBFBD><EFBFBD>&/<2F>O<EFBFBD><4F>L\\jF<EFBFBD><EFBFBD>jZ<EFBFBD>1<EFBFBD>\\:ƴ><04>N<EFBFBD><4E>XaF<61>A<EFBFBD><1B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>f<EFBFBD>h{\"s\n<EFBFBD>64<EFBFBD><EFBFBD><EFBFBD><EFBFBD><16><>?<05>8<EFBFBD>^p<15>\"띰<EFBFBD>ȸ\\<EFBFBD>e(<28>P<05>N<EFBFBD><4E>q[g<><67>r<EFBFBD>&<26>}Ph<50><68><EFBFBD><EFBFBD>W<EFBFBD><57>*<2A><>r_s<5F>P<EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD>om<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>#<23><0F><>.<2E>\0@<40>pdW <20>\$Һ<EFBFBD>Q۽Tl0<6C> <20><1D>HdH<64>)<29><>ۏ<><0C>)P<03><><EFBFBD>H<EFBFBD>g<04><>U<><55><EFBFBD><EFBFBD>B<>e\r<EFBFBD>t:<3A><>\0)\"<EFBFBD>t<EFBFBD>,<2C><><18><><EFBFBD>[<5B>(D<>O\nR8!<21>Ƭ֚<C6AC><D69A>lA<6C>V<EFBFBD><10>4<03>h<EFBFBD><1E>Sq<<15><>@}<7D><><EFBFBD>gK<67>]<5D><><EFBFBD>]<5D>=90<39><30>'<27><><1D><>wA<<3C><><EFBFBD><1D>a<EFBFBD>~<7E><>W<><57><EFBFBD>D|A<><41><EFBFBD>2<0E>X<EFBFBD>U2<55><32>yŊ<><C58A>=<05>p)<29>\0P <0C>s<0F><>n<EFBFBD>3<06><>r<EFBFBD>f\0<EFBFBD>F<EFBFBD><EFBFBD><EFBFBD>v<EFBFBD><EFBFBD>G<0C><01>I@<40>%<25><><EFBFBD>+<2B><>_I`<60><0C><><EFBFBD>\r.<2E><>N<EFBFBD><0F><>KI<4B>[<15>ʖSJ<53><05><>aUf<55>Sz<53><7A><EFBFBD>M<1F><><EFBFBD>%<25><>\"Q|9<04><>Bc<42>a<EFBFBD>q\0<EFBFBD>8<EFBFBD>#<23><a<><61>:z1Uf<15><>><3E>Z<10>l<EFBFBD><6C><01><><EFBFBD><EFBFBD>e5#U@iUG<47><C282>n<EFBFBD>%Ұs<><73><10>;gxL<07>pP<>?B<><42><EFBFBD>Q<EFBFBD>\\<15>b<1F><>龒Q<E9BE92>=7<>:<3A><0F>ݡQ<DDA1>\r:<3A>t<EFBFBD><74>:y(<28> <20>\n<EFBFBD>d)<29><07><>\n<EFBFBD>X;<3B><><EFBFBD><EFBFBD><11>CaA<61>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>P<EFBFBD>GH<EFBFBD>!<21><><EFBFBD>@<40>9\n\nAl~H<><48><EFBFBD>V\ns<><73>ի<EFBFBD>Ư<EFBFBD>bBr<42><72><EFBFBD><05><><06><><1A><>3<EFBFBD>\r<EFBFBD>P<EFBFBD>%<0B>ф\r}b/<2F>Α\$<EFBFBD>5<>P<EFBFBD>C<EFBFBD>\"w<13>B_<42><5F><EFBFBD>U<>gAt<41><74><EFBFBD><EFBFBD>夅<EFBFBD>^Q<><51>U<EFBFBD><01><>j<EFBFBD><6A><EFBFBD><EFBFBD>Bvh졄4<ECA184>)<29><>+<2B>)<<3C>j^<5E><L<><4C>4U*<2A><><EFBFBD>Bg<42><67><EFBFBD><EFBFBD><1C>*n<>ʖ<>-<2D><><EFBFBD><EFBFBD> 9O\$<EFBFBD><EFBFBD>طzyM<EFBFBD>3<0E>\\9<EFBFBD><EFBFBD><1E>.o<><6F><EFBFBD><EFBFBD><10><>E(i<><07><><0B><><EFBFBD>7 tߚ<74><DF9A>-&<26>\nj!\r<EFBFBD><EFBFBD>y<>y<EFBFBD>D1g<31><67><EFBFBD>]<5D><>yR<79>7\"<EFBFBD><EFBFBD><1D><13><><EFBFBD>~<10><><EFBFBD><EFBFBD>)TZ0E9M<39>YZtXe!<21>f<EFBFBD>@<40>{Ȭyl 8<>;<3B><><EFBFBD>R{<EFBFBD><EFBFBD>8<EFBFBD>Į<>e<EFBFBD>+UL<>'<27>F<>1<EFBFBD><04><>8PE5- <09>_!<21>7<EFBFBD><37><EFBFBD>[2<>J<EFBFBD><01>;<3B>HR<48><52>ǹ<>8p痲݇@<40><>0,ծpsK0\r<01>4<EFBFBD><34>\$sJ<73><0E><>4<EFBFBD>DZ<44><5A>I<0E><>'\$cL<EFBFBD>R<EFBFBD><EFBFBD>MpY&<1E><><EFBFBD><EFBFBD>i<EFBFBD>z3G<06>zҚJ%<25><>P<>-<2D><01>[<5B>/x<><78>T<EFBFBD>{p<EFBFBD><EFBFBD>z<>C<05>v<02><05><>:<3A>V'<27>\\<EFBFBD><EFBFBD>KJa<EFBFBD><EFBFBD>M<EFBFBD>&<26><><EFBFBD>Ӿ\"<EFBFBD><EFBFBD>e<13>o^Q+h^<5E><02>iT<69><54>1<EFBFBD>OR<4F>l<EFBFBD>,5[ݘ\$<EFBFBD><EFBFBD>)<29><>N<EFBFBD>\n<EFBFBD><1A>[<02>b<EFBFBD><62><EFBFBD>|;<3B><><EFBFBD>p<70>74<37>ܔ¢<DC94><C2A2>I<EFBFBD>C<EFBFBD>\\<EFBFBD><1B>X<03><>\n%<25>h<EFBFBD>I<EFBFBD><49>4<>g<EFBFBD>P:<<3C><><EFBFBD>k<EFBFBD>1Q<31>+\\<EFBFBD><EFBFBD>^咠<>V<EFBFBD><56>C<EFBFBD><43><18>W<EFBFBD><57>`83B-9F@<40>n<17>T><3E><><EFBFBD>lj-<2D><><EFBFBD><EFBFBD>&<26><>`9q<39><71><EFBFBD><01><1E><1F><>P<EFBFBD>y6<79><36>\r.y<>&<26><02><><EFBFBD>ả<18><>E8<45>0<EFBFBD><30><EFBFBD><1F>kA<6B><41>V<EFBFBD>T7<54>p<EFBFBD><70>x<EFBFBD>)ޡ~<7E>M<EFBFBD><4D><EFBFBD>!<21>Et<13><><EFBFBD>P\\<EFBFBD><EFBFBD>ϗm~c<>B<EFBFBD>\\\n<EFBFBD>m<EFBFBD>v{<EFBFBD><EFBFBD><EFBFBD>9`G[<5B><06>~xsL<73>\\<EFBFBD>I<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Xwy\n<EFBFBD><EFBFBD><02>u<EFBFBD><75><0E><>S<EFBFBD>c<07><><03>1?A<>*<2A><03><>{<0B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD>|9/<2F><><EFBFBD><EFBFBD>E<EFBFBD><45>4<EFBFBD><34>/<2F>W<EFBFBD>[ȳ><3E><>]<0B>r<EFBFBD><1F><><EFBFBD>v<EFBFBD>~B<> PB`T<08>H>0<>B<0F><0F>)<04><>><3E>N!4\"<EFBFBD><EFBFBD><EFBFBD>xW-<2D>X)<29>0<EFBFBD>BhA0<41><30>J2P@><3E>AA)<29>S<EFBFBD><53>n<EFBFBD><6E>n<>O<EFBFBD>Q<EFBFBD><51><EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>r<EFBFBD><72><EFBFBD>Ҧ<EFBFBD><D2A6><0E><><EFBFBD>h<EFBFBD><68>@ȋ<><C88B><EFBFBD>(<28><>\n<EFBFBD><EFBFBD>F<EFBFBD><EFBFBD>ϖ<EFBFBD>ƙ<03>(<28>γ<0E><>P\0<EFBFBD>N<EFBFBD><EFBFBD>o}<01><>l<EFBFBD><<3C>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD><18><>l<EFBFBD>oq\0/Q\0of*ʑN<><0C>P<06>\r/<14>pA<07>Y\0p\\<EFBFBD><EFBFBD>~<7E><>b<EFBFBD>Lh <20>!<06><> <09>P<EFBFBD><50>d<EFBFBD>.<2E><07>y\no\0<EFBFBD><0C><>ж<EFBFBD>Ppt<70>P<EFBFBD>ov<6F>Ђkn<6B><6E>\0z+<2B><>l6<6C><36><EFBFBD><01><><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>P<>oF<04>N<EFBFBD><4E>F<EFBFBD><46>Op<><0C>N`<60><0C><>\rog<10><>0}P<>\n<EFBFBD><EFBFBD>@<40><><EFBFBD>15\r<EFBFBD>9\$M\r<EFBFBD>\\<EFBFBD>\ngg<><0C><><0E><>\$Q \r<EFBFBD><0F>Dd<44><64><EFBFBD>8\$<EFBFBD><EFBFBD>k<EFBFBD>D<EFBFBD>j֢Ԇ<05>&<26><><18><><0B><><EFBFBD>bѬ<>갿<07><> <09>=\n0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Pؠ~ج6e<><65><EFBFBD>2%<25>x\"p<EFBFBD>@X<><58>~<0C><><11>?<3F>цZelf\0<EFBFBD>Z), ,^<5E>`<60>\0<EFBFBD>8&<26><04><0F>٩<><1A>r<1A><> <05><><EFBFBD>kFJ<08><>P>V<><11>ԍp<D48D><70>8%2><3E>Bm<><6D><18>@<40><>G(<07><1A><>s\$<EFBFBD><05>d<EFBFBD>̜v<CC9C>\"<EFBFBD>p<EFBFBD>w<EFBFBD><EFBFBD>6<EFBFBD><EFBFBD>}(V<0B>Kˠ<4B>K<EFBFBD>L ¾<><1E><>W<EFBFBD><57>q<>\r<EFBFBD><EFBFBD><EFBFBD>̤ʀQ<1C>L%<25>P<EFBFBD>dJ<64><4A>H<04>NxK:\n<EFBFBD><EFBFBD> <20>%fn<66><6E><EFBFBD>%Ҍ<>D<EFBFBD>M<0B> <20>[#<23>T\r<EFBFBD><EFBFBD>r<EFBFBD>.<2E>LL<04>&W/>h6@<40>E<EFBFBD><45><0B>LP<4C>v<EFBFBD>C<EFBFBD><43>6O:Yh^mn6<6E>n<EFBFBD>j>7`z`N<04>\\<EFBFBD>j\rg<EFBFBD>\r<EFBFBD>i2I\$\"@<40>[`<05>hM<68>3q3d<33><0B>\0ֵ<EFBFBD><EFBFBD>ys\$`<60>D<EFBFBD><44>\$\0<EFBFBD>QOf1<EFBFBD>&<02>\"~0<><30>`<60><0B>\"@ZG<>) Y:S<><53><EFBFBD>D.S%͈<><CD88><EFBFBD>3<><33> d<><07>m<EFBFBD>U5<55><35><0B><04><<3C>S<EFBFBD>SZ3<>%r<><72><EFBFBD><04><>{<EFBFBD>e3Cu6<EFBFBD>o73<EFBFBD>d<EFBFBD>L\"<EFBFBD>c7<EFBFBD>LN<EFBFBD><EFBFBD>Y<EFBFBD><EFBFBD><EFBFBD>k<EFBFBD>><3E><><EFBFBD><EFBFBD>.<2E>p<EFBFBD><70>2<EFBFBD>Q<1E><><04><><04><><EFBFBD>3<EFBFBD>VذWB<57>DtCq#C@<40>I<EFBFBD>P<>DT_D<5F>:<3A><>Q<<3C>UF<55>=<3D>1<1B>@\$<EFBFBD><EFBFBD>6<><c<>r<EFBFBD>f%<25><0F>,|<7C>27#w7<77>Tq<54><71>6s<36>l-1cP<63>m<EFBFBD>q<EFBFBD><71>\n@<40><0C><>5\0P!`\\\r@<40>\"C<EFBFBD>-\0RR<EFBFBD>tFH8<EFBFBD>|N<><0C>-<2D><>d<EFBFBD>g<><0E><>\r<EFBFBD><EFBFBD>)F<>*h<>`<60><><EFBFBD>CK4<4B>1<EFBFBD>ʍkMKCRf@w4B<04>J<><4A>2\"䌴<EFBFBD>\r1Q4<51>2,\"<EFBFBD><EFBFBD>'<27><EFBFBD>x<0C><>y<05>R<EFBFBD>%RēS<18>5K<><4B>IFz #XP<58>><0F><>f<EFBFBD><18>-WX\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>pU<0E><>D<EFBFBD>t&7@<40><><EFBFBD><EFBFBD>?<3F><><1F><> <08><><EFBFBD>}O1<4F>2<EFBFBD><32>2<EFBFBD>#UK*<2A>)<29>긋<EFBFBD>0o<><3E>]H<><04><>ƿr<C6BF><72>LGN<47><0E><><EFBFBD>W%<25><>M^<5E><>9X:<3A>ɥN<C9A5><4E><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD>E<><16>@xy<78>(H<>ƙMd<4D>5<52B<32> <20><>k!>\r^J`<60>I<EFBFBD>S<EFBFBD>N<EFBFBD><4E>4'ƚ*<05>*`<60>><03><>`|<7C>0,<2C>DJ<44>Fxb<78><0C><>4lTؕ<54>[<5B><>[<5B><>\\<EFBFBD><EFBFBD><05>Ԡ<EFBFBD>\\{<EFBFBD><EFBFBD>6\\ޖ<16> <20><>(#mJԣ,<07>`<60>I<><49>J<15>խ<EFBFBD><D5AD><EFBFBD>l<EFBFBD><0E> <20>j<EFBFBD>j֟?֣kG<6B>k<EFBFBD>T9<54><39>]3ohuJ<75><4A><EFBFBD><0F><>W<EFBFBD>\rk<EFBFBD><EFBFBD>)\0<EFBFBD>3<EFBFBD><0E>@x<><78>,<2C>-<1B> 5B<35><42><EFBFBD><EFBFBD>=<3D><>࣐#<23>gf<67><04>&<26><><03>Z`<60>#<23>o<EFBFBD><0B>Xf<58><66>\r <20>Jh<4A><68><EFBFBD><EFBFBD><EFBFBD>5rqnz<0B><><16>s<>,6<>o<EFBFBD>tD<>y<EFBFBD><79><EFBFBD>b<EFBFBD><62>h<EFBFBD><05>Ctn<74>9n<><6E><EFBFBD>`<11>X<11>&<26>\r'tpL<70>7<12>Η<EFBFBD>&<26><><EFBFBD>l<EFBFBD>Z-<02><08>w<EFBFBD>{r<0F><>@iUzM<7A>{rxא<EFBFBD>m<EFBFBD>SB<EFBFBD>\r@<40> H*BD.7<EFBFBD>(<28><12>3XCV <20><W<>у<EFBFBD>|d<08>q*@<40><>@<40><><EFBFBD>+x<><04>̼`<60><><EFBFBD>^<5E>̘߬__<5F><5F>ND<4E>X\0Q_D]}t<>Y<EFBFBD><59>p<EFBFBD>f<0C>w<EFBFBD><77>\"<EFBFBD>3
|
|||
|
connection(){global$h;return$h;}function
|
|||
|
adminer(){global$b;return$b;}function
|
|||
|
idf_unescape($t){$Nd=substr($t,-1);return
|
|||
|
str_replace($Nd.$Nd,$Nd,substr($t,1,-1));}function
|
|||
|
escape_string($X){return
|
|||
|
substr(q($X),1,-1);}function
|
|||
|
remove_slashes($Ef,$Gc=false){if(get_magic_quotes_gpc()){while(list($x,$X)=each($Ef)){foreach($X
|
|||
|
as$Dd=>$W){unset($Ef[$x][$Dd]);if(is_array($W)){$Ef[$x][stripslashes($Dd)]=$W;$Ef[]=&$Ef[$x][stripslashes($Dd)];}else$Ef[$x][stripslashes($Dd)]=($Gc?$W:stripslashes($W));}}}}function
|
|||
|
bracket_escape($t,$Ma=false){static$ph=array(':'=>':1',']'=>':2','['=>':3');return
|
|||
|
strtr($t,($Ma?array_flip($ph):$ph));}function
|
|||
|
h($P){return
|
|||
|
htmlspecialchars(str_replace("\0","",$P),ENT_QUOTES);}function
|
|||
|
nbsp($P){return(trim($P)!=""?h($P):" ");}function
|
|||
|
nl_br($P){return
|
|||
|
str_replace("\n","<br>",$P);}function
|
|||
|
checkbox($C,$Y,$ab,$Kd="",$Me="",$fb=""){$J="<input type='checkbox' name='$C' value='".h($Y)."'".($ab?" checked":"").($Me?' onclick="'.h($Me).'"':'').">";return($Kd!=""||$fb?"<label".($fb?" class='$fb'":"").">$J".h($Kd)."</label>":$J);}function
|
|||
|
optionlist($Re,$pg=null,$Jh=false){$J="";foreach($Re
|
|||
|
as$Dd=>$W){$Se=array($Dd=>$W);if(is_array($W)){$J.='<optgroup label="'.h($Dd).'">';$Se=$W;}foreach($Se
|
|||
|
as$x=>$X)$J.='<option'.($Jh||is_string($x)?' value="'.h($x).'"':'').(($Jh||is_string($x)?(string)$x:$X)===$pg?' selected':'').'>'.h($X);if(is_array($W))$J.='</optgroup>';}return$J;}function
|
|||
|
html_select($C,$Re,$Y="",$Le=true){if($Le)return"<select name='".h($C)."'".(is_string($Le)?' onchange="'.h($Le).'"':"").">".optionlist($Re,$Y)."</select>";$J="";foreach($Re
|
|||
|
as$x=>$X)$J.="<label><input type='radio' name='".h($C)."' value='".h($x)."'".($x==$Y?" checked":"").">".h($X)."</label>";return$J;}function
|
|||
|
select_input($Ia,$Re,$Y="",$rf=""){return($Re?"<select$Ia><option value=''>$rf".optionlist($Re,$Y,true)."</select>":"<input$Ia size='10' value='".h($Y)."' placeholder='$rf'>");}function
|
|||
|
confirm(){return" onclick=\"return confirm('".lang(0)."');\"";}function
|
|||
|
print_fieldset($s,$Sd,$Uh=false,$Me=""){echo"<fieldset><legend><a href='#fieldset-$s' onclick=\"".h($Me)."return !toggle('fieldset-$s');\">$Sd</a></legend><div id='fieldset-$s'".($Uh?"":" class='hidden'").">\n";}function
|
|||
|
bold($Ua,$fb=""){return($Ua?" class='active $fb'":($fb?" class='$fb'":""));}function
|
|||
|
odd($J=' class="odd"'){static$r=0;if(!$J)$r=-1;return($r++%2?$J:'');}function
|
|||
|
js_escape($P){return
|
|||
|
addcslashes($P,"\r\n'\\/");}function
|
|||
|
json_row($x,$X=null){static$Hc=true;if($Hc)echo"{";if($x!=""){echo($Hc?"":",")."\n\t\"".addcslashes($x,"\r\n\"\\/").'": '.($X!==null?'"'.addcslashes($X,"\r\n\"\\/").'"':'undefined');$Hc=false;}else{echo"\n}\n";$Hc=true;}}function
|
|||
|
ini_bool($qd){$X=ini_get($qd);return(preg_match('~^(on|true|yes)$~i',$X)||(int)$X);}function
|
|||
|
sid(){static$J;if($J===null)$J=(SID&&!($_COOKIE&&ini_bool("session.use_cookies")));return$J;}function
|
|||
|
set_password($Qh,$N,$V,$G){$_SESSION["pwds"][$Qh][$N][$V]=($_COOKIE["adminer_key"]&&is_string($G)?array(encrypt_string($G,$_COOKIE["adminer_key"])):$G);}function
|
|||
|
get_password(){$J=get_session("pwds");if(is_array($J))$J=($_COOKIE["adminer_key"]?decrypt_string($J[0],$_COOKIE["adminer_key"]):false);return$J;}function
|
|||
|
q($P){global$l;return$l->quote($P);}function
|
|||
|
get_vals($H,$e=0){global$h;$J=array();$I=$h->query($H);if(is_object($I)){while($K=$I->fetch_row())$J[]=$K[$e];}return$J;}function
|
|||
|
get_key_vals($H,$i=null,$fh=0){global$h;if(!is_object($i))$i=$h;$J=array();$i->timeout=$fh;$I=$i->query($H);$i->timeout=0;if(is_object($I)){while($K=$I->fetch_row())$J[$K[0]]=$K[1];}return$J;}function
|
|||
|
get_rows($H,$i=null,$m="<p class='error'>"){global$h;$rb=(is_object($i)?$i:$h);$J=array();$I=$rb->query($H);if(is_object($I)){while($K=$I->fetch_assoc())$J[]=$K;}elseif(!$I&&!is_object($i)&&$m&&defined("PAGE_HEADER"))echo$m.error()."\n";return$J;}function
|
|||
|
unique_array($K,$v){foreach($v
|
|||
|
as$u){if(preg_match("~PRIMARY|UNIQUE~",$u["type"])){$J=array();foreach($u["columns"]as$x){if(!isset($K[$x]))continue
|
|||
|
2;$J[$x]=$K[$x];}return$J;}}}function
|
|||
|
where($Z,$o=array()){global$w;$J=array();$Rc='(^[\w\(]+('.str_replace("_",".*",preg_quote(idf_escape("_"))).')?\)+$)';foreach((array)$Z["where"]as$x=>$X){$x=bracket_escape($x,1);$e=(preg_match($Rc,$x)?$x:idf_escape($x));$J[]=$e.(($w=="sql"&&preg_match('~^[0-9]*\\.[0-9]*$~',$X))||$w=="mssql"?" LIKE ".q(addcslashes($X,"%_\\")):" = ".unconvert_field($o[$x],q($X)));if($w=="sql"&&preg_match('~char|text~',$o[$x]["type"])&&preg_match("~[^ -@]~",$X))$J[]="$e = ".q($X)." COLLATE utf8_bin";}foreach((array)$Z["null"]as$x)$J[]=(preg_match($Rc,$x)?$x:idf_escape($x))." IS NULL";return
|
|||
|
implode(" AND ",$J);}function
|
|||
|
where_check($X,$o=array()){parse_str($X,$Za);remove_slashes(array(&$Za));return
|
|||
|
where($Za,$o);}function
|
|||
|
where_link($r,$e,$Y,$Ne="="){return"&where%5B$r%5D%5Bcol%5D=".urlencode($e)."&where%5B$r%5D%5Bop%5D=".urlencode(($Y!==null?$Ne:"IS NULL"))."&where%5B$r%5D%5Bval%5D=".urlencode($Y);}function
|
|||
|
convert_fields($f,$o,$M=array()){$J="";foreach($f
|
|||
|
as$x=>$X){if($M&&!in_array(idf_escape($x),$M))continue;$Fa=convert_field($o[$x]);if($Fa)$J.=", $Fa AS ".idf_escape($x);}return$J;}function
|
|||
|
cookie($C,$Y,$Ud=2592000){global$ba;$F=array($C,(preg_match("~\n~",$Y)?"":$Y),($Ud?time()+$Ud:0),preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0)$F[]=true;return
|
|||
|
call_user_func_array('setcookie',$F);}function
|
|||
|
restart_session(){if(!ini_bool("session.use_cookies"))session_start();}function
|
|||
|
stop_session(){if(!ini_bool("session.use_cookies"))session_write_close();}function&get_session($x){return$_SESSION[$x][DRIVER][SERVER][$_GET["username"]];}function
|
|||
|
set_session($x,$X){$_SESSION[$x][DRIVER][SERVER][$_GET["username"]]=$X;}function
|
|||
|
auth_url($Qh,$N,$V,$k=null){global$Ub;preg_match('~([^?]*)\\??(.*)~',remove_from_uri(implode("|",array_keys($Ub))."|username|".($k!==null?"db|":"").session_name()),$B);return"$B[1]?".(sid()?SID."&":"").($Qh!="server"||$N!=""?urlencode($Qh)."=".urlencode($N)."&":"")."username=".urlencode($V).($k!=""?"&db=".urlencode($k):"").($B[2]?"&$B[2]":"");}function
|
|||
|
is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
|
|||
|
redirect($A,$je=null){if($je!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($A!==null?$A:$_SERVER["REQUEST_URI"]))][]=$je;}if($A!==null){if($A=="")$A=".";header("Location: $A");exit;}}function
|
|||
|
query_redirect($H,$A,$je,$Of=true,$tc=true,$Ac=false,$eh=""){global$h,$m,$b;if($tc){$Dg=microtime(true);$Ac=!$h->query($H);$eh=format_time($Dg);}$Bg="";if($H)$Bg=$b->messageQuery($H,$eh);if($Ac){$m=error().$Bg;return
|
|||
|
false;}if($Of)redirect($A,$je.$Bg);return
|
|||
|
true;}function
|
|||
|
queries($H){global$h;static$If=array();static$Dg;if(!$Dg)$Dg=microtime(true);if($H===null)return
|
|||
|
array(implode("\n",$If),format_time($Dg));$If[]=(preg_match('~;$~',$H)?"DELIMITER ;;\n$H;\nDELIMITER ":$H).";";return$h->query($H);}function
|
|||
|
apply_queries($H,$S,$pc='table'){foreach($S
|
|||
|
as$Q){if(!queries("$H ".$pc($Q)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
queries_redirect($A,$je,$Of){list($If,$eh)=queries(null);return
|
|||
|
query_redirect($If,$A,$je,$Of,false,!$Of,$eh);}function
|
|||
|
format_time($Dg){return
|
|||
|
lang(1,max(0,microtime(true)-$Dg));}function
|
|||
|
remove_from_uri($ff=""){return
|
|||
|
substr(preg_replace("~(?<=[?&])($ff".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
|
|||
|
pagination($E,$Cb){return" ".($E==$Cb?$E+1:'<a href="'.h(remove_from_uri("page").($E?"&page=$E".($_GET["next"]?"&next=".urlencode($_GET["next"]):""):"")).'">'.($E+1)."</a>");}function
|
|||
|
get_file($x,$Jb=false){$Ec=$_FILES[$x];if(!$Ec)return
|
|||
|
null;foreach($Ec
|
|||
|
as$x=>$X)$Ec[$x]=(array)$X;$J='';foreach($Ec["error"]as$x=>$m){if($m)return$m;$C=$Ec["name"][$x];$mh=$Ec["tmp_name"][$x];$tb=file_get_contents($Jb&&preg_match('~\\.gz$~',$C)?"compress.zlib://$mh":$mh);if($Jb){$Dg=substr($tb,0,3);if(function_exists("iconv")&&preg_match("~^\xFE\xFF|^\xFF\xFE~",$Dg,$Uf))$tb=iconv("utf-16","utf-8",$tb);elseif($Dg=="\xEF\xBB\xBF")$tb=substr($tb,3);$J.=$tb."\n\n";}else$J.=$tb;}return$J;}function
|
|||
|
upload_error($m){$ge=($m==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):0);return($m?lang(2).($ge?" ".lang(3,$ge):""):lang(4));}function
|
|||
|
repeat_pattern($pf,$y){return
|
|||
|
str_repeat("$pf{0,65535}",$y/65535)."$pf{0,".($y%65535)."}";}function
|
|||
|
is_utf8($X){return(preg_match('~~u',$X)&&!preg_match('~[\\0-\\x8\\xB\\xC\\xE-\\x1F]~',$X));}function
|
|||
|
shorten_utf8($P,$y=80,$Kg=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{FFFF}]",$y).")($)?)u",$P,$B))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$y).")($)?)",$P,$B);return
|
|||
|
h($B[1]).$Kg.(isset($B[2])?"":"<i>...</i>");}function
|
|||
|
format_number($X){return
|
|||
|
strtr(number_format($X,0,".",lang(5)),preg_split('~~u',lang(6),-1,PREG_SPLIT_NO_EMPTY));}function
|
|||
|
friendly_url($X){return
|
|||
|
preg_replace('~[^a-z0-9_]~i','-',$X);}function
|
|||
|
hidden_fields($Ef,$jd=array()){while(list($x,$X)=each($Ef)){if(!in_array($x,$jd)){if(is_array($X)){foreach($X
|
|||
|
as$Dd=>$W)$Ef[$x."[$Dd]"]=$W;}else
|
|||
|
echo'<input type="hidden" name="'.h($x).'" value="'.h($X).'">';}}}function
|
|||
|
hidden_fields_get(){echo(sid()?'<input type="hidden" name="'.session_name().'" value="'.h(session_id()).'">':''),(SERVER!==null?'<input type="hidden" name="'.DRIVER.'" value="'.h(SERVER).'">':""),'<input type="hidden" name="username" value="'.h($_GET["username"]).'">';}function
|
|||
|
table_status1($Q,$Bc=false){$J=table_status($Q,$Bc);return($J?$J:array("Name"=>$Q));}function
|
|||
|
column_foreign_keys($Q){global$b;$J=array();foreach($b->foreignKeys($Q)as$p){foreach($p["source"]as$X)$J[$X][]=$p;}return$J;}function
|
|||
|
enum_input($U,$Ia,$n,$Y,$jc=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$n["length"],$be);$J=($jc!==null?"<label><input type='$U'$Ia value='$jc'".((is_array($Y)?in_array($jc,$Y):$Y===0)?" checked":"")."><i>".lang(7)."</i></label>":"");foreach($be[1]as$r=>$X){$X=stripcslashes(str_replace("''","'",$X));$ab=(is_int($Y)?$Y==$r+1:(is_array($Y)?in_array($r+1,$Y):$Y===$X));$J.=" <label><input type='$U'$Ia value='".($r+1)."'".($ab?' checked':'').'>'.h($b->editVal($X,$n)).'</label>';}return$J;}function
|
|||
|
input($n,$Y,$q){global$h,$yh,$b,$w;$C=h(bracket_escape($n["field"]));echo"<td class='function'>";if(is_array($Y)&&!$q){$Da=array($Y);if(version_compare(PHP_VERSION,5.4)>=0)$Da[]=JSON_PRETTY_PRINT;$Y=call_user_func_array('json_encode',$Da);$q="json";}$Xf=($w=="mssql"&&$n["auto_increment"]);if($Xf&&!$_POST["save"])$q=null;$Sc=(isset($_GET["select"])||$Xf?array("orig"=>lang(8)):array())+$b->editFunctions($n);$Ia=" name='fields[$C]'";if($n["type"]=="enum")echo
|
|||
|
nbsp($Sc[""])."<td>".$b->editInput($_GET["edit"],$n,$Ia,$Y);else{$Hc=0;foreach($Sc
|
|||
|
as$x=>$X){if($x===""||!$X)break;$Hc++;}$Le=($Hc?" onchange=\"var f = this.form['function[".h(js_escape(bracket_escape($n["field"])))."]']; if ($Hc > f.selectedIndex) f.selectedIndex = $Hc;\" onkeyup='keyupChange.call(this);'":"");$Ia.=$Le;$ad=(in_array($q,$Sc)||isset($Sc[$q]));echo(count($Sc)>1?"<select name='function[$C]' onchange='functionChange(this);'".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).">".optionlist($Sc,$q===null||$ad?$q:"")."</select>":nbsp(reset($Sc))).'<td>';$sd=$b->editInput($_GET["edit"],$n,$Ia,$Y);if($sd!="")echo$sd;elseif($n["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$n["length"],$be);foreach($be[1]as$r=>$X){$X=stripcslashes(str_replace("''","'",$X));$ab=(is_int($Y)?($Y>>$r)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$C][$r]' value='".(1<<$r)."'".($ab?' checked':'')."$Le>".h($b->editVal($X,$n)).'</label>';}}elseif(preg_match('~blob|bytea|raw|file~',$n["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$C'$Le>";elseif(($ch=preg_match('~text|lob~',$n["type"]))||preg_match("~\n~",$Y)){if($ch&&$w!="sqlite")$Ia.=" cols='50' rows='12'";else{$L=min(12,substr_count($Y,"\n")+1);$Ia.=" cols='30' rows='$L'".($L==1?" style='height: 1.2em;'":"");}echo"<textarea$Ia>".h($Y).'</textarea>';}elseif($q=="json")echo"<textarea$Ia cols='50' rows='12' class='jush-js'>".h($Y).'</textarea>';else{$ie=(!preg_match('~int~',$n["type"])&&preg_match('~^(\\d+)(,(\\d+))?$~',$n["length"],$B)?((preg_match("~binary~",$n["type"])?2:1)*$B[1]+($B[3]?1:0)+($B[2]&&!$n["unsigned"]?1:0)):($yh[$n["type"]]?$yh[$n["type"]]+($n["unsigned"]?0:1):0));if($w=='sql'&&$h->server_info>=5.6&&preg_match('~time~',$n["type"]))$ie+=7;echo"<input".((!$ad||$q==="")&&preg_match('~(?<!o)int~',$n["type"])?" type='number'":"")." value='".h($Y)."'".($ie?" maxlength='$ie'":"").(preg_match('~char|binary~',$n["type"])&&$ie>20?" size='40'":"")."$Ia>";}}}function
|
|||
|
process_input($n){global$b;$t=bracket_escape($n["field"]);$q=$_POST["function"][$t];$Y=$_POST["fields"][$t];if($n["type"]=="enum"){if($Y==-1)return
|
|||
|
false;if($Y=="")return"NULL";return+$Y;}if($n["auto_increment"]&&$Y=="")return
|
|||
|
null;if($q=="orig")return($n["on_update"]=="CURRENT_TIMESTAMP"?idf_escape($n["field"]):false);if($q=="NULL")$Y=null;if($n["type"]=="set")return
|
|||
|
array_sum((array)$Y);if($q=="json"){$q="";$Y=json_decode($Y,true);if(!is_array($Y))return
|
|||
|
false;return$Y;}if(preg_match('~blob|bytea|raw|file~',$n["type"])&&ini_bool("file_uploads")){$Ec=get_file("fields-$t");if(!is_string($Ec))return
|
|||
|
false;return
|
|||
|
q($Ec);}return$b->processInput($n,$Y,$q);}function
|
|||
|
fields_from_edit(){global$l;$J=array();foreach((array)$_POST["field_keys"]as$x=>$X){if($X!=""){$X=bracket_escape($X);$_POST["function"][$X]=$_POST["field_funs"][$x];$_POST["fields"][$X]=$_POST["field_vals"][$x];}}foreach((array)$_POST["fields"]as$x=>$X){$C=bracket_escape($x,1);$J[$C]=array("field"=>$C,"privileges"=>array("insert"=>1,"update"=>1),"null"=>1,"auto_increment"=>($x==$l->primary),);}return$J;}function
|
|||
|
search_tables(){global$b,$h;$_GET["where"][0]["op"]="LIKE %%";$_GET["where"][0]["val"]=$_POST["query"];$Nc=false;foreach(table_status('',true)as$Q=>$R){$C=$b->tableName($R);if(isset($R["Engine"])&&$C!=""&&(!$_POST["tables"]||in_array($Q,$_POST["tables"]))){$I=$h->query("SELECT".limit("1 FROM ".table($Q)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($Q),array())),1));if(!$I||$I->fetch_row()){if(!$Nc){echo"<ul>\n";$Nc=true;}echo"<li>".($I?"<a href='".h(ME."select=".urlencode($Q)."&where[0][op]=".urlencode($_GET["where"][0]["op"])."&where[0][val]=".urlencode($_GET["where"][0]["val"]))."'>$C</a>\n":"$C: <span class='error'>".error()."</span>\n");}}}echo($Nc?"</ul>":"<p class='message'>".lang(9))."\n";}function
|
|||
|
dump_headers($hd,$se=false){global$b;$J=$b->dumpHeaders($hd,$se);$df=$_POST["output"];if($df!="text")header("Content-Disposition: attachment; filename=".$b->dumpFilename($hd).".$J".($df!="file"&&!preg_match('~[^0-9a-z]~',$df)?".$df":""));session_write_close();ob_flush();flush();return$J;}function
|
|||
|
dump_csv($K){foreach($K
|
|||
|
as$x=>$X){if(preg_match("~[\"\n,;\t]~",$X)||$X==="")$K[$x]='"'.str_replace('"','""',$X).'"';}echo
|
|||
|
implode(($_POST["format"]=="csv"?",":($_POST["format"]=="tsv"?"\t":";")),$K)."\r\n";}function
|
|||
|
apply_sql_function($q,$e){return($q?($q=="unixepoch"?"DATETIME($e, '$q')":($q=="count distinct"?"COUNT(DISTINCT ":strtoupper("$q("))."$e)"):$e);}function
|
|||
|
get_temp_dir(){$J=ini_get("upload_tmp_dir");if(!$J){if(function_exists('sys_get_temp_dir'))$J=sys_get_temp_dir();else{$Fc=@tempnam("","");if(!$Fc)return
|
|||
|
false;$J=dirname($Fc);unlink($Fc);}}return$J;}function
|
|||
|
password_file($zb){$Fc=get_temp_dir()."/adminer.key";$J=@file_get_contents($Fc);if($J||!$zb)return$J;$Pc=@fopen($Fc,"w");if($Pc){$J=rand_string();fwrite($Pc,$J);fclose($Pc);}return$J;}function
|
|||
|
rand_string(){return
|
|||
|
md5(uniqid(mt_rand(),true));}function
|
|||
|
select_value($X,$_,$n,$dh){global$b,$ba;if(is_array($X)){$J="";foreach($X
|
|||
|
as$Dd=>$W)$J.="<tr>".($X!=array_values($X)?"<th>".h($Dd):"")."<td>".select_value($W,$_,$n,$dh);return"<table cellspacing='0'>$J</table>";}if(!$_)$_=$b->selectLink($X,$n);if($_===null){if(is_mail($X))$_="mailto:$X";if($Gf=is_url($X))$_=(($Gf=="http"&&$ba)||preg_match('~WebKit~i',$_SERVER["HTTP_USER_AGENT"])?$X:"$Gf://www.adminer.org/redirect/?url=".urlencode($X));}$J=$b->editVal($X,$n);if($J!==null){if($J==="")$J=" ";elseif($dh!=""&&is_shortable($n)&&is_utf8($J))$J=shorten_utf8($J,max(0,+$dh));else$J=h($J);}return$b->selectVal($J,$_,$n,$X);}function
|
|||
|
is_mail($gc){$Ga='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$Tb='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$pf="$Ga+(\\.$Ga+)*@($Tb?\\.)+$Tb";return
|
|||
|
is_string($gc)&&preg_match("(^$pf(,\\s*$pf)*\$)i",$gc);}function
|
|||
|
is_url($P){$Tb='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return(preg_match("~^(https?)://($Tb?\\.)+$Tb(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$P,$B)?strtolower($B[1]):"");}function
|
|||
|
is_shortable($n){return
|
|||
|
preg_match('~char|text|lob|geometry|point|linestring|polygon|string~',$n["type"]);}function
|
|||
|
count_rows($Q,$Z,$yd,$Vc){global$w;$H=" FROM ".table($Q).($Z?" WHERE ".implode(" AND ",$Z):"");return($yd&&($w=="sql"||count($Vc)==1)?"SELECT COUNT(DISTINCT ".implode(", ",$Vc).")$H":"SELECT COUNT(*)".($yd?" FROM (SELECT 1$H$Wc) x":$H));}function
|
|||
|
slow_query($H){global$b,$T;$k=$b->database();$fh=$b->queryTimeout();if(support("kill")&&is_object($i=connect())&&($k==""||$i->select_db($k))){$Id=$i->result("SELECT CONNECTION_ID()");echo'<script type="text/javascript">
|
|||
|
var timeout = setTimeout(function () {
|
|||
|
ajax(\'',js_escape(ME),'script=kill\', function () {
|
|||
|
}, \'token=',$T,'&kill=',$Id,'\');
|
|||
|
}, ',1000*$fh,');
|
|||
|
</script>
|
|||
|
';}else$i=null;ob_flush();flush();$J=@get_key_vals($H,$i,$fh);if($i){echo"<script type='text/javascript'>clearTimeout(timeout);</script>\n";ob_flush();flush();}return
|
|||
|
array_keys($J);}function
|
|||
|
get_token(){$Lf=rand(1,1e6);return($Lf^$_SESSION["token"]).":$Lf";}function
|
|||
|
verify_token(){list($T,$Lf)=explode(":",$_POST["token"]);return($Lf^$_SESSION["token"])==$T;}function
|
|||
|
lzw_decompress($Qa){$Qb=256;$Ra=8;$hb=array();$Zf=0;$ag=0;for($r=0;$r<strlen($Qa);$r++){$Zf=($Zf<<8)+ord($Qa[$r]);$ag+=8;if($ag>=$Ra){$ag-=$Ra;$hb[]=$Zf>>$ag;$Zf&=(1<<$ag)-1;$Qb++;if($Qb>>$Ra)$Ra++;}}$Pb=range("\0","\xFF");$J="";foreach($hb
|
|||
|
as$r=>$gb){$fc=$Pb[$gb];if(!isset($fc))$fc=$Yh.$Yh[0];$J.=$fc;if($r)$Pb[]=$Yh.$fc[0];$Yh=$fc;}return$J;}function
|
|||
|
on_help($mb,$xg=0){return" onmouseover='helpMouseover(this, event, ".h($mb).", $xg);' onmouseout='helpMouseout(this, event);'";}function
|
|||
|
edit_form($a,$o,$K,$Fh){global$b,$w,$T,$m;$Pg=$b->tableName(table_status1($a,true));page_header(($Fh?lang(10):lang(11)),$m,array("select"=>array($a,$Pg)),$Pg);if($K===false)echo"<p class='error'>".lang(12)."\n";echo'<div id="message"></div>
|
|||
|
<form action="" method="post" enctype="multipart/form-data" id="form">
|
|||
|
';if(!$o)echo"<p class='error'>".lang(13)."\n";else{echo"<table cellspacing='0' onkeydown='return editingKeydown(event);'>\n";foreach($o
|
|||
|
as$C=>$n){echo"<tr><th>".$b->fieldName($n);$Kb=$_GET["set"][bracket_escape($C)];if($Kb===null){$Kb=$n["default"];if($n["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$Kb,$Uf))$Kb=$Uf[1];}$Y=($K!==null?($K[$C]!=""&&$w=="sql"&&preg_match("~enum|set~",$n["type"])?(is_array($K[$C])?array_sum($K[$C]):+$K[$C]):$K[$C]):(!$Fh&&$n["auto_increment"]?"":(isset($_GET["select"])?false:$Kb)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$n);$q=($_POST["save"]?(string)$_POST["function"][$C]:($Fh&&$n["on_update"]=="CURRENT_TIMESTAMP"?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(preg_match("~time~",$n["type"])&&$Y=="CURRENT_TIMESTAMP"){$Y="";$q="now";}input($n,$Y,$q);echo"\n";}if(!support("table"))echo"<tr>"."<th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange(this);' value=''>"."<td class='function'>".html_select("field_funs[]",$b->editFunctions(array("null"=>isset($_GET["select"]))))."<td><input name='field_vals[]'>"."\n";echo"</table>\n";}echo"<p>\n";if($o){echo"<input type='submit' value='".lang(14)."'>\n";if(!isset($_GET["select"]))echo"<input type='submit' name='insert' value='".($Fh?lang(15)."' onclick='return !ajaxForm(this.form, \"".lang(16).'...", this)':lang(17))."' title='Ctrl+Shift+Enter'>\n";}echo($Fh?"<input type='submit' name='delete' value='".lang(18)."'".confirm().">\n":($_POST||!$o?"":"<script type='text/javascript'>focus(document.getElementById('form').getElementsByTagName('td')[1].firstChild);</script>\n"));if(isset($_GET["select"]))hidden_fields(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));echo'<input type="hidden" name="referer" value="',h(isset($_POST["referer"])?$_POST["referer"]:$_SERVER["HTTP_REFERER"]),'">
|
|||
|
<input type="hidden" name="save" value="1">
|
|||
|
<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}global$b,$h,$Ub,$cc,$mc,$m,$Sc,$Xc,$ba,$rd,$w,$ca,$Md,$Ke,$qf,$Hg,$bd,$T,$rh,$yh,$Eh,$ia;if(!$_SERVER["REQUEST_URI"])$_SERVER["REQUEST_URI"]=$_SERVER["ORIG_PATH_INFO"];if(!strpos($_SERVER["REQUEST_URI"],'?')&&$_SERVER["QUERY_STRING"]!="")$_SERVER["REQUEST_URI"].="?$_SERVER[QUERY_STRING]";$ba=$_SERVER["HTTPS"]&&strcasecmp($_SERVER["HTTPS"],"off");@ini_set("session.use_trans_sid",false);session_cache_limiter("");if(!defined("SID")){session_name("adminer_sid");$F=array(0,preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0)$F[]=true;call_user_func_array('session_set_cookie_params',$F);session_start();}remove_slashes(array(&$_GET,&$_POST,&$_COOKIE),$Gc);if(get_magic_quotes_runtime())set_magic_quotes_runtime(false);@set_time_limit(0);@ini_set("zend.ze1_compatibility_mode",false);@ini_set("precision",20);$Md=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','no'=>'Norsk','pl'=>'Polski','pt'=>'Português','pt-br'=>'Português (Brazil)','ro'=>'Limba Română','ru'=>'Русский язык','sk'=>'Slovenčina','sl'=>'Slovenski','sr'=>'Српски','ta'=>'தமிழ்','th'=>'ภาษาไทย','tr'=>'Türkçe','uk'=>'Українська','vi'=>'Tiếng Việt','zh'=>'简体中文','zh-tw'=>'繁體中文',);function
|
|||
|
get_lang(){global$ca;return$ca;}function
|
|||
|
lang($t,$Be=null){if(is_string($t)){$tf=array_search($t,get_translations("en"));if($tf!==false)$t=$tf;}global$ca,$rh;$qh=($rh[$t]?$rh[$t]:$t);if(is_array($qh)){$tf=($Be==1?0:($ca=='cs'||$ca=='sk'?($Be&&$Be<5?1:2):($ca=='fr'?(!$Be?0:1):($ca=='pl'?($Be%10>1&&$Be%10<5&&$Be/10%10!=1?1:2):($ca=='sl'?($Be%100==1?0:($Be%100==2?1:($Be%100==3||$Be%100==4?2:3))):($ca=='lt'?($Be%10==1&&$Be%100!=11?0:($Be%10>1&&$Be/10%10!=1?1:2)):($ca=='ru'||$ca=='sr'||$ca=='uk'?($Be%10==1&&$Be%100!=11?0:($Be%10>1&&$Be%10<5&&$Be/10%10!=1?1:2)):1)))))));$qh=$qh[$tf];}$Da=func_get_args();array_shift($Da);$Mc=str_replace("%d","%s",$qh);if($Mc!=$qh)$Da[0]=format_number($Be);return
|
|||
|
vsprintf($Mc,$Da);}function
|
|||
|
switch_lang(){global$ca,$Md;echo"<form action='' method='post'>\n<div id='lang'>",lang(19).": ".html_select("lang",$Md,$ca,"this.form.submit();")," <input type='submit' value='".lang(20)."' class='hidden'>\n","<input type='hidden' name='token' value='".get_token()."'>\n";echo"</div>\n</form>\n";}if(isset($_POST["lang"])&&verify_token()){cookie("adminer_lang",$_POST["lang"]);$_SESSION["lang"]=$_POST["lang"];$_SESSION["translations"]=array();redirect(remove_from_uri());}$ca="en";if(isset($Md[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ca=$_COOKIE["adminer_lang"];}elseif(isset($Md[$_SESSION["lang"]]))$ca=$_SESSION["lang"];else{$ua=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$be,PREG_SET_ORDER);foreach($be
|
|||
|
as$B)$ua[$B[1]]=(isset($B[3])?$B[3]:1);arsort($ua);foreach($ua
|
|||
|
as$x=>$Hf){if(isset($Md[$x])){$ca=$x;break;}$x=preg_replace('~-.*~','',$x);if(!isset($ua[$x])&&isset($Md[$x])){$ca=$x;break;}}}$rh=&$_SESSION["translations"];if($_SESSION["translations_version"]!=3124109916){$rh=array();$_SESSION["translations_version"]=3124109916;}function
|
|||
|
get_translations($Ld){switch($Ld){case"en":$g="A9D<07>y<EFBFBD>@s:<3A>G<EFBFBD><47>(<28>ff<66><66><EFBFBD><EFBFBD><EFBFBD> <09><>:<1B>S<><53><EFBFBD>a2\"1<>..L'<27>I<EFBFBD><49>m<EFBFBD>#<23>s,<2C>K<17><>OP#I<>@%9<><39>i4<08>o2ύ<32><CF8D><EFBFBD><EFBFBD><EFBFBD>,9<>%<02>P<EFBFBD>b2<19><06>a<EFBFBD><61>r\n2<EFBFBD>NC<>(<28>r4<72><34>1C`(<28>:Eb<45>9A<14>i:<02>&㙔<>y<EFBFBD><79>F<><46><EFBFBD>Y<><59>\r<13>\n<EFBFBD> 8Z<0E>S=\$A<19><><0C><13>`<60>=<3D>܌<EFBFBD><DC8C><EFBFBD>0<EFBFBD>\n<EFBFBD><EFBFBD>dF<EFBFBD> <09><>n:Zΰ)<29><>Q<EFBFBD><51><EFBFBD><EFBFBD><EFBFBD><EFBFBD><0E>Ak<41><6B><EFBFBD><06>}<7D><>e<EFBFBD><65>AD<41><44><EFBFBD><EFBFBD>a<EFBFBD>į<EFBFBD><C4AF><EFBFBD>\\<EFBFBD>}<7D><>5<EFBFBD>#|@<40>h<EFBFBD>3<><33>N<EFBFBD>}@<40><>i<EFBFBD><03><18><>˞N<14>t<EFBFBD><74>~9<><39><EFBFBD><EFBFBD><16>B؍<42>8<EFBFBD>:-p<><70><EFBFBD>KX<4B>9,<2C>p<EFBFBD>:<0E>8<EFBFBD><08>(<28>\0<EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>@<40><><EFBFBD>-B<>ƎN<C68E><4E><EFBFBD>@.<2E><>9<EFBFBD>#<23><><EFBFBD>3<EFBFBD><33><EFBFBD>Ӊ<EFBFBD>z<EFBFBD>7:<3A><><EFBFBD>ތ<EFBFBD><DE8C>@<40>F<EFBFBD>.1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\r\"<0E>\"ӈ#c:9<0C><>;<3B>R<EFBFBD><52>Т<EFBFBD><;<3B><><EFBFBD>چ\$#<10>!,<2C>3<EFBFBD><33><EFBFBD><EFBFBD>2ȀP<C880>:<3A><>#ʾK#8<38><CE80><EFBFBD><EFBFBD>Ac<18>7<><37><EFBFBD><EFBFBD> -Bμ<42><CEBC>H<EFBFBD><1E><>3<EFBFBD><33><EFBFBD>£<EFBFBD>ǣ;<3B>,<2C><>|<7C>:<3A>R<EFBFBD>p9<70>m<EFBFBD>P(<28><>\\6<EFBFBD>md<EFBFBD>:<3A><0B>ƀ<EFBFBD>-<2D><><EFBFBD><EFBFBD><03>M,<2C>K<EFBFBD>A#FN<46><4E>_T<5F>vh<0B><><EFBFBD>K<08>.#gfX<66>x<EFBFBD><78>2<EFBFBD><32><EFBFBD><EFBFBD>Qo<51>^8YS;Q4<51><05><><EFBFBD>vm<76><6D><EFBFBD>k̥ƣ:\n<EFBFBD><EFBFBD><EFBFBD>z5V<EFBFBD>(<28><>&<26><><EFBFBD><EFBFBD>3T<11>l<EFBFBD><05><><18>O<EFBFBD>[~7'<27><08><>3<EFBFBD>pz<><7A>-<2D><>w<><77><EFBFBD><EFBFBD>&\r|<7C><15>MA7V\nJP<EFBFBD><EFBFBD><EFBFBD><08>4<EFBFBD>\"<18>)̸<>5ǡpA77<37><37>3,<2C><>B<EFBFBD><42><17><><EFBFBD>ߊN664<36>T<EFBFBD><54><03><17><0E><>@<40><>Ȥ<EFBFBD>2i<32><69><EFBFBD><EFBFBD><EFBFBD>J2`<60><><EFBFBD>i<EFBFBD><69>f<EFBFBD>7% TA*\\Z<EFBFBD><EFBFBD>k<><07>Ѐ<><D080><EFBFBD>D4<0E><><EFBFBD><05>x<EFBFBD>Å<EFBFBD>N<><05>8<EFBFBD>Ǽ<><C7BC><1E>s<EFBFBD>^4#<23>*:o<><6F>,ލa}m<>ը<EFBFBD><05>|<7C><><EFBFBD>Ē<EFBFBD><C492><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GQ<47>`<60>0./)?<3F><> @<40><><EFBFBD><06><>/<2F><>@( <02><><EFBFBD><EFBFBD><EFBFBD>0@(JD<4A><44>YjL<6A>ecv[<5B><><EFBFBD>z<><7A><EFBFBD>2T<32>%ɆP6<50>&~2J<32><0C><><EFBFBD>G<EFBFBD><47><EFBFBD><EFBFBD><EFBFBD>;]g<><67>@<14><1A>ix<69><)<29>E~<7E>Y<EFBFBD>R&<26>4<EFBFBD>db<64>ң<EFBFBD>YGa<47>:<3A>Tk<54>)<29>I<><EFBFBD>음i(1R<><52>8G<38>\"<EFBFBD>!<21><><EFBFBD><EFBFBD>Hz<48><7A>#<08>Q<EFBFBD><1F>~<7E>x\$<EFBFBD><0C>HP<48>8e-,1<>!<21>k<><6B>G<'\0<EFBFBD> A\n<EFBFBD>D<>@(L<08>Md<06><>K<EFBFBD>b(4<>A<05>0<><30><13>>H<>L<EFBFBD><4C><EFBFBD>Xӹ<58>8<EFBFBD><38>0<EFBFBD><02><>͙<EFBFBD>h]<5D>%<25><>HN!<21>%!<21><><11>j<>8wG(6<>CN<43>s0<73><30>E<19><><EFBFBD>%<0B>>1f<31><66><EFBFBD><EFBFBD>~`ڋwHI<48>\"<EFBFBD><15>i<EFBFBD>Kg\\g0.dfuG<>pdM<11>@fq<66><71><EFBFBD>|<7C>hnPX<50><58>0<EFBFBD><19>C<EFBFBD>y/-<2D><>Ҁrѱ<72>\$'^a<><61><19>sPq<50>\$<EFBFBD><%ɨ'R<><0B>S(<28>!5?R<><52>=<3D>\"HV*<2A>%X4<58>w<EFBFBD>h<EFBFBD><68>_\r<EFBFBD>ཨ<EFBFBD><EFBFBD>}5<>=6<>P<EFBFBD><50>绚A<E7BB9A><41>)<29><>mb <20><><EFBFBD><EFBFBD>'<27><>C<EFBFBD>1i2<69><32>(;S<><53><EFBFBD>xnBa<<B<>Մ<>/!<19><><EFBFBD><14><>k><3E>ƛ<08><>W<0C> MT<4D>\0<EFBFBD><EFBFBD><1C><01>٠<EFBFBD><D9A0>`<60>\"i\$&<><C280>QW<51>l<><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y-L\$A<EFBFBD>3JF<EFBFBD>jy~<7E>3<EFBFBD><33><EFBFBD>ګU<DAAB>mH0<48>n<EFBFBD>Ζ<EFBFBD>[<5B>ҫU<D2AB>ś<1E><><EFBFBD>IC%<25><><EFBFBD><EFBFBD>VW<56>U<EFBFBD><55>z<EFBFBD><7A><EFBFBD><EFBFBD>VJ<56>,><3E><>(<28><13>NG<4E>}<7D><>dv<64><13>Q<>颭<EFBFBD>tGOB<4F>eP<>_r5<><35>/\"栌<EFBFBD>~<7E><0B>AI (׆ʣP9<> p<><70>P<EFBFBD>u<EFBFBD>)v<>O<EFBFBD><4F>&#uڸe<DAB8><65>4<EFBFBD><34> <20>q<EFBFBD>Y><3E><><EFBFBD><EFBFBD><1F><>s<EFBFBD> @<40><>J<EFBFBD>0À_<C380>1(<28> v<>ܛ<EFBFBD>(<0F>o<EFBFBD>d<EFBFBD><64><EFBFBD>fԯ[<1D>4W<34>骥<EFBFBD>(<28>Y<EFBFBD><59>ƝL<C69D>\$T_<EFBFBD><EFBFBD>OL<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>08w<38>Z<EFBFBD><5A><EFBFBD>;g<><67><EFBFBD>d\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>s<EFBFBD>xR5Ϙ<35><CF98>Ⱥ;ष`<60>.<2E>H<15><><EFBFBD><EFBFBD><EFBFBD>J,O)<29><><EFBFBD>0H<30><48><EFBFBD><EFBFBD>^<5E><>V2wZKJlqr0<72><30><EFBFBD>R<EFBFBD>e<EFBFBD><65>к<EFBFBD><D0BA>@<40>X<EFBFBD>7<EFBFBD>V<DEBA>1<EFBFBD><31><EFBFBD><EFBFBD><F09A8C91>~<17><><0E>SaL<61>ª}<7D>֬T<D6AC><54>j<>^k<>'/}<7D>r<EFBFBD>cl<63><6C><EFBFBD>Yl<59>[<5B><01>10<>̝<EFBFBD>bg<><67><EFBFBD>|<7C><0C>_<EFBFBD>,<2C>Z\n<EFBFBD>hLÕ%S<><53><՟<><16><><EFBFBD><EFBFBD>/<2F>Q<EFBFBD>a7<61>@<40><><01>d<EFBFBD><64>6\nϞ<EFBFBD>.j<>`ް<><DEB0>k<EFBFBD><6B><EFBFBD><EFBFBD>\"0Yc|<7C>4Bux<75>NҞ<>4{Д'L-V<10>ZJ<11>L<EFBFBD> k=S<06>&9jy<6A><0C><>k|<7C>J<EFBFBD>><3E><><EFBFBD><EFBFBD><EFBFBD>v<EFBFBD>><3E><>7ig<69><67>]wa<><61>\"<EFBFBD><EFBFBD>G<EFBFBD><EFBFBD>)<29>o<EFBFBD>%;qӕ<71>w<><77>/<2F><>Wn<57><6E><13>b<EFBFBD>l<EFBFBD>(Ȕ<>?K<><4B>o<EFBFBD>W<EFBFBD>&<26>~<11><>Uܓۮ<DC93><DBAE><EFBFBD>݊x_ۤ<>y<EFBFBD>끨b<EB81A8>2!<21>G<EFBFBD>D<EFBFBD><44><EFBFBD>S<><53>\".>G<>y<\n<0E>%<25>jTk<6B><DEBA>7H<37><48>gζ<67><CEB6><EFBFBD><EFBFBD><EFBFBD><1E>M<EFBFBD><4D>%<16>/<2F><><EFBFBD>r<EFBFBD>A<EFBFBD>5<EFBFBD>j>|<7C>?<3F>.1ĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>PF0<46>T<EFBFBD><54>o<EFBFBD>p<EFBFBD><70>F<EFBFBD><46>G<EFBFBD>W<EFBFBD><57><EFBFBD><EFBFBD>3}<7D><>!J<><13>\"^<5E>Fh<46>%\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>l{<EFBFBD>wX<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><04>ڶ<EFBFBD>&<26><><EFBFBD><EFBFBD><12><>u<EFBFBD>/ͷ<>#<23><>m<02><>74엗<34><EC9797><EFBFBD><1A>1<17>~rX<72><58>\$i<EFBFBD>u<12>9<0C>J<><EFBFBD>q-<2D>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Em<45>5)0<>5<>0<EFBFBD>wʡ\r<06>V<18>xc\rz<EFBFBD><EFBFBD>ǂ0<EFBFBD><EFBFBD>yw<0C><><EFBFBD><1E>q<EFBFBD><71>kXaAT*`ZɮR!<21><><EFBFBD>m<EFBFBD><6D><EFBFBD>m&<26><>d<EFBFBD>{<EFBFBD>9<EFBFBD><EFBFBD>J<EFBFBD><EFBFBD>DN<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)5<><35>4<EFBFBD>7膟<37><E8869F>㐉C<E39089>6<EFBFBD><36><EFBFBD><02>.⚤/<2F>3 <1A>E<EFBFBD>;<3B>@<40><>P<EFBFBD><50><EFBFBD>\r<EFBFBD><EFBFBD>/\$j\$r<>R<><52><EFBFBD>X\0P<><50> I<><49><EFBFBD><EFBFBD>K<EFBFBD><4B>dI<64><49>ǐN.k<><6B><EFBFBD><<3C><><1A>Is0T<30>l<EFBFBD><6C><EFBFBD>mp<>-̿n<><6E><EFBFBD>ɤ\0<EFBFBD>p{lJʚM<CA9A><02>-x<> <09><08><0C><>N\0<EFBFBD><EFBFBD><EFBFBD><06><><EFBFBD><10>Zd #N<>\n<EFBFBD><EFBFBD>ʦ%誎'd<>-<2D><>\r<EFBFBD><EFBFBD>N&<26>F<EFBFBD>lJ(N<>J9O<39>5C0)<29><10>iN<69><4E><EFBFBD><02>MΘM<CE98><4D><EFBFBD><EFBFBD>V\"<EFBFBD>-Jj2<6A><32><EFBFBD><EFBFBD><EFBFBD><05>v\$<EFBFBD><EFBFBD>/<2F>n<EFBFBD><6E>'<12><>/S<02>";break;case"ar":$g="<EFBFBD>C<EFBFBD>P<EFBFBD><><C28D>l*<2A>\r<EFBFBD>,&\n<EFBFBD>A<EFBFBD><15><><EFBFBD>(J.<19><>0T2]6QM<51><4D>O<02>!b<11>#e<02>\\ɥ<12>\$<EFBFBD>\\\nl+[\n<EFBFBD>d<EFBFBD>k4<EFBFBD>O<EFBFBD><EFBFBD>&<26>ղ<EFBFBD><D5B2><EFBFBD>Q)̅7lI<6C><49><EFBFBD><0C>E\$<EFBFBD>ʑ<13><>m_7GT\r<EFBFBD>eDك)*Vʙ<56>'T6U1<55>z<EFBFBD>H<EFBFBD>]N*PZ,<2C>BT`<60><><EFBFBD><EFBFBD>%VD<56>5<EFBFBD>AU0<55>H<EFBFBD>S<EFBFBD>d!iQl(p(N<12><><EFBFBD>1<EFBFBD>e4<65>nY7<59>D<06> <09><> 7<1B><03><><EFBFBD>i6L<>S<EFBFBD><53><EFBFBD><EFBFBD>:<3A><0C><13><><EFBFBD>h4<68>N<EFBFBD>栭<>6I<>Eq<0B><>n<EFBFBD>h/<03>\\<EFBFBD>QY2<EFBFBD><EFBFBD><EFBFBD>n3<EFBFBD>'<27><><EFBFBD>v <09>le<6C><65><16><><1D><><EFBFBD>7<EFBFBD>Ftl.n<>l?O<B?<08><>[%<1B>!<21><><07>Ez<45><7A>-<2D>k<1E><><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD>@<40>\n<<3C><><EFBFBD><EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD><04><><EFBFBD>s\"B<EFBFBD>!<15><><EFBFBD><EFBFBD>*<2A>\\<EFBFBD>'<27>b<EFBFBD>U'<05><04>H<EFBFBD>A<EFBFBD>U<EFBFBD><55><EFBFBD>ܑ<EFBFBD>,<2C>∮h<04><><EFBFBD>R<EFBFBD><04>ti!<05>/<2F>q<EFBFBD>:<3A>GP\n<EFBFBD>@<40><><06><>\n<1E>e<EFBFBD>:<3A>.<2E>\n&T<><54><EFBFBD>F<EFBFBD><46><0B><><EFBFBD>?I<><49><EFBFBD><EFBFBD>h<EFBFBD>\\<EFBFBD>IL}\n<EFBFBD>;<3B>U<18>C<EFBFBD><43>p<EFBFBD><70>&<26>l<EFBFBD>O<EFBFBD>]<02><><EFBFBD><EFBFBD>6<EFBFBD>!<21><>ޑ<EFBFBD>p<><H LSU\\oH(L<>Kɥ<4B><C9A5><EFBFBD>B<EFBFBD>r<12><><EFBFBD><16><>e)<29>0<><30>I2*ڥY'<27>RF\\<EFBFBD>JtU<74><55>dE+(<28>=YS6I<36>TUrj<72>Y><3E><>\$<EFBFBD><16><><EFBFBD><EFBFBD><EFBFBD> <09>MUè<>67<36>cr<63><72>c<08><>Mp<4D><02><><EFBFBD>\0<EFBFBD>(<28><><EFBFBD>ea<65><61><EFBFBD>k<K<><12><><15><><EFBFBD>YOU<4F><55><EFBFBD>OS<4F>IN<49><0C>VW<56>t_c<5F><05>R<EFBFBD>I<EFBFBD><49>2<EFBFBD><32>Qn<51>f9J<16><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\<EFBFBD>I<0C><>VA`\n<EFBFBD><0E>U<EFBFBD>{e<EFBFBD><0F>\\<EFBFBD>W<EFBFBD><EFBFBD>6<EFBFBD>c<EFBFBD><EFBFBD>ƫ<EFBFBD>:&OfU<66>*<2A><>#<23><>6VT}<0E>FS<46>v\n<EFBFBD>{d6<EFBFBD><EFBFBD><EFBFBD>@:<3A>Ø<EFBFBD>1<EFBFBD>m<EFBFBD><6D>3^<5E>\0<EFBFBD>7<EFBFBD><EFBFBD>8<EFBFBD>7Ö<37>0<EFBFBD><30><0B>qv\0@6<>㫊aJn!<21>b<EFBFBD><62>m<>X<EFBFBD>7 <20>6S.<2E><><EFBFBD>\r<EFBFBD><EFBFBD>Pj OP}2<>*P<> <20>!<21><>2T<32>hl\\<EFBFBD><EFBFBD>3\0<EFBFBD>`L<>Υ<><CEA5><EFBFBD>&<26>X%k#<23>J<><4A>0<EFBFBD>:<13><>2ɰFt<46>D<18><>}fG+<2B>=IIh&<26>#<23><>96H<7F>;<3B>㕂2<E39582><03><>9<0C>'J-_<><19><>\"\r<01>:\0t<0B>xw<78>@<40>0<EFBFBD>G <1B>(r<05><>3<EFBFBD><33>?<05><><EFBFBD>n<EFBFBD><6E>7<EFBFBD><37>^<08><>r7a<37>\0<EFBFBD>X\"<07>\$6<EFBFBD>r\\<EFBFBD>t<07><>0<EFBFBD><30>B<EFBFBD><42>)<29>\r<EFBFBD>߸<><DFB8><EFBFBD><EFBFBD>`t6pE<70>A\0<EFBFBD>zCf`<60><17><>IQ9\\+̱\r<18>:ȍ<>h <09><>!'<27>CZ<43>!\$q@<40>E#<14><18><>UĹm(G<>ɔJ<C994>Q<EFBFBD><51><EFBFBD><EFBFBD><EFBFBD>I<><49>!J<><4A><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>!F)<07>ꥷ<EFBFBD>!,O+<2B>!R#<>Jk<4A>M<EFBFBD><4D>/ŀ<>T!dEN<45>s<15>J[`<60><>Υ<EFBFBD>jHũ'KF.<*<2A><>Y<EFBFBD>cd<63>R.<2E><><EFBFBD><EFBFBD>Z[<q<><1B>Ź<1C>R<EFBFBD><52>x\0<EFBFBD>\r9<EFBFBD><0B><><16>A<03>A<>3<EFBFBD>f1<>5<EFBFBD><35><EFBFBD><EFBFBD>`<60>&<26>nX!<21><16><18>bfA<>6<EFBFBD><36>\"k<EFBFBD><EFBFBD> g<0B>V<EFBFBD><56><EFBFBD>B<14>/f=p<>u<EFBFBD><13>p \n<EFBFBD>@\"<10>@U\0\"<EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><04>/hJ2<4A><32><EFBFBD><EFBFBD>(<28>p1<70><31><EFBFBD>\"A<0C>Vb<56><62><EFBFBD><EFBFBD>E<EFBFBD>D<>e<EFBFBD>j<>
|
|||
|
Min_PDO
|
|||
|
extends
|
|||
|
PDO{var$_result,$server_info,$affected_rows,$errno,$error;function
|
|||
|
__construct(){global$b;$tf=array_search("SQL",$b->operators);if($tf!==false)unset($b->operators[$tf]);}function
|
|||
|
dsn($Zb,$V,$G){try{parent::__construct($Zb,$V,$G);}catch(Exception$rc){auth_error($rc->getMessage());}$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=$this->getAttribute(4);}function
|
|||
|
query($H,$zh=false){$I=parent::query($H);$this->error="";if(!$I){list(,$this->errno,$this->error)=$this->errorInfo();return
|
|||
|
false;}$this->store_result($I);return$I;}function
|
|||
|
multi_query($H){return$this->_result=$this->query($H);}function
|
|||
|
store_result($I=null){if(!$I){$I=$this->_result;if(!$I)return
|
|||
|
false;}if($I->columnCount()){$I->num_rows=$I->rowCount();return$I;}$this->affected_rows=$I->rowCount();return
|
|||
|
true;}function
|
|||
|
next_result(){if(!$this->_result)return
|
|||
|
false;$this->_result->_offset=0;return@$this->_result->nextRowset();}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!$I)return
|
|||
|
false;$K=$I->fetch();return$K[$n];}}class
|
|||
|
Min_PDOStatement
|
|||
|
extends
|
|||
|
PDOStatement{var$_offset=0,$num_rows;function
|
|||
|
fetch_assoc(){return$this->fetch(2);}function
|
|||
|
fetch_row(){return$this->fetch(3);}function
|
|||
|
fetch_field(){$K=(object)$this->getColumnMeta($this->_offset++);$K->orgtable=$K->table;$K->orgname=$K->name;$K->charsetnr=(in_array("blob",(array)$K->flags)?63:0);return$K;}}}$Ub=array();class
|
|||
|
Min_SQL{var$_conn;function
|
|||
|
Min_SQL($h){$this->_conn=$h;}function
|
|||
|
quote($Y){return($Y===null?"NULL":$this->_conn->quote($Y));}function
|
|||
|
select($Q,$M,$Z,$Vc,$Te=array(),$z=1,$E=0,$Af=false){global$b,$w;$yd=(count($Vc)<count($M));$H=$b->selectQueryBuild($M,$Z,$Vc,$Te,$z,$E);if(!$H)$H="SELECT".limit(($_GET["page"]!="last"&&+$z&&$Vc&&$yd&&$w=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$M)."\nFROM ".table($Q),($Z?"\nWHERE ".implode(" AND ",$Z):"").($Vc&&$yd?"\nGROUP BY ".implode(", ",$Vc):"").($Te?"\nORDER BY ".implode(", ",$Te):""),($z!=""?+$z:null),($E?$z*$E:0),"\n");$Dg=microtime(true);$J=$this->_conn->query($H);if($Af)echo$b->selectQuery($H,format_time($Dg));return$J;}function
|
|||
|
delete($Q,$Jf,$z=0){$H="FROM ".table($Q);return
|
|||
|
queries("DELETE".($z?limit1($H,$Jf):" $H$Jf"));}function
|
|||
|
update($Q,$O,$Jf,$z=0,$rg="\n"){$Oh=array();foreach($O
|
|||
|
as$x=>$X)$Oh[]="$x = $X";$H=table($Q)." SET$rg".implode(",$rg",$Oh);return
|
|||
|
queries("UPDATE".($z?limit1($H,$Jf):" $H$Jf"));}function
|
|||
|
insert($Q,$O){return
|
|||
|
queries("INSERT INTO ".table($Q).($O?" (".implode(", ",array_keys($O)).")\nVALUES (".implode(", ",$O).")":" DEFAULT VALUES"));}function
|
|||
|
insertUpdate($Q,$L,$zf){return
|
|||
|
false;}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN");}function
|
|||
|
commit(){return
|
|||
|
queries("COMMIT");}function
|
|||
|
rollback(){return
|
|||
|
queries("ROLLBACK");}}$Ub["sqlite"]="SQLite 3";$Ub["sqlite2"]="SQLite 2";if(isset($_GET["sqlite"])||isset($_GET["sqlite2"])){$wf=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($Fc){$this->_link=new
|
|||
|
SQLite3($Fc);$Rh=$this->_link->version();$this->server_info=$Rh["versionString"];}function
|
|||
|
query($H){$I=@$this->_link->query($H);$this->error="";if(!$I){$this->errno=$this->_link->lastErrorCode();$this->error=$this->_link->lastErrorMsg();return
|
|||
|
false;}elseif($I->numColumns())return
|
|||
|
new
|
|||
|
Min_Result($I);$this->affected_rows=$this->_link->changes();return
|
|||
|
true;}function
|
|||
|
quote($P){return(is_utf8($P)?"'".$this->_link->escapeString($P)."'":"x'".reset(unpack('H*',$P))."'");}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!is_object($I))return
|
|||
|
false;$K=$I->_result->fetchArray();return$K[$n];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
Min_Result($I){$this->_result=$I;}function
|
|||
|
fetch_assoc(){return$this->_result->fetchArray(SQLITE3_ASSOC);}function
|
|||
|
fetch_row(){return$this->_result->fetchArray(SQLITE3_NUM);}function
|
|||
|
fetch_field(){$e=$this->_offset++;$U=$this->_result->columnType($e);return(object)array("name"=>$this->_result->columnName($e),"type"=>$U,"charsetnr"=>($U==SQLITE3_BLOB?63:0),);}function
|
|||
|
__desctruct(){return$this->_result->finalize();}}}else{class
|
|||
|
Min_SQLite{var$extension="SQLite",$server_info,$affected_rows,$error,$_link;function
|
|||
|
Min_SQLite($Fc){$this->server_info=sqlite_libversion();$this->_link=new
|
|||
|
SQLiteDatabase($Fc);}function
|
|||
|
query($H,$zh=false){$pe=($zh?"unbufferedQuery":"query");$I=@$this->_link->$pe($H,SQLITE_BOTH,$m);$this->error="";if(!$I){$this->error=$m;return
|
|||
|
false;}elseif($I===true){$this->affected_rows=$this->changes();return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($I);}function
|
|||
|
quote($P){return"'".sqlite_escape_string($P)."'";}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!is_object($I))return
|
|||
|
false;$K=$I->_result->fetch();return$K[$n];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
Min_Result($I){$this->_result=$I;if(method_exists($I,'numRows'))$this->num_rows=$I->numRows();}function
|
|||
|
fetch_assoc(){$K=$this->_result->fetch(SQLITE_ASSOC);if(!$K)return
|
|||
|
false;$J=array();foreach($K
|
|||
|
as$x=>$X)$J[($x[0]=='"'?idf_unescape($x):$x)]=$X;return$J;}function
|
|||
|
fetch_row(){return$this->_result->fetch(SQLITE_NUM);}function
|
|||
|
fetch_field(){$C=$this->_result->fieldName($this->_offset++);$pf='(\\[.*]|"(?:[^"]|"")*"|(.+))';if(preg_match("~^($pf\\.)?$pf\$~",$C,$B)){$Q=($B[3]!=""?$B[3]:idf_unescape($B[2]));$C=($B[5]!=""?$B[5]:idf_unescape($B[4]));}return(object)array("name"=>$C,"orgname"=>$C,"orgtable"=>$Q,);}}}}elseif(extension_loaded("pdo_sqlite")){class
|
|||
|
Min_SQLite
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_SQLite";function
|
|||
|
Min_SQLite($Fc){$this->dsn(DRIVER.":$Fc","","");}}}if(class_exists("Min_SQLite")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_SQLite{function
|
|||
|
Min_DB(){$this->Min_SQLite(":memory:");}function
|
|||
|
select_db($Fc){if(is_readable($Fc)&&$this->query("ATTACH ".$this->quote(preg_match("~(^[/\\\\]|:)~",$Fc)?$Fc:dirname($_SERVER["SCRIPT_FILENAME"])."/$Fc")." AS a")){$this->Min_SQLite($Fc);return
|
|||
|
true;}return
|
|||
|
false;}function
|
|||
|
multi_query($H){return$this->_result=$this->query($H);}function
|
|||
|
next_result(){return
|
|||
|
false;}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$L,$zf){$Oh=array();foreach($L
|
|||
|
as$O)$Oh[]="(".implode(", ",$O).")";return
|
|||
|
queries("REPLACE INTO ".table($Q)." (".implode(", ",array_keys(reset($L))).") VALUES\n".implode(",\n",$Oh));}}function
|
|||
|
idf_escape($t){return'"'.str_replace('"','""',$t).'"';}function
|
|||
|
table($t){return
|
|||
|
idf_escape($t);}function
|
|||
|
connect(){return
|
|||
|
new
|
|||
|
Min_DB;}function
|
|||
|
get_databases(){return
|
|||
|
array();}function
|
|||
|
limit($H,$Z,$z,$D=0,$rg=" "){return" $H$Z".($z!==null?$rg."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($H,$Z){global$h;return($h->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')")?limit($H,$Z,1):" $H$Z");}function
|
|||
|
db_collation($k,$kb){global$h;return$h->result("PRAGMA encoding");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){return
|
|||
|
get_current_user();}function
|
|||
|
tables_list(){return
|
|||
|
get_key_vals("SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') ORDER BY (name = 'sqlite_sequence'), name",1);}function
|
|||
|
count_tables($j){return
|
|||
|
array();}function
|
|||
|
table_status($C=""){global$h;$J=array();foreach(get_rows("SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view') ".($C!=""?"AND name = ".q($C):"ORDER BY name"))as$K){$K["Oid"]=1;$K["Auto_increment"]="";$K["Rows"]=$h->result("SELECT COUNT(*) FROM ".idf_escape($K["Name"]));$J[$K["Name"]]=$K;}foreach(get_rows("SELECT * FROM sqlite_sequence",null,"")as$K)$J[$K["name"]]["Auto_increment"]=$K["seq"];return($C!=""?$J[$C]:$J);}function
|
|||
|
is_view($R){return$R["Engine"]=="view";}function
|
|||
|
fk_support($R){global$h;return!$h->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");}function
|
|||
|
fields($Q){global$h;$J=array();$zf="";foreach(get_rows("PRAGMA table_info(".table($Q).")")as$K){$C=$K["name"];$U=strtolower($K["type"]);$Kb=$K["dflt_value"];$J[$C]=array("field"=>$C,"type"=>(preg_match('~int~i',$U)?"integer":(preg_match('~char|clob|text~i',$U)?"text":(preg_match('~blob~i',$U)?"blob":(preg_match('~real|floa|doub~i',$U)?"real":"numeric")))),"full_type"=>$U,"default"=>(preg_match("~'(.*)'~",$Kb,$B)?str_replace("''","'",$B[1]):($Kb=="NULL"?null:$Kb)),"null"=>!$K["notnull"],"privileges"=>array("select"=>1,"insert"=>1,"update"=>1),"primary"=>$K["pk"],);if($K["pk"]){if($zf!="")$J[$zf]["auto_increment"]=false;elseif(preg_match('~^integer$~i',$U))$J[$C]["auto_increment"]=true;$zf=$C;}}$Bg=$h->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));preg_match_all('~(("[^"]*+")+|[a-z0-9_]+)\s+text\s+COLLATE\s+(\'[^\']+\'|\S+)~i',$Bg,$be,PREG_SET_ORDER);foreach($be
|
|||
|
as$B){$C=str_replace('""','"',preg_replace('~^"|"$~','',$B[1]));if($J[$C])$J[$C]["collation"]=trim($B[3],"'");}return$J;}function
|
|||
|
indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$J=array();$Bg=$i->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));if(preg_match('~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*")++)~i',$Bg,$B)){$J[""]=array("type"=>"PRIMARY","columns"=>array(),"lengths"=>array(),"descs"=>array());preg_match_all('~((("[^"]*+")+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i',$B[1],$be,PREG_SET_ORDER);foreach($be
|
|||
|
as$B){$J[""]["columns"][]=idf_unescape($B[2]).$B[4];$J[""]["descs"][]=(preg_match('~DESC~i',$B[5])?'1':null);}}if(!$J){foreach(fields($Q)as$C=>$n){if($n["primary"])$J[""]=array("type"=>"PRIMARY","columns"=>array($C),"lengths"=>array(),"descs"=>array(null));}}$Cg=get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ".q($Q),$i);foreach(get_rows("PRAGMA index_list(".table($Q).")",$i)as$K){$C=$K["name"];$u=array("type"=>($K["unique"]?"UNIQUE":"INDEX"));$u["lengths"]=array();$u["descs"]=array();foreach(get_rows("PRAGMA index_info(".idf_escape($C).")",$i)as$hg){$u["columns"][]=$hg["name"];$u["descs"][]=null;}if(preg_match('~^CREATE( UNIQUE)? INDEX '.preg_quote(idf_escape($C).' ON '.idf_escape($Q),'~').' \((.*)\)$~i',$Cg[$C],$Uf)){preg_match_all('/("[^"]*+")+( DESC)?/',$Uf[2],$be);foreach($be[2]as$x=>$X){if($X)$u["descs"][$x]='1';}}if(!$J[""]||$u["type"]!="UNIQUE"||$u["columns"]!=$J[""]["columns"]||$u["descs"]!=$J[""]["descs"]||!preg_match("~^sqlite_~",$C))$J[$C]=$u;}return$J;}function
|
|||
|
foreign_keys($Q){$J=array();foreach(get_rows("PRAGMA foreign_key_list(".table($Q).")")as$K){$p=&$J[$K["id"]];if(!$p)$p=$K;$p["source"][]=$K["from"];$p["target"][]=$K["to"];}return$J;}function
|
|||
|
view($C){global$h;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\\s+~iU','',$h->result("SELECT sql FROM sqlite_master WHERE name = ".q($C))));}function
|
|||
|
collations(){return(isset($_GET["create"])?get_vals("PRAGMA collation_list",1):array());}function
|
|||
|
information_schema($k){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
check_sqlite_name($C){global$h;$_c="db|sdb|sqlite";if(!preg_match("~^[^\\0]*\\.($_c)\$~",$C)){$h->error=lang(21,str_replace("|",", ",$_c));return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
create_database($k,$d){global$h;if(file_exists($k)){$h->error=lang(22);return
|
|||
|
false;}if(!check_sqlite_name($k))return
|
|||
|
false;try{$_=new
|
|||
|
Min_SQLite($k);}catch(Exception$rc){$h->error=$rc->getMessage();return
|
|||
|
false;}$_->query('PRAGMA encoding = "UTF-8"');$_->query('CREATE TABLE adminer (i)');$_->query('DROP TABLE adminer');return
|
|||
|
true;}function
|
|||
|
drop_databases($j){global$h;$h->Min_SQLite(":memory:");foreach($j
|
|||
|
as$k){if(!@unlink($k)){$h->error=lang(22);return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
rename_database($C,$d){global$h;if(!check_sqlite_name($C))return
|
|||
|
false;$h->Min_SQLite(":memory:");$h->error=lang(22);return@rename(DB,$C);}function
|
|||
|
auto_increment(){return" PRIMARY KEY".(DRIVER=="sqlite"?" AUTOINCREMENT":"");}function
|
|||
|
alter_table($Q,$C,$o,$Jc,$ob,$kc,$d,$Ka,$kf){$Ih=($Q==""||$Jc);foreach($o
|
|||
|
as$n){if($n[0]!=""||!$n[1]||$n[2]){$Ih=true;break;}}$c=array();$bf=array();foreach($o
|
|||
|
as$n){if($n[1]){$c[]=($Ih?$n[1]:"ADD ".implode($n[1]));if($n[0]!="")$bf[$n[0]]=$n[1][0];}}if(!$Ih){foreach($c
|
|||
|
as$X){if(!queries("ALTER TABLE ".table($Q)." $X"))return
|
|||
|
false;}if($Q!=$C&&!queries("ALTER TABLE ".table($Q)." RENAME TO ".table($C)))return
|
|||
|
false;}elseif(!recreate_table($Q,$C,$c,$bf,$Jc))return
|
|||
|
false;if($Ka)queries("UPDATE sqlite_sequence SET seq = $Ka WHERE name = ".q($C));return
|
|||
|
true;}function
|
|||
|
recreate_table($Q,$C,$o,$bf,$Jc,$v=array()){if($Q!=""){if(!$o){foreach(fields($Q)as$x=>$n){$o[]=process_field($n,$n);$bf[$x]=idf_escape($x);}}$_f=false;foreach($o
|
|||
|
as$n){if($n[6])$_f=true;}$Xb=array();foreach($v
|
|||
|
as$x=>$X){if($X[2]=="DROP"){$Xb[$X[1]]=true;unset($v[$x]);}}foreach(indexes($Q)as$Gd=>$u){$f=array();foreach($u["columns"]as$x=>$e){if(!$bf[$e])continue
|
|||
|
2;$f[]=$bf[$e].($u["descs"][$x]?" DESC":"");}if(!$Xb[$Gd]){if($u["type"]!="PRIMARY"||!$_f)$v[]=array($u["type"],$Gd,$f);}}foreach($v
|
|||
|
as$x=>$X){if($X[0]=="PRIMARY"){unset($v[$x]);$Jc[]=" PRIMARY KEY (".implode(", ",$X[2]).")";}}foreach(foreign_keys($Q)as$Gd=>$p){foreach($p["source"]as$x=>$e){if(!$bf[$e])continue
|
|||
|
2;$p["source"][$x]=idf_unescape($bf[$e]);}if(!isset($Jc[" $Gd"]))$Jc[]=" ".format_foreign_key($p);}queries("BEGIN");}foreach($o
|
|||
|
as$x=>$n)$o[$x]=" ".implode($n);$o=array_merge($o,array_filter($Jc));if(!queries("CREATE TABLE ".table($Q!=""?"adminer_$C":$C)." (\n".implode(",\n",$o)."\n)"))return
|
|||
|
false;if($Q!=""){if($bf&&!queries("INSERT INTO ".table("adminer_$C")." (".implode(", ",$bf).") SELECT ".implode(", ",array_map('idf_escape',array_keys($bf)))." FROM ".table($Q)))return
|
|||
|
false;$vh=array();foreach(triggers($Q)as$th=>$gh){$sh=trigger($th);$vh[]="CREATE TRIGGER ".idf_escape($th)." ".implode(" ",$gh)." ON ".table($C)."\n$sh[Statement]";}if(!queries("DROP TABLE ".table($Q)))return
|
|||
|
false;queries("ALTER TABLE ".table("adminer_$C")." RENAME TO ".table($C));if(!alter_indexes($C,$v))return
|
|||
|
false;foreach($vh
|
|||
|
as$sh){if(!queries($sh))return
|
|||
|
false;}queries("COMMIT");}return
|
|||
|
true;}function
|
|||
|
index_sql($Q,$U,$C,$f){return"CREATE $U ".($U!="INDEX"?"INDEX ":"").idf_escape($C!=""?$C:uniqid($Q."_"))." ON ".table($Q)." $f";}function
|
|||
|
alter_indexes($Q,$c){foreach($c
|
|||
|
as$zf){if($zf[0]=="PRIMARY")return
|
|||
|
recreate_table($Q,$Q,array(),array(),array(),$c);}foreach(array_reverse($c)as$X){if(!queries($X[2]=="DROP"?"DROP INDEX ".idf_escape($X[1]):index_sql($Q,$X[0],$X[1],"(".implode(", ",$X[2]).")")))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("DELETE FROM",$S);}function
|
|||
|
drop_views($Th){return
|
|||
|
apply_queries("DROP VIEW",$Th);}function
|
|||
|
drop_tables($S){return
|
|||
|
apply_queries("DROP TABLE",$S);}function
|
|||
|
move_tables($S,$Th,$Xg){return
|
|||
|
false;}function
|
|||
|
trigger($C){global$h;if($C=="")return
|
|||
|
array("Statement"=>"BEGIN\n\t;\nEND");$t='(?:[^`"\\s]+|`[^`]*`|"[^"]*")+';$uh=trigger_options();preg_match("~^CREATE\\s+TRIGGER\\s*$t\\s*(".implode("|",$uh["Timing"]).")\\s+([a-z]+)(?:\\s+OF\\s+($t))?\\s+ON\\s*$t\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is",$h->result("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ".q($C)),$B);$De=$B[3];return
|
|||
|
array("Timing"=>strtoupper($B[1]),"Event"=>strtoupper($B[2]).($De?" OF":""),"Of"=>($De[0]=='`'||$De[0]=='"'?idf_unescape($De):$De),"Trigger"=>$C,"Statement"=>$B[4],);}function
|
|||
|
triggers($Q){$J=array();$uh=trigger_options();foreach(get_rows("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q))as$K){preg_match('~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*('.implode("|",$uh["Timing"]).')\\s*(.*)\\s+ON\\b~iU',$K["sql"],$B);$J[$K["name"]]=array($B[1],$B[2]);}return$J;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER","INSTEAD OF"),"Event"=>array("INSERT","UPDATE","UPDATE OF","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
|
|||
|
routine($C,$U){}function
|
|||
|
routines(){}function
|
|||
|
routine_languages(){}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN");}function
|
|||
|
last_id(){global$h;return$h->result("SELECT LAST_INSERT_ROWID()");}function
|
|||
|
explain($h,$H){return$h->query("EXPLAIN $H");}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($lg){return
|
|||
|
true;}function
|
|||
|
create_sql($Q,$Ka){global$h;$J=$h->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = ".q($Q));foreach(indexes($Q)as$C=>$u){if($C=='')continue;$J.=";\n\n".index_sql($Q,$u['type'],$C,"(".implode(", ",array_map('idf_escape',$u['columns'])).")");}return$J;}function
|
|||
|
truncate_sql($Q){return"DELETE FROM ".table($Q);}function
|
|||
|
use_sql($Fb){}function
|
|||
|
trigger_sql($Q,$Ig){return
|
|||
|
implode(get_vals("SELECT sql || ';;\n' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q)));}function
|
|||
|
show_variables(){global$h;$J=array();foreach(array("auto_vacuum","cache_size","count_changes","default_cache_size","empty_result_callbacks","encoding","foreign_keys","full_column_names","fullfsync","journal_mode","journal_size_limit","legacy_file_format","locking_mode","page_size","max_page_count","read_uncommitted","recursive_triggers","reverse_unordered_selects","secure_delete","short_column_names","synchronous","temp_store","temp_store_directory","schema_version","integrity_check","quick_check")as$x)$J[$x]=$h->result("PRAGMA $x");return$J;}function
|
|||
|
show_status(){$J=array();foreach(get_vals("PRAGMA compile_options")as$Qe){list($x,$X)=explode("=",$Qe,2);$J[$x]=$X;}return$J;}function
|
|||
|
convert_field($n){}function
|
|||
|
unconvert_field($n,$J){return$J;}function
|
|||
|
support($Cc){return
|
|||
|
preg_match('~^(columns|database|drop_col|dump|indexes|move_col|sql|status|table|trigger|variables|view|view_trigger)$~',$Cc);}$w="sqlite";$yh=array("integer"=>0,"real"=>0,"numeric"=>0,"text"=>0,"blob"=>0);$Hg=array_keys($yh);$Eh=array();$Oe=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$Sc=array("hex","length","lower","round","unixepoch","upper");$Xc=array("avg","count","count distinct","group_concat","max","min","sum");$cc=array(array(),array("integer|real|numeric"=>"+/-","text"=>"||",));}$Ub["pgsql"]="PostgreSQL";if(isset($_GET["pgsql"])){$wf=array("PgSQL","PDO_PgSQL");define("DRIVER","pgsql");if(extension_loaded("pgsql")){class
|
|||
|
Min_DB{var$extension="PgSQL",$_link,$_result,$_string,$_database=true,$server_info,$affected_rows,$error;function
|
|||
|
_error($nc,$m){if(ini_bool("html_errors"))$m=html_entity_decode(strip_tags($m));$m=preg_replace('~^[^:]*: ~','',$m);$this->error=$m;}function
|
|||
|
connect($N,$V,$G){global$b;$k=$b->database();set_error_handler(array($this,'_error'));$this->_string="host='".str_replace(":","' port='",addcslashes($N,"'\\"))."' user='".addcslashes($V,"'\\")."' password='".addcslashes($G,"'\\")."'";$this->_link=@pg_connect("$this->_string dbname='".($k!=""?addcslashes($k,"'\\"):"postgres")."'",PGSQL_CONNECT_FORCE_NEW);if(!$this->_link&&$k!=""){$this->_database=false;$this->_link=@pg_connect("$this->_string dbname='postgres'",PGSQL_CONNECT_FORCE_NEW);}restore_error_handler();if($this->_link){$Rh=pg_version($this->_link);$this->server_info=$Rh["server"];pg_set_client_encoding($this->_link,"UTF8");}return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".pg_escape_string($this->_link,$P)."'";}function
|
|||
|
select_db($Fb){global$b;if($Fb==$b->database())return$this->_database;$J=@pg_connect("$this->_string dbname='".addcslashes($Fb,"'\\")."'",PGSQL_CONNECT_FORCE_NEW);if($J)$this->_link=$J;return$J;}function
|
|||
|
close(){$this->_link=@pg_connect("$this->_string dbname='postgres'");}function
|
|||
|
query($H,$zh=false){$I=@pg_query($this->_link,$H);$this->error="";if(!$I){$this->error=pg_last_error($this->_link);return
|
|||
|
false;}elseif(!pg_num_fields($I)){$this->affected_rows=pg_affected_rows($I);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($I);}function
|
|||
|
multi_query($H){return$this->_result=$this->query($H);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!$I||!$I->num_rows)return
|
|||
|
false;return
|
|||
|
pg_fetch_result($I->_result,0,$n);}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
Min_Result($I){$this->_result=$I;$this->num_rows=pg_num_rows($I);}function
|
|||
|
fetch_assoc(){return
|
|||
|
pg_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
pg_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$e=$this->_offset++;$J=new
|
|||
|
stdClass;if(function_exists('pg_field_table'))$J->orgtable=pg_field_table($this->_result,$e);$J->name=pg_field_name($this->_result,$e);$J->orgname=$J->name;$J->type=pg_field_type($this->_result,$e);$J->charsetnr=($J->type=="bytea"?63:0);return$J;}function
|
|||
|
__destruct(){pg_free_result($this->_result);}}}elseif(extension_loaded("pdo_pgsql")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_PgSQL";function
|
|||
|
connect($N,$V,$G){global$b;$k=$b->database();$P="pgsql:host='".str_replace(":","' port='",addcslashes($N,"'\\"))."' options='-c client_encoding=utf8'";$this->dsn("$P dbname='".($k!=""?addcslashes($k,"'\\"):"postgres")."'",$V,$G);return
|
|||
|
true;}function
|
|||
|
select_db($Fb){global$b;return($b->database()==$Fb);}function
|
|||
|
close(){}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$L,$zf){global$h;foreach($L
|
|||
|
as$O){$Fh=array();$Z=array();foreach($O
|
|||
|
as$x=>$X){$Fh[]="$x = $X";if(isset($zf[idf_unescape($x)]))$Z[]="$x = $X";}if(!(($Z&&queries("UPDATE ".table($Q)." SET ".implode(", ",$Fh)." WHERE ".implode(" AND ",$Z))&&$h->affected_rows)||queries("INSERT INTO ".table($Q)." (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).")")))return
|
|||
|
false;}return
|
|||
|
true;}}function
|
|||
|
idf_escape($t){return'"'.str_replace('"','""',$t).'"';}function
|
|||
|
table($t){return
|
|||
|
idf_escape($t);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Bb=$b->credentials();if($h->connect($Bb[0],$Bb[1],$Bb[2])){if($h->server_info>=9)$h->query("SET application_name = 'Adminer'");return$h;}return$h->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT datname FROM pg_database ORDER BY datname");}function
|
|||
|
limit($H,$Z,$z,$D=0,$rg=" "){return" $H$Z".($z!==null?$rg."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($H,$Z){return" $H$Z";}function
|
|||
|
db_collation($k,$kb){global$h;return$h->result("SHOW LC_COLLATE");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT user");}function
|
|||
|
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
|
|||
|
count_tables($j){return
|
|||
|
array();}function
|
|||
|
table_status($C=""){$J=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\"
|
|||
|
FROM pg_class
|
|||
|
WHERE relkind IN ('r','v')
|
|||
|
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())
|
|||
|
".($C!=""?"AND relname = ".q($C):"ORDER BY relname"))as$K)$J[$K["Name"]]=$K;return($C!=""?$J[$C]:$J);}function
|
|||
|
is_view($R){return$R["Engine"]=="view";}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$J=array();$Ba=array('timestamp without time zone'=>'timestamp','timestamp with time zone'=>'timestamptz',);foreach(get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull::int, col_description(c.oid, a.attnum) AS comment
|
|||
|
FROM pg_class c
|
|||
|
JOIN pg_namespace n ON c.relnamespace = n.oid
|
|||
|
JOIN pg_attribute a ON c.oid = a.attrelid
|
|||
|
LEFT JOIN pg_attrdef d ON c.oid = d.adrelid AND a.attnum = d.adnum
|
|||
|
WHERE c.relname = ".q($Q)."
|
|||
|
AND n.nspname = current_schema()
|
|||
|
AND NOT a.attisdropped
|
|||
|
AND a.attnum > 0
|
|||
|
ORDER BY a.attnum")as$K){preg_match('~([^([]+)(\((.*)\))?((\[[0-9]*])*)$~',$K["full_type"],$B);list(,$U,$y,$K["length"],$Ea)=$B;$K["length"].=$Ea;$K["type"]=($Ba[$U]?$Ba[$U]:$U);$K["full_type"]=$K["type"].$y.$Ea;$K["null"]=!$K["attnotnull"];$K["auto_increment"]=preg_match('~^nextval\\(~i',$K["default"]);$K["privileges"]=array("insert"=>1,"select"=>1,"update"=>1);if(preg_match('~(.+)::[^)]+(.*)~',$K["default"],$B))$K["default"]=($B[1][0]=="'"?idf_unescape($B[1]):$B[1]).$B[2];$J[$K["field"]]=$K;}return$J;}function
|
|||
|
indexes($Q,$i=null){global$h;if(!is_object($i))$i=$h;$J=array();$Qg=$i->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = ".q($Q));$f=get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Qg AND attnum > 0",$i);foreach(get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption FROM pg_index i, pg_class ci WHERE i.indrelid = $Qg AND ci.oid = i.indexrelid",$i)as$K){$Vf=$K["relname"];$J[$Vf]["type"]=($K["indisprimary"]?"PRIMARY":($K["indisunique"]?"UNIQUE":"INDEX"));$J[$Vf]["columns"]=array();foreach(explode(" ",$K["indkey"])as$nd)$J[$Vf]["columns"][]=$f[$nd];$J[$Vf]["descs"]=array();foreach(explode(" ",$K["indoption"])as$od)$J[$Vf]["descs"][]=($od&1?'1':null);$J[$Vf]["lengths"]=array();}return$J;}function
|
|||
|
foreign_keys($Q){global$Ke;$J=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($Q)." AND pn.nspname = current_schema())
|
|||
|
AND contype = 'f'::char
|
|||
|
ORDER BY conkey, conname")as$K){if(preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA',$K['definition'],$B)){$K['source']=array_map('trim',explode(',',$B[1]));if(preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~',$B[2],$ae)){$K['ns']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$ae[2]));$K['table']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$ae[4]));}$K['target']=array_map('trim',explode(',',$B[3]));$K['on_delete']=(preg_match("~ON DELETE ($Ke)~",$B[4],$ae)?$ae[1]:'NO ACTION');$K['on_update']=(preg_match("~ON UPDATE ($Ke)~",$B[4],$ae)?$ae[1]:'NO ACTION');$J[$K['conname']]=$K;}}return$J;}function
|
|||
|
view($C){global$h;return
|
|||
|
array("select"=>$h->result("SELECT pg_get_viewdef(".q($C).")"));}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($k){return($k=="information_schema");}function
|
|||
|
error(){global$h;$J=h($h->error);if(preg_match('~^(.*\\n)?([^\\n]*)\\n( *)\\^(\\n.*)?$~s',$J,$B))$J=$B[1].preg_replace('~((?:[^&]|&[^;]*;){'.strlen($B[3]).'})(.*)~','\\1<b>\\2</b>',$B[2]).$B[4];return
|
|||
|
nl_br($J);}function
|
|||
|
create_database($k,$d){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($k).($d?" ENCODING ".idf_escape($d):""));}function
|
|||
|
drop_databases($j){global$h;$h->close();return
|
|||
|
apply_queries("DROP DATABASE",$j,'idf_escape');}function
|
|||
|
rename_database($C,$d){return
|
|||
|
queries("ALTER DATABASE ".idf_escape(DB)." RENAME TO ".idf_escape($C));}function
|
|||
|
auto_increment(){return"";}function
|
|||
|
alter_table($Q,$C,$o,$Jc,$ob,$kc,$d,$Ka,$kf){$c=array();$If=array();foreach($o
|
|||
|
as$n){$e=idf_escape($n[0]);$X=$n[1];if(!$X)$c[]="DROP $e";else{$Nh=$X[5];unset($X[5]);if(isset($X[6])&&$n[0]=="")$X[1]=($X[1]=="bigint"?" big":" ")."serial";if($n[0]=="")$c[]=($Q!=""?"ADD ":" ").implode($X);else{if($e!=$X[0])$If[]="ALTER TABLE ".table($Q)." RENAME $e TO $X[0]";$c[]="ALTER $e TYPE$X[1]";if(!$X[6]){$c[]="ALTER $e ".($X[3]?"SET$X[3]":"DROP DEFAULT");$c[]="ALTER $e ".($X[2]==" NULL"?"DROP NOT":"SET").$X[2];}}if($n[0]!=""||$Nh!="")$If[]="COMMENT ON COLUMN ".table($Q).".$X[0] IS ".($Nh!=""?substr($Nh,9):"''");}}$c=array_merge($c,$Jc);if($Q=="")array_unshift($If,"CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");elseif($c)array_unshift($If,"ALTER TABLE ".table($Q)."\n".implode(",\n",$c));if($Q!=""&&$Q!=$C)$If[]="ALTER TABLE ".table($Q)." RENAME TO ".table($C);if($Q!=""||$ob!="")$If[]="COMMENT ON TABLE ".table($C)." IS ".q($ob);if($Ka!=""){}foreach($If
|
|||
|
as$H){if(!queries($H))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($Q,$c){$zb=array();$Vb=array();$If=array();foreach($c
|
|||
|
as$X){if($X[0]!="INDEX")$zb[]=($X[2]=="DROP"?"\nDROP CONSTRAINT ".idf_escape($X[1]):"\nADD".($X[1]!=""?" CONSTRAINT ".idf_escape($X[1]):"")." $X[0] ".($X[0]=="PRIMARY"?"KEY ":"")."(".implode(", ",$X[2]).")");elseif($X[2]=="DROP")$Vb[]=idf_escape($X[1]);else$If[]="CREATE INDEX ".idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q)." (".implode(", ",$X[2]).")";}if($zb)array_unshift($If,"ALTER TABLE ".table($Q).implode(",",$zb));if($Vb)array_unshift($If,"DROP INDEX ".implode(", ",$Vb));foreach($If
|
|||
|
as$H){if(!queries($H))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){return
|
|||
|
queries("TRUNCATE ".implode(", ",array_map('table',$S)));return
|
|||
|
true;}function
|
|||
|
drop_views($Th){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$Th)));}function
|
|||
|
drop_tables($S){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
|
|||
|
move_tables($S,$Th,$Xg){foreach($S
|
|||
|
as$Q){if(!queries("ALTER TABLE ".table($Q)." SET SCHEMA ".idf_escape($Xg)))return
|
|||
|
false;}foreach($Th
|
|||
|
as$Q){if(!queries("ALTER VIEW ".table($Q)." SET SCHEMA ".idf_escape($Xg)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($C){if($C=="")return
|
|||
|
array("Statement"=>"EXECUTE PROCEDURE ()");$L=get_rows('SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", \'FOR EACH \' || action_orientation AS "Type", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = '.q($_GET["trigger"]).' AND trigger_name = '.q($C));return
|
|||
|
reset($L);}function
|
|||
|
triggers($Q){$J=array();foreach(get_rows("SELECT * FROM information_schema.triggers WHERE event_object_table = ".q($Q))as$K)$J[$K["trigger_name"]]=array($K["condition_timing"],$K["event_manipulation"]);return$J;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW","FOR EACH STATEMENT"),);}function
|
|||
|
routines(){return
|
|||
|
get_rows('SELECT p.proname AS "ROUTINE_NAME", p.proargtypes AS "ROUTINE_TYPE", pg_catalog.format_type(p.prorettype, NULL) AS "DTD_IDENTIFIER"
|
|||
|
FROM pg_catalog.pg_namespace n
|
|||
|
JOIN pg_catalog.pg_proc p ON p.pronamespace = n.oid
|
|||
|
WHERE n.nspname = current_schema()
|
|||
|
ORDER BY p.proname');}function
|
|||
|
routine_languages(){return
|
|||
|
get_vals("SELECT langname FROM pg_catalog.pg_language");}function
|
|||
|
last_id(){return
|
|||
|
0;}function
|
|||
|
explain($h,$H){return$h->query("EXPLAIN $H");}function
|
|||
|
found_rows($R,$Z){global$h;if(preg_match("~ rows=([0-9]+)~",$h->result("EXPLAIN SELECT * FROM ".idf_escape($R["Name"]).($Z?" WHERE ".implode(" AND ",$Z):"")),$Uf))return$Uf[1];return
|
|||
|
false;}function
|
|||
|
types(){return
|
|||
|
get_vals("SELECT typname
|
|||
|
FROM pg_type
|
|||
|
WHERE typnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())
|
|||
|
AND typtype IN ('b','d','e')
|
|||
|
AND typelem = 0");}function
|
|||
|
schemas(){return
|
|||
|
get_vals("SELECT nspname FROM pg_namespace ORDER BY nspname");}function
|
|||
|
get_schema(){global$h;return$h->result("SELECT current_schema()");}function
|
|||
|
set_schema($kg){global$h,$yh,$Hg;$J=$h->query("SET search_path TO ".idf_escape($kg));foreach(types()as$U){if(!isset($yh[$U])){$yh[$U]=0;$Hg[lang(23)][]=$U;}}return$J;}function
|
|||
|
use_sql($Fb){return"\connect ".idf_escape($Fb);}function
|
|||
|
show_variables(){return
|
|||
|
get_key_vals("SHOW ALL");}function
|
|||
|
process_list(){global$h;return
|
|||
|
get_rows("SELECT * FROM pg_stat_activity ORDER BY ".($h->server_info<9.2?"procpid":"pid"));}function
|
|||
|
show_status(){}function
|
|||
|
convert_field($n){}function
|
|||
|
unconvert_field($n,$J){return$J;}function
|
|||
|
support($Cc){return
|
|||
|
preg_match('~^(database|table|columns|sql|indexes|comment|view|scheme|processlist|sequence|trigger|type|variables|drop_col)$~',$Cc);}$w="pgsql";$yh=array();$Hg=array();foreach(array(lang(24)=>array("smallint"=>5,"integer"=>10,"bigint"=>19,"boolean"=>1,"numeric"=>0,"real"=>7,"double precision"=>16,"money"=>20),lang(25)=>array("date"=>13,"time"=>17,"timestamp"=>20,"timestamptz"=>21,"interval"=>0),lang(26)=>array("character"=>0,"character varying"=>0,"text"=>0,"tsquery"=>0,"tsvector"=>0,"uuid"=>0,"xml"=>0),lang(27)=>array("bit"=>0,"bit varying"=>0,"bytea"=>0),lang(28)=>array("cidr"=>43,"inet"=>43,"macaddr"=>17,"txid_snapshot"=>0),lang(29)=>array("box"=>0,"circle"=>0,"line"=>0,"lseg"=>0,"path"=>0,"point"=>0,"polygon"=>0),)as$x=>$X){$yh+=$X;$Hg[$x]=array_keys($X);}$Eh=array();$Oe=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$Sc=array("char_length","lower","round","to_hex","to_timestamp","upper");$Xc=array("avg","count","count distinct","max","min","sum");$cc=array(array("char"=>"md5","date|time"=>"now",),array("int|numeric|real|money"=>"+/-","date|time"=>"+ interval/- interval","char|text"=>"||",));}$Ub["oracle"]="Oracle";if(isset($_GET["oracle"])){$wf=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($nc,$m){if(ini_bool("html_errors"))$m=html_entity_decode(strip_tags($m));$m=preg_replace('~^[^:]*: ~','',$m);$this->error=$m;}function
|
|||
|
connect($N,$V,$G){$this->_link=@oci_new_connect($V,$G,$N,"AL32UTF8");if($this->_link){$this->server_info=oci_server_version($this->_link);return
|
|||
|
true;}$m=oci_error();$this->error=$m["message"];return
|
|||
|
false;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($Fb){return
|
|||
|
true;}function
|
|||
|
query($H,$zh=false){$I=oci_parse($this->_link,$H);$this->error="";if(!$I){$m=oci_error($this->_link);$this->errno=$m["code"];$this->error=$m["message"];return
|
|||
|
false;}set_error_handler(array($this,'_error'));$J=@oci_execute($I);restore_error_handler();if($J){if(oci_num_fields($I))return
|
|||
|
new
|
|||
|
Min_Result($I);$this->affected_rows=oci_num_rows($I);}return$J;}function
|
|||
|
multi_query($H){return$this->_result=$this->query($H);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($H,$n=1){$I=$this->query($H);if(!is_object($I)||!oci_fetch($I->_result))return
|
|||
|
false;return
|
|||
|
oci_result($I->_result,$n);}}class
|
|||
|
Min_Result{var$_result,$_offset=1,$num_rows;function
|
|||
|
Min_Result($I){$this->_result=$I;}function
|
|||
|
_convert($K){foreach((array)$K
|
|||
|
as$x=>$X){if(is_a($X,'OCI-Lob'))$K[$x]=$X->load();}return$K;}function
|
|||
|
fetch_assoc(){return$this->_convert(oci_fetch_assoc($this->_result));}function
|
|||
|
fetch_row(){return$this->_convert(oci_fetch_row($this->_result));}function
|
|||
|
fetch_field(){$e=$this->_offset++;$J=new
|
|||
|
stdClass;$J->name=oci_field_name($this->_result,$e);$J->orgname=$J->name;$J->type=oci_field_type($this->_result,$e);$J->charsetnr=(preg_match("~raw|blob|bfile~",$J->type)?63:0);return$J;}function
|
|||
|
__destruct(){oci_free_statement($this->_result);}}}elseif(extension_loaded("pdo_oci")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_OCI";function
|
|||
|
connect($N,$V,$G){$this->dsn("oci:dbname=//$N;charset=AL32UTF8",$V,$G);return
|
|||
|
true;}function
|
|||
|
select_db($Fb){return
|
|||
|
true;}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
begin(){return
|
|||
|
true;}}function
|
|||
|
idf_escape($t){return'"'.str_replace('"','""',$t).'"';}function
|
|||
|
table($t){return
|
|||
|
idf_escape($t);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Bb=$b->credentials();if($h->connect($Bb[0],$Bb[1],$Bb[2]))return$h;return$h->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT tablespace_name FROM user_tablespaces");}function
|
|||
|
limit($H,$Z,$z,$D=0,$rg=" "){return($D?" * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $H$Z) t WHERE rownum <= ".($z+$D).") WHERE rnum > $D":($z!==null?" * FROM (SELECT $H$Z) WHERE rownum <= ".($z+$D):" $H$Z"));}function
|
|||
|
limit1($H,$Z){return" $H$Z";}function
|
|||
|
db_collation($k,$kb){global$h;return$h->result("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT USER FROM DUAL");}function
|
|||
|
tables_list(){return
|
|||
|
get_key_vals("SELECT table_name, 'table' FROM all_tables WHERE tablespace_name = ".q(DB)."
|
|||
|
UNION SELECT view_name, 'view' FROM user_views
|
|||
|
ORDER BY 1");}function
|
|||
|
count_tables($j){return
|
|||
|
array();}function
|
|||
|
table_status($C=""){$J=array();$mg=q($C);foreach(get_rows('SELECT table_name "Name", \'table\' "Engine", avg_row_len * num_rows "Data_length", num_rows "Rows" FROM all_tables WHERE tablespace_name = '.q(DB).($C!=""?" AND table_name = $mg":"")."
|
|||
|
UNION SELECT view_name, 'view', 0, 0 FROM user_views".($C!=""?" WHERE view_name = $mg":"")."
|
|||
|
ORDER BY 1")as$K){if($C!="")return$K;$J[$K["Name"]]=$K;}return$J;}function
|
|||
|
is_view($R){return$R["Engine"]=="view";}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$J=array();foreach(get_rows("SELECT * FROM all_tab_columns WHERE table_name = ".q($Q)." ORDER BY column_id")as$K){$U=$K["DATA_TYPE"];$y="$K[DATA_PRECISION],$K[DATA_SCALE]";if($y==",")$y=$K["DATA_LENGTH"];$J[$K["COLUMN_NAME"]]=array("field"=>$K["COLUMN_NAME"],"full_type"=>$U.($y?"($y)":""),"type"=>strtolower($U),"length"=>$y,"default"=>$K["DATA_DEFAULT"],"null"=>($K["NULLABLE"]=="Y"),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);}return$J;}function
|
|||
|
indexes($Q,$i=null){$J=array();foreach(get_rows("SELECT uic.*, uc.constraint_type
|
|||
|
FROM user_ind_columns uic
|
|||
|
LEFT JOIN user_constraints uc ON uic.index_name = uc.constraint_name AND uic.table_name = uc.table_name
|
|||
|
WHERE uic.table_name = ".q($Q)."
|
|||
|
ORDER BY uc.constraint_type, uic.column_position",$i)as$K){$ld=$K["INDEX_NAME"];$J[$ld]["type"]=($K["CONSTRAINT_TYPE"]=="P"?"PRIMARY":($K["CONSTRAINT_TYPE"]=="U"?"UNIQUE":"INDEX"));$J[$ld]["columns"][]=$K["COLUMN_NAME"];$J[$ld]["lengths"][]=($K["CHAR_LENGTH"]&&$K["CHAR_LENGTH"]!=$K["COLUMN_LENGTH"]?$K["CHAR_LENGTH"]:null);$J[$ld]["descs"][]=($K["DESCEND"]?'1':null);}return$J;}function
|
|||
|
view($C){$L=get_rows('SELECT text "select" FROM user_views WHERE view_name = '.q($C));return
|
|||
|
reset($L);}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($k){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
explain($h,$H){$h->query("EXPLAIN PLAN FOR $H");return$h->query("SELECT * FROM plan_table");}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
alter_table($Q,$C,$o,$Jc,$ob,$kc,$d,$Ka,$kf){$c=$Vb=array();foreach($o
|
|||
|
as$n){$X=$n[1];if($X&&$n[0]!=""&&idf_escape($n[0])!=$X[0])queries("ALTER TABLE ".table($Q)." RENAME COLUMN ".idf_escape($n[0])." TO $X[0]");if($X)$c[]=($Q!=""?($n[0]!=""?"MODIFY (":"ADD ("):" ").implode($X).($Q!=""?")":"");else$Vb[]=idf_escape($n[0]);}if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");return(!$c||queries("ALTER TABLE ".table($Q)."\n".implode("\n",$c)))&&(!$Vb||queries("ALTER TABLE ".table($Q)." DROP (".implode(", ",$Vb).")"))&&($Q==$C||queries("ALTER TABLE ".table($Q)." RENAME TO ".table($C)));}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($Th){return
|
|||
|
apply_queries("DROP VIEW",$Th);}function
|
|||
|
drop_tables($S){return
|
|||
|
apply_queries("DROP TABLE",$S);}function
|
|||
|
last_id(){return
|
|||
|
0;}function
|
|||
|
schemas(){return
|
|||
|
get_vals("SELECT DISTINCT owner FROM dba_segments WHERE owner IN (SELECT username FROM dba_users WHERE default_tablespace NOT IN ('SYSTEM','SYSAUX'))");}function
|
|||
|
get_schema(){global$h;return$h->result("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual");}function
|
|||
|
set_schema($lg){global$h;return$h->query("ALTER SESSION SET CURRENT_SCHEMA = ".idf_escape($lg));}function
|
|||
|
show_variables(){return
|
|||
|
get_key_vals('SELECT name, display_value FROM v$parameter');}function
|
|||
|
process_list(){return
|
|||
|
get_rows('SELECT sess.process AS "process", sess.username AS "user", sess.schemaname AS "schema", sess.status AS "status", sess.wait_class AS "wait_class", sess.seconds_in_wait AS "seconds_in_wait", sql.sql_text AS "sql_text", sess.machine AS "machine", sess.port AS "port"
|
|||
|
FROM v$session sess LEFT OUTER JOIN v$sql sql
|
|||
|
ON sql.sql_id = sess.sql_id
|
|||
|
WHERE sess.type = \'USER\'
|
|||
|
ORDER BY PROCESS
|
|||
|
');}function
|
|||
|
show_status(){$L=get_rows('SELECT * FROM v$instance');return
|
|||
|
reset($L);}function
|
|||
|
convert_field($n){}function
|
|||
|
unconvert_field($n,$J){return$J;}function
|
|||
|
support($Cc){return
|
|||
|
preg_match('~^(columns|database|drop_col|indexes|processlist|scheme|sql|status|table|variables|view|view_trigger)$~',$Cc);}$w="oracle";$yh=array();$Hg=array();foreach(array(lang(24)=>array("number"=>38,"binary_float"=>12,"binary_double"=>21),lang(25)=>array("date"=>10,"timestamp"=>29,"interval year"=>12,"interval day"=>28),lang(26)=>array("char"=>2000,"varchar2"=>4000,"nchar"=>2000,"nvarchar2"=>4000,"clob"=>4294967295,"nclob"=>4294967295),lang(27)=>array("raw"=>2000,"long raw"=>2147483648,"blob"=>4294967295,"bfile"=>4294967296),)as$x=>$X){$yh+=$X;$Hg[$x]=array_keys($X);}$Eh=array();$Oe=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$Sc=array("length","lower","round","upper");$Xc=array("avg","count","count distinct","max","min","sum");$cc=array(array("date"=>"current_date","timestamp"=>"current_timestamp",),array("number|float|double"=>"+/-","date|timestamp"=>"+ interval/- interval","char|clob"=>"||",));}$Ub["mssql"]="MS SQL";if(isset($_GET["mssql"])){$wf=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$m){$this->errno=$m["code"];$this->error.="$m[message]\n";}$this->error=rtrim($this->error);}function
|
|||
|
connect($N,$V,$G){$this->_link=@sqlsrv_connect($N,array("UID"=>$V,"PWD"=>$G,"CharacterSet"=>"UTF-8"));if($this->_link){$pd=sqlsrv_server_info($this->_link);$this->server_info=$pd['SQLServerVersion'];}else$this->_get_error();return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($Fb){return$this->query("USE ".idf_escape($Fb));}function
|
|||
|
query($H,$zh=false){$I=sqlsrv_query($this->_link,$H);$this->error="";if(!$I){$this->_get_error();return
|
|||
|
false;}return$this->store_result($I);}function
|
|||
|
multi_query($H){$this->_result=sqlsrv_query($this->_link,$H);$this->error="";if(!$this->_result){$this->_get_error();return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
store_result($I=null){if(!$I)$I=$this->_result;if(sqlsrv_field_metadata($I))return
|
|||
|
new
|
|||
|
Min_Result($I);$this->affected_rows=sqlsrv_rows_affected($I);return
|
|||
|
true;}function
|
|||
|
next_result(){return
|
|||
|
sqlsrv_next_result($this->_result);}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!is_object($I))return
|
|||
|
false;$K=$I->fetch_row();return$K[$n];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
Min_Result($I){$this->_result=$I;}function
|
|||
|
_convert($K){foreach((array)$K
|
|||
|
as$x=>$X){if(is_a($X,'DateTime'))$K[$x]=$X->format("Y-m-d H:i:s");}return$K;}function
|
|||
|
fetch_assoc(){return$this->_convert(sqlsrv_fetch_array($this->_result,SQLSRV_FETCH_ASSOC,SQLSRV_SCROLL_NEXT));}function
|
|||
|
fetch_row(){return$this->_convert(sqlsrv_fetch_array($this->_result,SQLSRV_FETCH_NUMERIC,SQLSRV_SCROLL_NEXT));}function
|
|||
|
fetch_field(){if(!$this->_fields)$this->_fields=sqlsrv_field_metadata($this->_result);$n=$this->_fields[$this->_offset++];$J=new
|
|||
|
stdClass;$J->name=$n["Name"];$J->orgname=$n["Name"];$J->type=($n["Type"]==1?254:0);return$J;}function
|
|||
|
seek($D){for($r=0;$r<$D;$r++)sqlsrv_fetch($this->_result);}function
|
|||
|
__destruct(){sqlsrv_free_stmt($this->_result);}}}elseif(extension_loaded("mssql")){class
|
|||
|
Min_DB{var$extension="MSSQL",$_link,$_result,$server_info,$affected_rows,$error;function
|
|||
|
connect($N,$V,$G){$this->_link=@mssql_connect($N,$V,$G);if($this->_link){$I=$this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");$K=$I->fetch_row();$this->server_info=$this->result("sp_server_info 2",2)." [$K[0]] $K[1]";}else$this->error=mssql_get_last_message();return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($Fb){return
|
|||
|
mssql_select_db($Fb);}function
|
|||
|
query($H,$zh=false){$I=mssql_query($H,$this->_link);$this->error="";if(!$I){$this->error=mssql_get_last_message();return
|
|||
|
false;}if($I===true){$this->affected_rows=mssql_rows_affected($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($I);}function
|
|||
|
multi_query($H){return$this->_result=$this->query($H);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
mssql_next_result($this->_result);}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!is_object($I))return
|
|||
|
false;return
|
|||
|
mssql_result($I->_result,0,$n);}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
Min_Result($I){$this->_result=$I;$this->num_rows=mssql_num_rows($I);}function
|
|||
|
fetch_assoc(){return
|
|||
|
mssql_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
mssql_fetch_row($this->_result);}function
|
|||
|
num_rows(){return
|
|||
|
mssql_num_rows($this->_result);}function
|
|||
|
fetch_field(){$J=mssql_fetch_field($this->_result);$J->orgtable=$J->table;$J->orgname=$J->name;return$J;}function
|
|||
|
seek($D){mssql_data_seek($this->_result,$D);}function
|
|||
|
__destruct(){mssql_free_result($this->_result);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$L,$zf){foreach($L
|
|||
|
as$O){$Fh=array();$Z=array();foreach($O
|
|||
|
as$x=>$X){$Fh[]="$x = $X";if(isset($zf[idf_unescape($x)]))$Z[]="$x = $X";}if(!queries("MERGE ".table($Q)." USING (VALUES(".implode(", ",$O).")) AS source (c".implode(", c",range(1,count($O))).") ON ".implode(" AND ",$Z)." WHEN MATCHED THEN UPDATE SET ".implode(", ",$Fh)." WHEN NOT MATCHED THEN INSERT (".implode(", ",array_keys($O)).") VALUES (".implode(", ",$O).");"))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN TRANSACTION");}}function
|
|||
|
idf_escape($t){return"[".str_replace("]","]]",$t)."]";}function
|
|||
|
table($t){return($_GET["ns"]!=""?idf_escape($_GET["ns"]).".":"").idf_escape($t);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Bb=$b->credentials();if($h->connect($Bb[0],$Bb[1],$Bb[2]))return$h;return$h->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("EXEC sp_databases");}function
|
|||
|
limit($H,$Z,$z,$D=0,$rg=" "){return($z!==null?" TOP (".($z+$D).")":"")." $H$Z";}function
|
|||
|
limit1($H,$Z){return
|
|||
|
limit($H,$Z,1);}function
|
|||
|
db_collation($k,$kb){global$h;return$h->result("SELECT collation_name FROM sys.databases WHERE name = ".q($k));}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT SUSER_NAME()");}function
|
|||
|
tables_list(){return
|
|||
|
get_key_vals("SELECT name, type_desc FROM sys.all_objects WHERE schema_id = SCHEMA_ID(".q(get_schema()).") AND type IN ('S', 'U', 'V') ORDER BY name");}function
|
|||
|
count_tables($j){global$h;$J=array();foreach($j
|
|||
|
as$k){$h->select_db($k);$J[$k]=$h->result("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES");}return$J;}function
|
|||
|
table_status($C=""){$J=array();foreach(get_rows("SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID(".q(get_schema()).") AND type IN ('S', 'U', 'V') ".($C!=""?"AND name = ".q($C):"ORDER BY name"))as$K){if($C!="")return$K;$J[$K["Name"]]=$K;}return$J;}function
|
|||
|
is_view($R){return$R["Engine"]=="VIEW";}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$J=array();foreach(get_rows("SELECT c.*, t.name type, d.definition [default]
|
|||
|
FROM sys.all_columns c
|
|||
|
JOIN sys.all_objects o ON c.object_id = o.object_id
|
|||
|
JOIN sys.types t ON c.user_type_id = t.user_type_id
|
|||
|
LEFT JOIN sys.default_constraints d ON c.default_object_id = d.parent_column_id
|
|||
|
WHERE o.schema_id = SCHEMA_ID(".q(get_schema()).") AND o.type IN ('S', 'U', 'V') AND o.name = ".q($Q))as$K){$U=$K["type"];$y=(preg_match("~char|binary~",$U)?$K["max_length"]:($U=="decimal"?"$K[precision],$K[scale]":""));$J[$K["name"]]=array("field"=>$K["name"],"full_type"=>$U.($y?"($y)":""),"type"=>$U,"length"=>$y,"default"=>$K["default"],"null"=>$K["is_nullable"],"auto_increment"=>$K["is_identity"],"collation"=>$K["collation_name"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"primary"=>$K["is_identity"],);}return$J;}function
|
|||
|
indexes($Q,$i=null){$J=array();foreach(get_rows("SELECT i.name, key_ordinal, is_unique, is_primary_key, c.name AS column_name, is_descending_key
|
|||
|
FROM sys.indexes i
|
|||
|
INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
|
|||
|
INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
|
|||
|
WHERE OBJECT_NAME(i.object_id) = ".q($Q),$i)as$K){$C=$K["name"];$J[$C]["type"]=($K["is_primary_key"]?"PRIMARY":($K["is_unique"]?"UNIQUE":"INDEX"));$J[$C]["lengths"]=array();$J[$C]["columns"][$K["key_ordinal"]]=$K["column_name"];$J[$C]["descs"][$K["key_ordinal"]]=($K["is_descending_key"]?'1':null);}return$J;}function
|
|||
|
view($C){global$h;return
|
|||
|
array("select"=>preg_replace('~^(?:[^[]|\\[[^]]*])*\\s+AS\\s+~isU','',$h->result("SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = ".q($C))));}function
|
|||
|
collations(){$J=array();foreach(get_vals("SELECT name FROM fn_helpcollations()")as$d)$J[preg_replace('~_.*~','',$d)][]=$d;return$J;}function
|
|||
|
information_schema($k){return
|
|||
|
false;}function
|
|||
|
error(){global$h;return
|
|||
|
nl_br(h(preg_replace('~^(\\[[^]]*])+~m','',$h->error)));}function
|
|||
|
create_database($k,$d){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($k).(preg_match('~^[a-z0-9_]+$~i',$d)?" COLLATE $d":""));}function
|
|||
|
drop_databases($j){return
|
|||
|
queries("DROP DATABASE ".implode(", ",array_map('idf_escape',$j)));}function
|
|||
|
rename_database($C,$d){if(preg_match('~^[a-z0-9_]+$~i',$d))queries("ALTER DATABASE ".idf_escape(DB)." COLLATE $d");queries("ALTER DATABASE ".idf_escape(DB)." MODIFY NAME = ".idf_escape($C));return
|
|||
|
true;}function
|
|||
|
auto_increment(){return" IDENTITY".($_POST["Auto_increment"]!=""?"(".(+$_POST["Auto_increment"]).",1)":"")." PRIMARY KEY";}function
|
|||
|
alter_table($Q,$C,$o,$Jc,$ob,$kc,$d,$Ka,$kf){$c=array();foreach($o
|
|||
|
as$n){$e=idf_escape($n[0]);$X=$n[1];if(!$X)$c["DROP"][]=" COLUMN $e";else{$X[1]=preg_replace("~( COLLATE )'(\\w+)'~","\\1\\2",$X[1]);if($n[0]=="")$c["ADD"][]="\n ".implode("",$X).($Q==""?substr($Jc[$X[0]],16+strlen($X[0])):"");else{unset($X[6]);if($e!=$X[0])queries("EXEC sp_rename ".q(table($Q).".$e").", ".q(idf_unescape($X[0])).", 'COLUMN'");$c["ALTER COLUMN ".implode("",$X)][]="";}}}if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (".implode(",",(array)$c["ADD"])."\n)");if($Q!=$C)queries("EXEC sp_rename ".q(table($Q)).", ".q($C));if($Jc)$c[""]=$Jc;foreach($c
|
|||
|
as$x=>$X){if(!queries("ALTER TABLE ".idf_escape($C)." $x".implode(",",$X)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($Q,$c){$u=array();$Vb=array();foreach($c
|
|||
|
as$X){if($X[2]=="DROP"){if($X[0]=="PRIMARY")$Vb[]=idf_escape($X[1]);else$u[]=idf_escape($X[1])." ON ".table($Q);}elseif(!queries(($X[0]!="PRIMARY"?"CREATE $X[0] ".($X[0]!="INDEX"?"INDEX ":"").idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q):"ALTER TABLE ".table($Q)." ADD PRIMARY KEY")." (".implode(", ",$X[2]).")"))return
|
|||
|
false;}return(!$u||queries("DROP INDEX ".implode(", ",$u)))&&(!$Vb||queries("ALTER TABLE ".table($Q)." DROP ".implode(", ",$Vb)));}function
|
|||
|
last_id(){global$h;return$h->result("SELECT SCOPE_IDENTITY()");}function
|
|||
|
explain($h,$H){$h->query("SET SHOWPLAN_ALL ON");$J=$h->query($H);$h->query("SET SHOWPLAN_ALL OFF");return$J;}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
foreign_keys($Q){$J=array();foreach(get_rows("EXEC sp_fkeys @fktable_name = ".q($Q))as$K){$p=&$J[$K["FK_NAME"]];$p["table"]=$K["PKTABLE_NAME"];$p["source"][]=$K["FKCOLUMN_NAME"];$p["target"][]=$K["PKCOLUMN_NAME"];}return$J;}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($Th){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$Th)));}function
|
|||
|
drop_tables($S){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
|
|||
|
move_tables($S,$Th,$Xg){return
|
|||
|
apply_queries("ALTER SCHEMA ".idf_escape($Xg)." TRANSFER",array_merge($S,$Th));}function
|
|||
|
trigger($C){if($C=="")return
|
|||
|
array();$L=get_rows("SELECT s.name [Trigger],
|
|||
|
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(s.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(s.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
|
|||
|
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing],
|
|||
|
c.text
|
|||
|
FROM sysobjects s
|
|||
|
JOIN syscomments c ON s.id = c.id
|
|||
|
WHERE s.xtype = 'TR' AND s.name = ".q($C));$J=reset($L);if($J)$J["Statement"]=preg_replace('~^.+\\s+AS\\s+~isU','',$J["text"]);return$J;}function
|
|||
|
triggers($Q){$J=array();foreach(get_rows("SELECT sys1.name,
|
|||
|
CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
|
|||
|
CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing]
|
|||
|
FROM sysobjects sys1
|
|||
|
JOIN sysobjects sys2 ON sys1.parent_obj = sys2.id
|
|||
|
WHERE sys1.xtype = 'TR' AND sys2.name = ".q($Q))as$K)$J[$K["name"]]=array($K["Timing"],$K["Event"]);return$J;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("AFTER","INSTEAD OF"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("AS"),);}function
|
|||
|
schemas(){return
|
|||
|
get_vals("SELECT name FROM sys.schemas");}function
|
|||
|
get_schema(){global$h;if($_GET["ns"]!="")return$_GET["ns"];return$h->result("SELECT SCHEMA_NAME()");}function
|
|||
|
set_schema($kg){return
|
|||
|
true;}function
|
|||
|
use_sql($Fb){return"USE ".idf_escape($Fb);}function
|
|||
|
show_variables(){return
|
|||
|
array();}function
|
|||
|
show_status(){return
|
|||
|
array();}function
|
|||
|
convert_field($n){}function
|
|||
|
unconvert_field($n,$J){return$J;}function
|
|||
|
support($Cc){return
|
|||
|
preg_match('~^(columns|database|drop_col|indexes|scheme|sql|table|trigger|view|view_trigger)$~',$Cc);}$w="mssql";$yh=array();$Hg=array();foreach(array(lang(24)=>array("tinyint"=>3,"smallint"=>5,"int"=>10,"bigint"=>20,"bit"=>1,"decimal"=>0,"real"=>12,"float"=>53,"smallmoney"=>10,"money"=>20),lang(25)=>array("date"=>10,"smalldatetime"=>19,"datetime"=>19,"datetime2"=>19,"time"=>8,"datetimeoffset"=>10),lang(26)=>array("char"=>8000,"varchar"=>8000,"text"=>2147483647,"nchar"=>4000,"nvarchar"=>4000,"ntext"=>1073741823),lang(27)=>array("binary"=>8000,"varbinary"=>8000,"image"=>2147483647),)as$x=>$X){$yh+=$X;$Hg[$x]=array_keys($X);}$Eh=array();$Oe=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$Sc=array("len","lower","round","upper");$Xc=array("avg","count","count distinct","max","min","sum");$cc=array(array("date|time"=>"getdate",),array("int|decimal|real|float|money|datetime"=>"+/-","char|text"=>"+",));}$Ub["simpledb"]="SimpleDB";if(isset($_GET["simpledb"])){$wf=array("SimpleXML");define("DRIVER","simpledb");if(class_exists('SimpleXMLElement')){class
|
|||
|
Min_DB{var$extension="SimpleXML",$server_info='2009-04-15',$error,$timeout,$next,$affected_rows,$_result;function
|
|||
|
select_db($Fb){return($Fb=="domain");}function
|
|||
|
query($H,$zh=false){$F=array('SelectExpression'=>$H,'ConsistentRead'=>'true');if($this->next)$F['NextToken']=$this->next;$I=sdb_request_all('Select','Item',$F,$this->timeout);if($I===false)return$I;if(preg_match('~^\s*SELECT\s+COUNT\(~i',$H)){$Lg=0;foreach($I
|
|||
|
as$Bd)$Lg+=$Bd->Attribute->Value;$I=array((object)array('Attribute'=>array((object)array('Name'=>'Count','Value'=>$Lg,))));}return
|
|||
|
new
|
|||
|
Min_Result($I);}function
|
|||
|
multi_query($H){return$this->_result=$this->query($H);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0;function
|
|||
|
Min_Result($I){foreach($I
|
|||
|
as$Bd){$K=array();if($Bd->Name!='')$K['itemName()']=(string)$Bd->Name;foreach($Bd->Attribute
|
|||
|
as$Ha){$C=$this->_processValue($Ha->Name);$Y=$this->_processValue($Ha->Value);if(isset($K[$C])){$K[$C]=(array)$K[$C];$K[$C][]=$Y;}else$K[$C]=$Y;}$this->_rows[]=$K;foreach($K
|
|||
|
as$x=>$X){if(!isset($this->_rows[0][$x]))$this->_rows[0][$x]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
_processValue($fc){return(is_object($fc)&&$fc['encoding']=='base64'?base64_decode($fc):(string)$fc);}function
|
|||
|
fetch_assoc(){$K=current($this->_rows);if(!$K)return$K;$J=array();foreach($this->_rows[0]as$x=>$X)$J[$x]=$K[$x];next($this->_rows);return$J;}function
|
|||
|
fetch_row(){$J=$this->fetch_assoc();if(!$J)return$J;return
|
|||
|
array_values($J);}function
|
|||
|
fetch_field(){$Hd=array_keys($this->_rows[0]);return(object)array('name'=>$Hd[$this->_offset++]);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$zf="itemName()";function
|
|||
|
_chunkRequest($id,$va,$F,$vc=array()){global$h;foreach(array_chunk($id,25)as$db){$gf=$F;foreach($db
|
|||
|
as$r=>$s){$gf["Item.$r.ItemName"]=$s;foreach($vc
|
|||
|
as$x=>$X)$gf["Item.$r.$x"]=$X;}if(!sdb_request($va,$gf))return
|
|||
|
false;}$h->affected_rows=count($id);return
|
|||
|
true;}function
|
|||
|
_extractIds($Q,$Jf,$z){$J=array();if(preg_match_all("~itemName\(\) = (('[^']*+')+)~",$Jf,$be))$J=array_map('idf_unescape',$be[1]);else{foreach(sdb_request_all('Select','Item',array('SelectExpression'=>'SELECT itemName() FROM '.table($Q).$Jf.($z?" LIMIT 1":"")))as$Bd)$J[]=$Bd->Name;}return$J;}function
|
|||
|
select($Q,$M,$Z,$Vc,$Te=array(),$z=1,$E=0,$Af=false){global$h;$h->next=$_GET["next"];$J=parent::select($Q,$M,$Z,$Vc,$Te,$z,$E,$Af);$h->next=0;return$J;}function
|
|||
|
delete($Q,$Jf,$z=0){return$this->_chunkRequest($this->_extractIds($Q,$Jf,$z),'BatchDeleteAttributes',array('DomainName'=>$Q));}function
|
|||
|
update($Q,$O,$Jf,$z=0,$rg="\n"){$Lb=array();$td=array();$r=0;$id=$this->_extractIds($Q,$Jf,$z);$s=idf_unescape($O["`itemName()`"]);unset($O["`itemName()`"]);foreach($O
|
|||
|
as$x=>$X){$x=idf_unescape($x);if($X=="NULL"||($s!=""&&array($s)!=$id))$Lb["Attribute.".count($Lb).".Name"]=$x;if($X!="NULL"){foreach((array)$X
|
|||
|
as$Dd=>$W){$td["Attribute.$r.Name"]=$x;$td["Attribute.$r.Value"]=(is_array($X)?$W:idf_unescape($W));if(!$Dd)$td["Attribute.$r.Replace"]="true";$r++;}}}$F=array('DomainName'=>$Q);return(!$td||$this->_chunkRequest(($s!=""?array($s):$id),'BatchPutAttributes',$F,$td))&&(!$Lb||$this->_chunkRequest($id,'BatchDeleteAttributes',$F,$Lb));}function
|
|||
|
insert($Q,$O){$F=array("DomainName"=>$Q);$r=0;foreach($O
|
|||
|
as$C=>$Y){if($Y!="NULL"){$C=idf_unescape($C);if($C=="itemName()")$F["ItemName"]=idf_unescape($Y);else{foreach((array)$Y
|
|||
|
as$X){$F["Attribute.$r.Name"]=$C;$F["Attribute.$r.Value"]=(is_array($Y)?$X:idf_unescape($Y));$r++;}}}}return
|
|||
|
sdb_request('PutAttributes',$F);}function
|
|||
|
insertUpdate($Q,$L,$zf){foreach($L
|
|||
|
as$O){if(!$this->update($Q,$O,"WHERE `itemName()` = ".q($O["`itemName()`"])))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
begin(){return
|
|||
|
false;}function
|
|||
|
commit(){return
|
|||
|
false;}function
|
|||
|
rollback(){return
|
|||
|
false;}}function
|
|||
|
connect(){return
|
|||
|
new
|
|||
|
Min_DB;}function
|
|||
|
support($Cc){return
|
|||
|
preg_match('~sql~',$Cc);}function
|
|||
|
logged_user(){global$b;$Bb=$b->credentials();return$Bb[1];}function
|
|||
|
get_databases(){return
|
|||
|
array("domain");}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($k,$kb){}function
|
|||
|
tables_list(){global$h;$J=array();foreach(sdb_request_all('ListDomains','DomainName')as$Q)$J[(string)$Q]='table';if($h->error&&defined("PAGE_HEADER"))echo"<p class='error'>".error()."\n";return$J;}function
|
|||
|
table_status($C="",$Bc=false){$J=array();foreach(($C!=""?array($C=>true):tables_list())as$Q=>$U){$K=array("Name"=>$Q,"Auto_increment"=>"");if(!$Bc){$oe=sdb_request('DomainMetadata',array('DomainName'=>$Q));if($oe){foreach(array("Rows"=>"ItemCount","Data_length"=>"ItemNamesSizeBytes","Index_length"=>"AttributeValuesSizeBytes","Data_free"=>"AttributeNamesSizeBytes",)as$x=>$X)$K[$x]=(string)$oe->$X;}}if($C!="")return$K;$J[$Q]=$K;}return$J;}function
|
|||
|
explain($h,$H){}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
indexes($Q,$i=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("itemName()")),);}function
|
|||
|
fields($Q){return
|
|||
|
fields_from_edit();}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
table($t){return
|
|||
|
idf_escape($t);}function
|
|||
|
idf_escape($t){return"`".str_replace("`","``",$t)."`";}function
|
|||
|
limit($H,$Z,$z,$D=0,$rg=" "){return" $H$Z".($z!==null?$rg."LIMIT $z":"");}function
|
|||
|
unconvert_field($n,$J){return$J;}function
|
|||
|
fk_support($R){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
alter_table($Q,$C,$o,$Jc,$ob,$kc,$d,$Ka,$kf){return($Q==""&&sdb_request('CreateDomain',array('DomainName'=>$C)));}function
|
|||
|
drop_tables($S){foreach($S
|
|||
|
as$Q){if(!sdb_request('DeleteDomain',array('DomainName'=>$Q)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
count_tables($j){foreach($j
|
|||
|
as$k)return
|
|||
|
array($k=>count(tables_list()));}function
|
|||
|
found_rows($R,$Z){return($Z?null:$R["Rows"]);}function
|
|||
|
last_id(){}function
|
|||
|
hmac($Aa,$Db,$x,$Nf=false){$Ta=64;if(strlen($x)>$Ta)$x=pack("H*",$Aa($x));$x=str_pad($x,$Ta,"\0");$Ed=$x^str_repeat("\x36",$Ta);$Fd=$x^str_repeat("\x5C",$Ta);$J=$Aa($Fd.pack("H*",$Aa($Ed.$Db)));if($Nf)$J=pack("H*",$J);return$J;}function
|
|||
|
sdb_request($va,$F=array()){global$b,$h;list($fd,$F['AWSAccessKeyId'],$ng)=$b->credentials();$F['Action']=$va;$F['Timestamp']=gmdate('Y-m-d\TH:i:s+00:00');$F['Version']='2009-04-15';$F['SignatureVersion']=2;$F['SignatureMethod']='HmacSHA1';ksort($F);$H='';foreach($F
|
|||
|
as$x=>$X)$H.='&'.rawurlencode($x).'='.rawurlencode($X);$H=str_replace('%7E','~',substr($H,1));$H.="&Signature=".urlencode(base64_encode(hmac('sha1',"POST\n".preg_replace('~^https?://~','',$fd)."\n/\n$H",$ng,true)));@ini_set('track_errors',1);$Ec=@file_get_contents((preg_match('~^https?://~',$fd)?$fd:"http://$fd"),false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$H,'ignore_errors'=>1,))));if(!$Ec){$h->error=$php_errormsg;return
|
|||
|
false;}libxml_use_internal_errors(true);$Zh=simplexml_load_string($Ec);if(!$Zh){$m=libxml_get_last_error();$h->error=$m->message;return
|
|||
|
false;}if($Zh->Errors){$m=$Zh->Errors->Error;$h->error="$m->Message ($m->Code)";return
|
|||
|
false;}$h->error='';$Wg=$va."Result";return($Zh->$Wg?$Zh->$Wg:true);}function
|
|||
|
sdb_request_all($va,$Wg,$F=array(),$fh=0){$J=array();$Dg=($fh?microtime(true):0);$z=(preg_match('~LIMIT\s+(\d+)\s*$~i',$F['SelectExpression'],$B)?$B[1]:0);do{$Zh=sdb_request($va,$F);if(!$Zh)break;foreach($Zh->$Wg
|
|||
|
as$fc)$J[]=$fc;if($z&&count($J)>=$z){$_GET["next"]=$Zh->NextToken;break;}if($fh&µtime(true)-$Dg>$fh)return
|
|||
|
false;$F['NextToken']=$Zh->NextToken;if($z)$F['SelectExpression']=preg_replace('~\d+\s*$~',$z-count($J),$F['SelectExpression']);}while($Zh->NextToken);return$J;}$w="simpledb";$Oe=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","IS NOT NULL");$Sc=array();$Xc=array("count");$cc=array(array("json"));}$Ub["mongo"]="MongoDB (beta)";if(isset($_GET["mongo"])){$wf=array("mongo");define("DRIVER","mongo");if(class_exists('MongoDB')){class
|
|||
|
Min_DB{var$extension="Mongo",$error,$last_id,$_link,$_db;function
|
|||
|
connect($N,$V,$G){global$b;$k=$b->database();$Re=array();if($V!=""){$Re["username"]=$V;$Re["password"]=$G;}if($k!="")$Re["db"]=$k;try{$this->_link=@new
|
|||
|
MongoClient("mongodb://$N",$Re);return
|
|||
|
true;}catch(Exception$rc){$this->error=$rc->getMessage();return
|
|||
|
false;}}function
|
|||
|
query($H){return
|
|||
|
false;}function
|
|||
|
select_db($Fb){try{$this->_db=$this->_link->selectDB($Fb);return
|
|||
|
true;}catch(Exception$rc){$this->error=$rc->getMessage();return
|
|||
|
false;}}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
|
|||
|
Min_Result($I){foreach($I
|
|||
|
as$Bd){$K=array();foreach($Bd
|
|||
|
as$x=>$X){if(is_a($X,'MongoBinData'))$this->_charset[$x]=63;$K[$x]=(is_a($X,'MongoId')?'ObjectId("'.strval($X).'")':(is_a($X,'MongoDate')?gmdate("Y-m-d H:i:s",$X->sec)." GMT":(is_a($X,'MongoBinData')?$X->bin:(is_a($X,'MongoRegex')?strval($X):(is_object($X)?get_class($X):$X)))));}$this->_rows[]=$K;foreach($K
|
|||
|
as$x=>$X){if(!isset($this->_rows[0][$x]))$this->_rows[0][$x]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
fetch_assoc(){$K=current($this->_rows);if(!$K)return$K;$J=array();foreach($this->_rows[0]as$x=>$X)$J[$x]=$K[$x];next($this->_rows);return$J;}function
|
|||
|
fetch_row(){$J=$this->fetch_assoc();if(!$J)return$J;return
|
|||
|
array_values($J);}function
|
|||
|
fetch_field(){$Hd=array_keys($this->_rows[0]);$C=$Hd[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$zf="_id";function
|
|||
|
quote($Y){return($Y===null?$Y:parent::quote($Y));}function
|
|||
|
select($Q,$M,$Z,$Vc,$Te=array(),$z=1,$E=0,$Af=false){$M=($M==array("*")?array():array_fill_keys($M,true));$zg=array();foreach($Te
|
|||
|
as$X){$X=preg_replace('~ DESC$~','',$X,1,$yb);$zg[$X]=($yb?-1:1);}return
|
|||
|
new
|
|||
|
Min_Result($this->_conn->_db->selectCollection($Q)->find(array(),$M)->sort($zg)->limit(+$z)->skip($E*$z));}function
|
|||
|
insert($Q,$O){try{$J=$this->_conn->_db->selectCollection($Q)->insert($O);$this->_conn->errno=$J['code'];$this->_conn->error=$J['err'];$this->_conn->last_id=$O['_id'];return!$J['err'];}catch(Exception$rc){$this->_conn->error=$rc->getMessage();return
|
|||
|
false;}}}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Bb=$b->credentials();if($h->connect($Bb[0],$Bb[1],$Bb[2]))return$h;return$h->error;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
logged_user(){global$b;$Bb=$b->credentials();return$Bb[1];}function
|
|||
|
get_databases($Ic){global$h;$J=array();$Ib=$h->_link->listDBs();foreach($Ib['databases']as$k)$J[]=$k['name'];return$J;}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($k,$kb){}function
|
|||
|
count_tables($j){global$h;$J=array();foreach($j
|
|||
|
as$k)$J[$k]=count($h->_link->selectDB($k)->getCollectionNames(true));return$J;}function
|
|||
|
tables_list(){global$h;return
|
|||
|
array_fill_keys($h->_db->getCollectionNames(true),'table');}function
|
|||
|
table_status($C="",$Bc=false){$J=array();foreach(tables_list()as$Q=>$U){$J[$Q]=array("Name"=>$Q);if($C==$Q)return$J[$Q];}return$J;}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
drop_databases($j){global$h;foreach($j
|
|||
|
as$k){$Yf=$h->_link->selectDB($k)->drop();if(!$Yf['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
indexes($Q,$i=null){global$h;$J=array();foreach($h->_db->selectCollection($Q)->getIndexInfo()as$u){$Ob=array();foreach($u["key"]as$e=>$U)$Ob[]=($U==-1?'1':null);$J[$u["name"]]=array("type"=>($u["name"]=="_id_"?"PRIMARY":($u["unique"]?"UNIQUE":"INDEX")),"columns"=>array_keys($u["key"]),"lengths"=>array(),"descs"=>$Ob,);}return$J;}function
|
|||
|
fields($Q){return
|
|||
|
fields_from_edit();}function
|
|||
|
convert_field($n){}function
|
|||
|
unconvert_field($n,$J){return$J;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
fk_support($R){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
found_rows($R,$Z){global$h;return$h->_db->selectCollection($_GET["select"])->count($Z);}function
|
|||
|
alter_table($Q,$C,$o,$Jc,$ob,$kc,$d,$Ka,$kf){global$h;if($Q==""){$h->_db->createCollection($C);return
|
|||
|
true;}}function
|
|||
|
drop_tables($S){global$h;foreach($S
|
|||
|
as$Q){$Yf=$h->_db->selectCollection($Q)->drop();if(!$Yf['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){global$h;foreach($S
|
|||
|
as$Q){$Yf=$h->_db->selectCollection($Q)->remove();if(!$Yf['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($Q,$c){global$h;foreach($c
|
|||
|
as$X){list($U,$C,$O)=$X;if($O=="DROP")$J=$h->_db->command(array("deleteIndexes"=>$Q,"index"=>$C));else{$f=array();foreach($O
|
|||
|
as$e){$e=preg_replace('~ DESC$~','',$e,1,$yb);$f[$e]=($yb?-1:1);}$J=$h->_db->selectCollection($Q)->ensureIndex($f,array("unique"=>($U=="UNIQUE"),"name"=>$C,));}if($J['errmsg']){$h->error=$J['errmsg'];return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
last_id(){global$h;return$h->last_id;}function
|
|||
|
table($t){return$t;}function
|
|||
|
idf_escape($t){return$t;}function
|
|||
|
support($Cc){return
|
|||
|
preg_match("~database|indexes~",$Cc);}$w="mongo";$Oe=array("=");$Sc=array();$Xc=array();$cc=array(array("json"));}$Ub["elastic"]="Elasticsearch (beta)";if(isset($_GET["elastic"])){$wf=array("json");define("DRIVER","elastic");if(function_exists('json_decode')){class
|
|||
|
Min_DB{var$extension="JSON",$server_info,$errno,$error,$_url;function
|
|||
|
rootQuery($nf,$tb=array(),$pe='GET'){@ini_set('track_errors',1);$Ec=@file_get_contents($this->_url.'/'.ltrim($nf,'/'),false,stream_context_create(array('http'=>array('method'=>$pe,'content'=>json_encode($tb),'ignore_errors'=>1,))));if(!$Ec){$this->error=$php_errormsg;return$Ec;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Ec;return
|
|||
|
false;}$J=json_decode($Ec,true);if(!$J){$this->errno=json_last_error();if(function_exists('json_last_error_msg'))$this->error=json_last_error_msg();else{$sb=get_defined_constants(true);foreach($sb['json']as$C=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$C)){$this->error=$C;break;}}}}return$J;}function
|
|||
|
query($nf,$tb=array(),$pe='GET'){return$this->rootQuery(($this->_db!=""?"$this->_db/":"/").ltrim($nf,'/'),$tb,$pe);}function
|
|||
|
connect($N,$V,$G){$this->_url="http://$V:$G@$N/";$J=$this->query('');if($J)$this->server_info=$J['version']['number'];return(bool)$J;}function
|
|||
|
select_db($Fb){$this->_db=$Fb;return
|
|||
|
true;}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows;function
|
|||
|
Min_Result($L){$this->num_rows=count($this->_rows);$this->_rows=$L;reset($this->_rows);}function
|
|||
|
fetch_assoc(){$J=current($this->_rows);next($this->_rows);return$J;}function
|
|||
|
fetch_row(){return
|
|||
|
array_values($this->fetch_assoc());}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
select($Q,$M,$Z,$Vc,$Te=array(),$z=1,$E=0,$Af=false){global$b;$Db=array();$H="$Q/_search";if($M!=array("*"))$Db["fields"]=$M;if($Te){$zg=array();foreach($Te
|
|||
|
as$ib){$ib=preg_replace('~ DESC$~','',$ib,1,$yb);$zg[]=($yb?array($ib=>"desc"):$ib);}$Db["sort"]=$zg;}if($z){$Db["size"]=+$z;if($E)$Db["from"]=($E*$z);}foreach((array)$_GET["where"]as$X){if("$X[col]$X[val]"!=""){$ah=array("match"=>array(($X["col"]!=""?$X["col"]:"_all")=>$X["val"]));if($X["op"]=="=")$Db["query"]["filtered"]["filter"]["and"][]=$ah;else$Db["query"]["filtered"]["query"]["bool"]["must"][]=$ah;}}if($Db["query"]&&!$Db["query"]["filtered"]["query"])$Db["query"]["filtered"]["query"]=array("match_all"=>array());$Dg=microtime(true);$mg=$this->_conn->query($H,$Db);if($Af)echo$b->selectQuery("$H: ".print_r($Db,true),format_time($Dg));if(!$mg)return
|
|||
|
false;$J=array();foreach($mg['hits']['hits']as$ed){$K=array();$o=$ed['_source'];if($M!=array("*")){$o=array();foreach($M
|
|||
|
as$x)$o[$x]=$ed['fields'][$x];}foreach($o
|
|||
|
as$x=>$X)$K[$x]=(is_array($X)?json_encode($X):$X);$J[]=$K;}return
|
|||
|
new
|
|||
|
Min_Result($J);}}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Bb=$b->credentials();if($h->connect($Bb[0],$Bb[1],$Bb[2]))return$h;return$h->error;}function
|
|||
|
support($Cc){return
|
|||
|
preg_match("~database|table|columns~",$Cc);}function
|
|||
|
logged_user(){global$b;$Bb=$b->credentials();return$Bb[1];}function
|
|||
|
get_databases(){global$h;$J=$h->rootQuery('_aliases');if($J)$J=array_keys($J);return$J;}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($k,$kb){}function
|
|||
|
count_tables($j){global$h;$J=$h->query('_mapping');if($J)$J=array_map('count',$J);return$J;}function
|
|||
|
tables_list(){global$h;$J=$h->query('_mapping');if($J)$J=array_fill_keys(array_keys(reset($J)),'table');return$J;}function
|
|||
|
table_status($C="",$Bc=false){global$h;$mg=$h->query("_search?search_type=count",array("facets"=>array("count_by_type"=>array("terms"=>array("field"=>"_type",)))),"POST");$J=array();if($mg){foreach($mg["facets"]["count_by_type"]["terms"]as$Q)$J[$Q["term"]]=array("Name"=>$Q["term"],"Engine"=>"table","Rows"=>$Q["count"],);if($C!=""&&$C==$Q["term"])return$J[$C];}return$J;}function
|
|||
|
error(){global$h;return
|
|||
|
h($h->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
indexes($Q,$i=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("_id")),);}function
|
|||
|
fields($Q){global$h;$Zd=$h->query("$Q/_mapping");$J=array();if($Zd){foreach($Zd[$Q]['properties']as$C=>$n)$J[$C]=array("field"=>$C,"full_type"=>$n["type"],"type"=>$n["type"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);}return$J;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
table($t){return$t;}function
|
|||
|
idf_escape($t){return$t;}function
|
|||
|
convert_field($n){}function
|
|||
|
unconvert_field($n,$J){return$J;}function
|
|||
|
fk_support($R){}function
|
|||
|
found_rows($R,$Z){return
|
|||
|
null;}function
|
|||
|
create_database($k){global$h;return$h->rootQuery(urlencode($k),array(),'PUT');}function
|
|||
|
drop_databases($j){global$h;return$h->rootQuery(urlencode(implode(',',$j)),array(),'DELETE');}function
|
|||
|
drop_tables($S){global$h;$J=true;foreach($S
|
|||
|
as$Q)$J=$J&&$h->query(urlencode($Q),array(),'DELETE');return$J;}$w="elastic";$Oe=array("=","query");$Sc=array();$Xc=array();$cc=array(array("json"));}$Ub=array("server"=>"MySQL")+$Ub;if(!defined("DRIVER")){$wf=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
MySQLi{var$extension="MySQLi";function
|
|||
|
Min_DB(){parent::init();}function
|
|||
|
connect($N,$V,$G){mysqli_report(MYSQLI_REPORT_OFF);list($fd,$sf)=explode(":",$N,2);$J=@$this->real_connect(($N!=""?$fd:ini_get("mysqli.default_host")),($N.$V!=""?$V:ini_get("mysqli.default_user")),($N.$V.$G!=""?$G:ini_get("mysqli.default_pw")),null,(is_numeric($sf)?$sf:ini_get("mysqli.default_port")),(!is_numeric($sf)?$sf:null));if($J){if(method_exists($this,'set_charset'))$this->set_charset("utf8");else$this->query("SET NAMES utf8");}return$J;}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!$I)return
|
|||
|
false;$K=$I->fetch_array();return$K[$n];}function
|
|||
|
quote($P){return"'".$this->escape_string($P)."'";}}}elseif(extension_loaded("mysql")&&!(ini_get("sql.safe_mode")&&extension_loaded("pdo_mysql"))){class
|
|||
|
Min_DB{var$extension="MySQL",$server_info,$affected_rows,$errno,$error,$_link,$_result;function
|
|||
|
connect($N,$V,$G){$this->_link=@mysql_connect(($N!=""?$N:ini_get("mysql.default_host")),("$N$V"!=""?$V:ini_get("mysql.default_user")),("$N$V$G"!=""?$G:ini_get("mysql.default_password")),true,131072);if($this->_link){$this->server_info=mysql_get_server_info($this->_link);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($P){return"'".mysql_real_escape_string($P,$this->_link)."'";}function
|
|||
|
select_db($Fb){return
|
|||
|
mysql_select_db($Fb,$this->_link);}function
|
|||
|
query($H,$zh=false){$I=@($zh?mysql_unbuffered_query($H,$this->_link):mysql_query($H,$this->_link));$this->error="";if(!$I){$this->errno=mysql_errno($this->_link);$this->error=mysql_error($this->_link);return
|
|||
|
false;}if($I===true){$this->affected_rows=mysql_affected_rows($this->_link);$this->info=mysql_info($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($I);}function
|
|||
|
multi_query($H){return$this->_result=$this->query($H);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($H,$n=0){$I=$this->query($H);if(!$I||!$I->num_rows)return
|
|||
|
false;return
|
|||
|
mysql_result($I->_result,0,$n);}}class
|
|||
|
Min_Result{var$num_rows,$_result,$_offset=0;function
|
|||
|
Min_Result($I){$this->_result=$I;$this->num_rows=mysql_num_rows($I);}function
|
|||
|
fetch_assoc(){return
|
|||
|
mysql_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
mysql_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$J=mysql_fetch_field($this->_result,$this->_offset++);$J->orgtable=$J->table;$J->orgname=$J->name;$J->charsetnr=($J->blob?63:0);return$J;}function
|
|||
|
__destruct(){mysql_free_result($this->_result);}}}elseif(extension_loaded("pdo_mysql")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_MySQL";function
|
|||
|
connect($N,$V,$G){$this->dsn("mysql:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\\d)~',';port=\\1',$N)),$V,$G);$this->query("SET NAMES utf8");return
|
|||
|
true;}function
|
|||
|
select_db($Fb){return$this->query("USE ".idf_escape($Fb));}function
|
|||
|
query($H,$zh=false){$this->setAttribute(1000,!$zh);return
|
|||
|
parent::query($H,$zh);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insert($Q,$O){return($O?parent::insert($Q,$O):queries("INSERT INTO ".table($Q)." ()\nVALUES ()"));}function
|
|||
|
insertUpdate($Q,$L,$zf){$f=array_keys(reset($L));$xf="INSERT INTO ".table($Q)." (".implode(", ",$f).") VALUES\n";$Oh=array();foreach($f
|
|||
|
as$x)$Oh[$x]="$x = VALUES($x)";$Kg="\nON DUPLICATE KEY UPDATE ".implode(", ",$Oh);$Oh=array();$y=0;foreach($L
|
|||
|
as$O){$Y="(".implode(", ",$O).")";if($Oh&&(strlen($xf)+$y+strlen($Y)+strlen($Kg)>1e6)){if(!queries($xf.implode(",\n",$Oh).$Kg))return
|
|||
|
false;$Oh=array();$y=0;}$Oh[]=$Y;$y+=strlen($Y)+2;}return
|
|||
|
queries($xf.implode(",\n",$Oh).$Kg);}}function
|
|||
|
idf_escape($t){return"`".str_replace("`","``",$t)."`";}function
|
|||
|
table($t){return
|
|||
|
idf_escape($t);}function
|
|||
|
connect(){global$b;$h=new
|
|||
|
Min_DB;$Bb=$b->credentials();if($h->connect($Bb[0],$Bb[1],$Bb[2])){$h->query("SET sql_quote_show_create = 1, autocommit = 1");return$h;}$J=$h->error;if(function_exists('iconv')&&!is_utf8($J)&&strlen($ig=iconv("windows-1250","utf-8",$J))>strlen($J))$J=$ig;return$J;}function
|
|||
|
get_databases($Ic){global$h;$J=get_session("dbs");if($J===null){$H=($h->server_info>=5?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA":"SHOW DATABASES");$J=($Ic?slow_query($H):get_vals($H));restart_session();set_session("dbs",$J);stop_session();}return$J;}function
|
|||
|
limit($H,$Z,$z,$D=0,$rg=" "){return" $H$Z".($z!==null?$rg."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($H,$Z){return
|
|||
|
limit($H,$Z,1);}function
|
|||
|
db_collation($k,$kb){global$h;$J=null;$zb=$h->result("SHOW CREATE DATABASE ".idf_escape($k),1);if(preg_match('~ COLLATE ([^ ]+)~',$zb,$B))$J=$B[1];elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$zb,$B))$J=$kb[$B[1]][-1];return$J;}function
|
|||
|
engines(){$J=array();foreach(get_rows("SHOW ENGINES")as$K){if(preg_match("~YES|DEFAULT~",$K["Support"]))$J[]=$K["Engine"];}return$J;}function
|
|||
|
logged_user(){global$h;return$h->result("SELECT USER()");}function
|
|||
|
tables_list(){global$h;return
|
|||
|
get_key_vals($h->server_info>=5?"SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME":"SHOW TABLES");}function
|
|||
|
count_tables($j){$J=array();foreach($j
|
|||
|
as$k)$J[$k]=count(get_vals("SHOW TABLES IN ".idf_escape($k)));return$J;}function
|
|||
|
table_status($C="",$Bc=false){global$h;$J=array();foreach(get_rows($Bc&&$h->server_info>=5?"SELECT TABLE_NAME AS Name, Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ".($C!=""?"AND TABLE_NAME = ".q($C):"ORDER BY Name"):"SHOW TABLE STATUS".($C!=""?" LIKE ".q(addcslashes($C,"%_\\")):""))as$K){if($K["Engine"]=="InnoDB")$K["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$K["Comment"]);if(!isset($K["Engine"]))$K["Comment"]="";if($C!="")return$K;$J[$K["Name"]]=$K;}return$J;}function
|
|||
|
is_view($R){return$R["Engine"]===null;}function
|
|||
|
fk_support($R){return
|
|||
|
preg_match('~InnoDB|IBMDB2I~i',$R["Engine"]);}function
|
|||
|
fields($Q){$J=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($Q))as$K){preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~',$K["Type"],$B);$J[$K["Field"]]=array("field"=>$K["Field"],"full_type"=>$K["Type"],"type"=>$B[1],"length"=>$B[2],"unsigned"=>ltrim($B[3].$B[4]),"default"=>($K["Default"]!=""||preg_match("~char|set~",$B[1])?$K["Default"]:null),"null"=>($K["Null"]=="YES"),"auto_increment"=>($K["Extra"]=="auto_increment"),"on_update"=>(preg_match('~^on update (.+)~i',$K["Extra"],$B)?$B[1]:""),"collation"=>$K["Collation"],"privileges"=>array_flip(preg_split('~, *~',$K["Privileges"])),"comment"=>$K["Comment"],"primary"=>($K["Key"]=="PRI"),);}return$J;}function
|
|||
|
indexes($Q,$i=null){$J=array();foreach(get_rows("SHOW INDEX FROM ".table($Q),$i)as$K){$J[$K["Key_name"]]["type"]=($K["Key_name"]=="PRIMARY"?"PRIMARY":($K["Index_type"]=="FULLTEXT"?"FULLTEXT":($K["Non_unique"]?"INDEX":"UNIQUE")));$J[$K["Key_name"]]["columns"][]=$K["Column_name"];$J[$K["Key_name"]]["lengths"][]=$K["Sub_part"];$J[$K["Key_name"]]["descs"][]=null;}return$J;}function
|
|||
|
foreign_keys($Q){global$h,$Ke;static$pf='`(?:[^`]|``)+`';$J=array();$_b=$h->result("SHOW CREATE TABLE ".table($Q),1);if($_b){preg_match_all("~CONSTRAINT ($pf) FOREIGN KEY \\(((?:$pf,? ?)+)\\) REFERENCES ($pf)(?:\\.($pf))? \\(((?:$pf,? ?)+)\\)(?: ON DELETE ($Ke))?(?: ON UPDATE ($Ke))?~",$_b,$be,PREG_SET_ORDER);foreach($be
|
|||
|
as$B){preg_match_all("~$pf~",$B[2],$_g);preg_match_all("~$pf~",$B[5],$Xg);$J[idf_unescape($B[1])]=array("db"=>idf_unescape($B[4]!=""?$B[3]:$B[4]),"table"=>idf_unescape($B[4]!=""?$B[4]:$B[3]),"source"=>array_map('idf_unescape',$_g[0]),"target"=>array_map('idf_unescape',$Xg[0]),"on_delete"=>($B[6]?$B[6]:"RESTRICT"),"on_update"=>($B[7]?$B[7]:"RESTRICT"),);}}return$J;}function
|
|||
|
view($C){global$h;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU','',$h->result("SHOW CREATE VIEW ".table($C),1)));}function
|
|||
|
collations(){$J=array();foreach(get_rows("SHOW COLLATION")as$K){if($K["Default"])$J[$K["Charset"]][-1]=$K["Collation"];else$J[$K["Charset"]][]=$K["Collation"];}ksort($J);foreach($J
|
|||
|
as$x=>$X)asort($J[$x]);return$J;}function
|
|||
|
information_schema($k){global$h;return($h->server_info>=5&&$k=="information_schema")||($h->server_info>=5.5&&$k=="performance_schema");}function
|
|||
|
error(){global$h;return
|
|||
|
h(preg_replace('~^You have an error.*syntax to use~U',"Syntax error",$h->error));}function
|
|||
|
error_line(){global$h;if(preg_match('~ at line ([0-9]+)$~',$h->error,$Uf))return$Uf[1]-1;}function
|
|||
|
create_database($k,$d){set_session("dbs",null);return
|
|||
|
queries("CREATE DATABASE ".idf_escape($k).($d?" COLLATE ".q($d):""));}function
|
|||
|
drop_databases($j){restart_session();set_session("dbs",null);return
|
|||
|
apply_queries("DROP DATABASE",$j,'idf_escape');}function
|
|||
|
rename_database($C,$d){if(create_database($C,$d)){$Wf=array();foreach(tables_list()as$Q=>$U)$Wf[]=table($Q)." TO ".idf_escape($C).".".table($Q);if(!$Wf||queries("RENAME TABLE ".implode(", ",$Wf))){queries("DROP DATABASE ".idf_escape(DB));return
|
|||
|
true;}}return
|
|||
|
false;}function
|
|||
|
auto_increment(){$La=" 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)){$La="";break;}if($u["type"]=="PRIMARY")$La=" UNIQUE";}}return" AUTO_INCREMENT$La";}function
|
|||
|
alter_table($Q,$C,$o,$Jc,$ob,$kc,$d,$Ka,$kf){$c=array();foreach($o
|
|||
|
as$n)$c[]=($n[1]?($Q!=""?($n[0]!=""?"CHANGE ".idf_escape($n[0]):"ADD"):" ")." ".implode($n[1]).($Q!=""?$n[2]:""):"DROP ".idf_escape($n[0]));$c=array_merge($c,$Jc);$Eg="COMMENT=".q($ob).($kc?" ENGINE=".q($kc):"").($d?" COLLATE ".q($d):"").($Ka!=""?" AUTO_INCREMENT=$Ka":"").$kf;if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n) $Eg");if($Q!=$C)$c[]="RENAME TO ".table($C);$c[]=$Eg;return
|
|||
|
queries("ALTER TABLE ".table($Q)."\n".implode(",\n",$c));}function
|
|||
|
alter_indexes($Q,$c){foreach($c
|
|||
|
as$x=>$X)$c[$x]=($X[2]=="DROP"?"\nDROP INDEX ".idf_escape($X[1]):"\nADD $X[0] ".($X[0]=="PRIMARY"?"KEY ":"").($X[1]!=""?idf_escape($X[1])." ":"")."(".implode(", ",$X[2]).")");return
|
|||
|
queries("ALTER TABLE ".table($Q).implode(",",$c));}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($Th){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$Th)));}function
|
|||
|
drop_tables($S){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
|
|||
|
move_tables($S,$Th,$Xg){$Wf=array();foreach(array_merge($S,$Th)as$Q)$Wf[]=table($Q)." TO ".idf_escape($Xg).".".table($Q);return
|
|||
|
queries("RENAME TABLE ".implode(", ",$Wf));}function
|
|||
|
copy_tables($S,$Th,$Xg){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($S
|
|||
|
as$Q){$C=($Xg==DB?table("copy_$Q"):idf_escape($Xg).".".table($Q));if(!queries("\nDROP TABLE IF EXISTS $C")||!queries("CREATE TABLE $C LIKE ".table($Q))||!queries("INSERT INTO $C SELECT * FROM ".table($Q)))return
|
|||
|
false;}foreach($Th
|
|||
|
as$Q){$C=($Xg==DB?table("copy_$Q"):idf_escape($Xg).".".table($Q));$Sh=view($Q);if(!queries("DROP VIEW IF EXISTS $C")||!queries("CREATE VIEW $C AS $Sh[select]"))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($C){if($C=="")return
|
|||
|
array();$L=get_rows("SHOW TRIGGERS WHERE `Trigger` = ".q($C));return
|
|||
|
reset($L);}function
|
|||
|
triggers($Q){$J=array();foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")))as$K)$J[$K["Trigger"]]=array($K["Timing"],$K["Event"]);return$J;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
|
|||
|
routine($C,$U){global$h,$mc,$rd,$yh;$Ba=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$xh="((".implode("|",array_merge(array_keys($yh),$Ba)).")\\b(?:\\s*\\(((?:[^'\")]|$mc)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";$pf="\\s*(".($U=="FUNCTION"?"":$rd).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$xh";$zb=$h->result("SHOW CREATE $U ".idf_escape($C),2);preg_match("~\\(((?:$pf\\s*,?)*)\\)\\s*".($U=="FUNCTION"?"RETURNS\\s+$xh\\s+":"")."(.*)~is",$zb,$B);$o=array();preg_match_all("~$pf\\s*,?~is",$B[1],$be,PREG_SET_ORDER);foreach($be
|
|||
|
as$ff){$C=str_replace("``","`",$ff[2]).$ff[3];$o[]=array("field"=>$C,"type"=>strtolower($ff[5]),"length"=>preg_replace_callback("~$mc~s",'normalize_enum',$ff[6]),"unsigned"=>strtolower(preg_replace('~\\s+~',' ',trim("$ff[8] $ff[7]"))),"null"=>1,"full_type"=>$ff[4],"inout"=>strtoupper($ff[1]),"collation"=>strtolower($ff[9]),);}if($U!="FUNCTION")return
|
|||
|
array("fields"=>$o,"definition"=>$B[11]);return
|
|||
|
array("fields"=>$o,"returns"=>array("type"=>$B[12],"length"=>$B[13],"unsigned"=>$B[15],"collation"=>$B[16]),"definition"=>$B[17],"language"=>"SQL",);}function
|
|||
|
routines(){return
|
|||
|
get_rows("SELECT ROUTINE_NAME, ROUTINE_TYPE, DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = ".q(DB));}function
|
|||
|
routine_languages(){return
|
|||
|
array();}function
|
|||
|
last_id(){global$h;return$h->result("SELECT LAST_INSERT_ID()");}function
|
|||
|
explain($h,$H){return$h->query("EXPLAIN ".($h->server_info>=5.1?"PARTITIONS ":"").$H);}function
|
|||
|
found_rows($R,$Z){return($Z||$R["Engine"]!="InnoDB"?null:$R["Rows"]);}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($kg){return
|
|||
|
true;}function
|
|||
|
create_sql($Q,$Ka){global$h;$J=$h->result("SHOW CREATE TABLE ".table($Q),1);if(!$Ka)$J=preg_replace('~ AUTO_INCREMENT=\\d+~','',$J);return$J;}function
|
|||
|
truncate_sql($Q){return"TRUNCATE ".table($Q);}function
|
|||
|
use_sql($Fb){return"USE ".idf_escape($Fb);}function
|
|||
|
trigger_sql($Q,$Ig){$J="";foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")),null,"-- ")as$K)$J.="\n".($Ig=='CREATE+ALTER'?"DROP TRIGGER IF EXISTS ".idf_escape($K["Trigger"]).";;\n":"")."CREATE TRIGGER ".idf_escape($K["Trigger"])." $K[Timing] $K[Event] ON ".table($K["Table"])." FOR EACH ROW\n$K[Statement];;\n";return$J;}function
|
|||
|
show_variables(){return
|
|||
|
get_key_vals("SHOW VARIABLES");}function
|
|||
|
process_list(){return
|
|||
|
get_rows("SHOW FULL PROCESSLIST");}function
|
|||
|
show_status(){return
|
|||
|
get_key_vals("SHOW STATUS");}function
|
|||
|
convert_field($n){if(preg_match("~binary~",$n["type"]))return"HEX(".idf_escape($n["field"]).")";if($n["type"]=="bit")return"BIN(".idf_escape($n["field"])." + 0)";if(preg_match("~geometry|point|linestring|polygon~",$n["type"]))return"AsWKT(".idf_escape($n["field"]).")";}function
|
|||
|
unconvert_field($n,$J){if(preg_match("~binary~",$n["type"]))$J="UNHEX($J)";if($n["type"]=="bit")$J="CONV($J, 2, 10) + 0";if(preg_match("~geometry|point|linestring|polygon~",$n["type"]))$J="GeomFromText($J)";return$J;}function
|
|||
|
support($Cc){global$h;return!preg_match("~scheme|sequence|type|view_trigger".($h->server_info<5.1?"|event|partitioning".($h->server_info<5?"|routine|trigger|view":""):"")."~",$Cc);}$w="sql";$yh=array();$Hg=array();foreach(array(lang(24)=>array("tinyint"=>3,"smallint"=>5,"mediumint"=>8,"int"=>10,"bigint"=>20,"decimal"=>66,"float"=>12,"double"=>21),lang(25)=>array("date"=>10,"datetime"=>19,"timestamp"=>19,"time"=>10,"year"=>4),lang(26)=>array("char"=>255,"varchar"=>65535,"tinytext"=>255,"text"=>65535,"mediumtext"=>16777215,"longtext"=>4294967295),lang(30)=>array("enum"=>65535,"set"=>64),lang(27)=>array("bit"=>20,"binary"=>255,"varbinary"=>65535,"tinyblob"=>255,"blob"=>65535,"mediumblob"=>16777215,"longblob"=>4294967295),lang(29)=>array("geometry"=>0,"point"=>0,"linestring"=>0,"polygon"=>0,"multipoint"=>0,"multilinestring"=>0,"multipolygon"=>0,"geometrycollection"=>0),)as$x=>$X){$yh+=$X;$Hg[$x]=array_keys($X);}$Eh=array("unsigned","zerofill","unsigned zerofill");$Oe=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$Sc=array("char_length","date","from_unixtime","lower","round","sec_to_time","time_to_sec","upper");$Xc=array("avg","count","count distinct","group_concat","max","min","sum");$cc=array(array("char"=>"md5/sha1/password/encrypt/uuid","binary"=>"md5/sha1","date|time"=>"now",),array("(^|[^o])int|float|double|decimal"=>"+/-","date"=>"+ interval/- interval","time"=>"addtime/subtime","char|text"=>"concat",));}define("SERVER",$_GET[DRIVER]);define("DB",$_GET["db"]);define("ME",preg_replace('~^[^?]*/([^?]*).*~','\\1',$_SERVER["REQUEST_URI"]).'?'.(sid()?SID.'&':'').(SERVER!==null?DRIVER."=".urlencode(SERVER).'&':'').(isset($_GET["username"])?"username=".urlencode($_GET["username"]).'&':'').(DB!=""?'db='.urlencode(DB).'&'.(isset($_GET["ns"])?"ns=".urlencode($_GET["ns"])."&":""):''));$ia="4.1.0";class
|
|||
|
Adminer{var$operators;function
|
|||
|
name(){return"<a href='http://www.adminer.org/' target='_blank' id='h1'>Adminer</a>";}function
|
|||
|
credentials(){return
|
|||
|
array(SERVER,$_GET["username"],get_password());}function
|
|||
|
permanentLogin($zb=false){return
|
|||
|
password_file($zb);}function
|
|||
|
bruteForceKey(){return$_SERVER["REMOTE_ADDR"];}function
|
|||
|
database(){return
|
|||
|
DB;}function
|
|||
|
databases($Ic=true){return
|
|||
|
get_databases($Ic);}function
|
|||
|
schemas(){return
|
|||
|
schemas();}function
|
|||
|
queryTimeout(){return
|
|||
|
5;}function
|
|||
|
headers(){return
|
|||
|
true;}function
|
|||
|
head(){return
|
|||
|
true;}function
|
|||
|
loginForm(){global$Ub;echo'<table cellspacing="0">
|
|||
|
<tr><th>',lang(31),'<td>',html_select("auth[driver]",$Ub,DRIVER,"loginDriver(this);"),'<tr><th>',lang(32),'<td><input name="auth[server]" value="',h(SERVER),'" title="hostname[:port]" placeholder="localhost" autocapitalize="off">
|
|||
|
<tr><th>',lang(33),'<td><input name="auth[username]" id="username" value="',h($_GET["username"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(34),'<td><input type="password" name="auth[password]">
|
|||
|
<tr><th>',lang(35),'<td><input name="auth[db]" value="',h($_GET["db"]);?>" autocapitalize="off">
|
|||
|
</table>
|
|||
|
<script type="text/javascript">
|
|||
|
var username = document.getElementById('username');
|
|||
|
focus(username);
|
|||
|
username.form['auth[driver]'].onchange();
|
|||
|
</script>
|
|||
|
<?php
|
|||
|
|
|||
|
echo"<p><input type='submit' value='".lang(36)."'>\n",checkbox("auth[permanent]",1,$_COOKIE["adminer_permanent"],lang(37))."\n";}function
|
|||
|
login($Xd,$G){return
|
|||
|
true;}function
|
|||
|
tableName($Og){return
|
|||
|
h($Og["Name"]);}function
|
|||
|
fieldName($n,$Te=0){return'<span title="'.h($n["full_type"]).'">'.h($n["field"]).'</span>';}function
|
|||
|
selectLinks($Og,$O=""){echo'<p class="links">';$Wd=array("select"=>lang(38));if(support("table")||support("indexes"))$Wd["table"]=lang(39);if(support("table")){if(is_view($Og))$Wd["view"]=lang(40);else$Wd["create"]=lang(41);}if($O!==null)$Wd["edit"]=lang(42);foreach($Wd
|
|||
|
as$x=>$X)echo" <a href='".h(ME)."$x=".urlencode($Og["Name"]).($x=="edit"?$O:"")."'".bold(isset($_GET[$x])).">$X</a>";echo"\n";}function
|
|||
|
foreignKeys($Q){return
|
|||
|
foreign_keys($Q);}function
|
|||
|
backwardKeys($Q,$Ng){return
|
|||
|
array();}function
|
|||
|
backwardKeysPrint($Na,$K){}function
|
|||
|
selectQuery($H,$eh){global$w;return"<p><code class='jush-$w'>".h(str_replace("\n"," ",$H))."</code> <span class='time'>($eh)</span>".(support("sql")?" <a href='".h(ME)."sql=".urlencode($H)."'>".lang(10)."</a>":"")."</p>";}function
|
|||
|
rowDescription($Q){return"";}function
|
|||
|
rowDescriptions($L,$Kc){return$L;}function
|
|||
|
selectLink($X,$n){}function
|
|||
|
selectVal($X,$_,$n,$af){$J=($X===null?"<i>NULL</i>":(preg_match("~char|binary~",$n["type"])&&!preg_match("~var~",$n["type"])?"<code>$X</code>":$X));if(preg_match('~blob|bytea|raw|file~',$n["type"])&&!is_utf8($X))$J=lang(43,strlen($af));return($_?"<a href='".h($_)."'".(is_url($_)?" rel='noreferrer'":"").">$J</a>":$J);}function
|
|||
|
editVal($X,$n){return$X;}function
|
|||
|
selectColumnsPrint($M,$f){global$Sc,$Xc;print_fieldset("select",lang(44),$M);$r=0;$M[""]=array();foreach($M
|
|||
|
as$x=>$X){$X=$_GET["columns"][$x];$e=select_input(" name='columns[$r][col]' onchange='".($x!==""?"selectFieldChange(this.form)":"selectAddRow(this)").";'",$f,$X["col"]);echo"<div>".($Sc||$Xc?"<select name='columns[$r][fun]' onchange='helpClose();".($x!==""?"":" this.nextSibling.nextSibling.onchange();")."'".on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'",1).">".optionlist(array(-1=>"")+array_filter(array(lang(45)=>$Sc,lang(46)=>$Xc)),$X["fun"])."</select>"."($e)":$e)."</div>\n";$r++;}echo"</div></fieldset>\n";}function
|
|||
|
selectSearchPrint($Z,$f,$v){print_fieldset("search",lang(47),$Z);foreach($v
|
|||
|
as$r=>$u){if($u["type"]=="FULLTEXT"){echo"(<i>".implode("</i>, <i>",array_map('h',$u["columns"]))."</i>) AGAINST"," <input type='search' name='fulltext[$r]' value='".h($_GET["fulltext"][$r])."' onchange='selectFieldChange(this.form);'>",checkbox("boolean[$r]",1,isset($_GET["boolean"][$r]),"BOOL"),"<br>\n";}}$_GET["where"]=(array)$_GET["where"];reset($_GET["where"]);$Ya="this.nextSibling.onchange();";for($r=0;$r<=count($_GET["where"]);$r++){list(,$X)=each($_GET["where"]);if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"<div>".select_input(" name='where[$r][col]' onchange='$Ya'",$f,$X["col"],"(".lang(48).")"),html_select("where[$r][op]",$this->operators,$X["op"],$Ya),"<input type='search' name='where[$r][val]' value='".h($X["val"])."' onchange='".($X?"selectFieldChange(this.form)":"selectAddRow(this)").";' onkeydown='selectSearchKeydown(this, event);' onsearch='selectSearchSearch(this);'></div>\n";}}echo"</div></fieldset>\n";}function
|
|||
|
selectOrderPrint($Te,$f,$v){print_fieldset("sort",lang(49),$Te);$r=0;foreach((array)$_GET["order"]as$x=>$X){if($X!=""){echo"<div>".select_input(" name='order[$r]' onchange='selectFieldChange(this.form);'",$f,$X),checkbox("desc[$r]",1,isset($_GET["desc"][$x]),lang(50))."</div>\n";$r++;}}echo"<div>".select_input(" name='order[$r]' onchange='selectAddRow(this);'",$f),checkbox("desc[$r]",1,false,lang(50))."</div>\n","</div></fieldset>\n";}function
|
|||
|
selectLimitPrint($z){echo"<fieldset><legend>".lang(51)."</legend><div>";echo"<input type='number' name='limit' class='size' value='".h($z)."' onchange='selectFieldChange(this.form);'>","</div></fieldset>\n";}function
|
|||
|
selectLengthPrint($dh){if($dh!==null){echo"<fieldset><legend>".lang(52)."</legend><div>","<input type='number' name='text_length' class='size' value='".h($dh)."'>","</div></fieldset>\n";}}function
|
|||
|
selectActionPrint($v){echo"<fieldset><legend>".lang(53)."</legend><div>","<input type='submit' value='".lang(44)."'>"," <span id='noindex' title='".lang(54)."'></span>","<script type='text/javascript'>\n","var indexColumns = ";$f=array();foreach($v
|
|||
|
as$u){if($u["type"]!="FULLTEXT")$f[reset($u["columns"])]=1;}$f[""]=1;foreach($f
|
|||
|
as$x=>$X)json_row($x);echo";\n","selectFieldChange(document.getElementById('form'));\n","</script>\n","</div></fieldset>\n";}function
|
|||
|
selectCommandPrint(){return!information_schema(DB);}function
|
|||
|
selectImportPrint(){return!information_schema(DB);}function
|
|||
|
selectEmailPrint($hc,$f){}function
|
|||
|
selectColumnsProcess($f,$v){global$Sc,$Xc;$M=array();$Vc=array();foreach((array)$_GET["columns"]as$x=>$X){if($X["fun"]=="count"||($X["col"]!=""&&(!$X["fun"]||in_array($X["fun"],$Sc)||in_array($X["fun"],$Xc)))){$M[$x]=apply_sql_function($X["fun"],($X["col"]!=""?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$Xc))$Vc[]=$M[$x];}}return
|
|||
|
array($M,$Vc);}function
|
|||
|
selectSearchProcess($o,$v){global$w;$J=array();foreach($v
|
|||
|
as$r=>$u){if($u["type"]=="FULLTEXT"&&$_GET["fulltext"][$r]!="")$J[]="MATCH (".implode(", ",array_map('idf_escape',$u["columns"])).") AGAINST (".q($_GET["fulltext"][$r]).(isset($_GET["boolean"][$r])?" IN BOOLEAN MODE":"").")";}foreach((array)$_GET["where"]as$X){if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$qb=" $X[op]";if(preg_match('~IN$~',$X["op"])){$kd=process_length($X["val"]);$qb.=" ".($kd!=""?$kd:"(NULL)");}elseif($X["op"]=="SQL")$qb=" $X[val]";elseif($X["op"]=="LIKE %%")$qb=" LIKE ".$this->processInput($o[$X["col"]],"%$X[val]%");elseif(!preg_match('~NULL$~',$X["op"]))$qb.=" ".$this->processInput($o[$X["col"]],$X["val"]);if($X["col"]!="")$J[]=idf_escape($X["col"]).$qb;else{$lb=array();foreach($o
|
|||
|
as$C=>$n){$_d=preg_match('~char|text|enum|set~',$n["type"]);if((is_numeric($X["val"])||!preg_match('~(^|[^o])int|float|double|decimal|bit~',$n["type"]))&&(!preg_match("~[\x80-\xFF]~",$X["val"])||$_d)){$C=idf_escape($C);$lb[]=($w=="sql"&&$_d&&!preg_match('~^utf8~',$n["collation"])?"CONVERT($C USING utf8)":$C);}}$J[]=($lb?"(".implode("$qb OR ",$lb)."$qb)":"0");}}}return$J;}function
|
|||
|
selectOrderProcess($o,$v){$J=array();foreach((array)$_GET["order"]as$x=>$X){if($X!="")$J[]=(preg_match('~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~',$X)?$X:idf_escape($X)).(isset($_GET["desc"][$x])?" DESC":"");}return$J;}function
|
|||
|
selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"50");}function
|
|||
|
selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function
|
|||
|
selectEmailProcess($Z,$Kc){return
|
|||
|
false;}function
|
|||
|
selectQueryBuild($M,$Z,$Vc,$Te,$z,$E){return"";}function
|
|||
|
messageQuery($H,$eh){global$w;restart_session();$cd=&get_session("queries");$s="sql-".count($cd[$_GET["db"]]);if(strlen($H)>1e6)$H=preg_replace('~[\x80-\xFF]+$~','',substr($H,0,1e6))."\n...";$cd[$_GET["db"]][]=array($H,time(),$eh);return" <span class='time'>".@date("H:i:s")."</span> <a href='#$s' onclick=\"return !toggle('$s');\">".lang(55)."</a>"."<div id='$s' class='hidden'><pre><code class='jush-$w'>".shorten_utf8($H,1000).'</code></pre>'.($eh?" <span class='time'>($eh)</span>":'').(support("sql")?'<p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($cd[$_GET["db"]])-1)).'">'.lang(10).'</a>':'').'</div>';}function
|
|||
|
editFunctions($n){global$cc;$J=($n["null"]?"NULL/":"");foreach($cc
|
|||
|
as$x=>$Sc){if(!$x||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($Sc
|
|||
|
as$pf=>$X){if(!$pf||preg_match("~$pf~",$n["type"]))$J.="/$X";}if($x&&!preg_match('~set|blob|bytea|raw|file~',$n["type"]))$J.="/SQL";}}if($n["auto_increment"]&&!isset($_GET["select"])&&!where($_GET))$J=lang(56);return
|
|||
|
explode("/",$J);}function
|
|||
|
editInput($Q,$n,$Ia,$Y){if($n["type"]=="enum")return(isset($_GET["select"])?"<label><input type='radio'$Ia value='-1' checked><i>".lang(8)."</i></label> ":"").($n["null"]?"<label><input type='radio'$Ia value=''".($Y!==null||isset($_GET["select"])?"":" checked")."><i>NULL</i></label> ":"").enum_input("radio",$Ia,$n,$Y,0);return"";}function
|
|||
|
processInput($n,$Y,$q=""){if($q=="SQL")return$Y;$C=$n["field"];$J=q($Y);if(preg_match('~^(now|getdate|uuid)$~',$q))$J="$q()";elseif(preg_match('~^current_(date|timestamp)$~',$q))$J=$q;elseif(preg_match('~^([+-]|\\|\\|)$~',$q))$J=idf_escape($C)." $q $J";elseif(preg_match('~^[+-] interval$~',$q))$J=idf_escape($C)." $q ".(preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+$~i",$Y)?$Y:$J);elseif(preg_match('~^(addtime|subtime|concat)$~',$q))$J="$q(".idf_escape($C).", $J)";elseif(preg_match('~^(md5|sha1|password|encrypt)$~',$q))$J="$q($J)";return
|
|||
|
unconvert_field($n,$J);}function
|
|||
|
dumpOutput(){$J=array('text'=>lang(57),'file'=>lang(58));if(function_exists('gzencode'))$J['gz']='gzip';return$J;}function
|
|||
|
dumpFormat(){return
|
|||
|
array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function
|
|||
|
dumpDatabase($k){}function
|
|||
|
dumpTable($Q,$Ig,$Ad=0){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($Ig)dump_csv(array_keys(fields($Q)));}elseif($Ig){if($Ad==2){$o=array();foreach(fields($Q)as$C=>$n)$o[]=idf_escape($C)." $n[full_type]";$zb="CREATE TABLE ".table($Q)." (".implode(", ",$o).")";}else$zb=create_sql($Q,$_POST["auto_increment"]);if($zb){if($Ig=="DROP+CREATE"||$Ad==1)echo"DROP ".($Ad==2?"VIEW":"TABLE")." IF EXISTS ".table($Q).";\n";if($Ad==1)$zb=remove_definer($zb);echo"$zb;\n\n";}}}function
|
|||
|
dumpData($Q,$Ig,$H){global$h,$w;$de=($w=="sqlite"?0:1048576);if($Ig){if($_POST["format"]=="sql"){if($Ig=="TRUNCATE+INSERT")echo
|
|||
|
truncate_sql($Q).";\n";$o=fields($Q);}$I=$h->query($H,1);if($I){$td="";$Wa="";$Hd=array();$Kg="";$Dc=($Q!=''?'fetch_assoc':'fetch_row');while($K=$I->$Dc()){if(!$Hd){$Oh=array();foreach($K
|
|||
|
as$X){$n=$I->fetch_field();$Hd[]=$n->name;$x=idf_escape($n->name);$Oh[]="$x = VALUES($x)";}$Kg=($Ig=="INSERT+UPDATE"?"\nON DUPLICATE KEY UPDATE ".implode(", ",$Oh):"").";\n";}if($_POST["format"]!="sql"){if($Ig=="table"){dump_csv($Hd);$Ig="INSERT";}dump_csv($K);}else{if(!$td)$td="INSERT INTO ".table($Q)." (".implode(", ",array_map('idf_escape',$Hd)).") VALUES";foreach($K
|
|||
|
as$x=>$X){$n=$o[$x];$K[$x]=($X!==null?unconvert_field($n,preg_match('~(^|[^o])int|float|double|decimal~',$n["type"])&&$X!=''?$X:q($X)):"NULL");}$ig=($de?"\n":" ")."(".implode(",\t",$K).")";if(!$Wa)$Wa=$td.$ig;elseif(strlen($Wa)+4+strlen($ig)+strlen($Kg)<$de)$Wa.=",$ig";else{echo$Wa.$Kg;$Wa=$td.$ig;}}}if($Wa)echo$Wa.$Kg;}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$h->error)."\n";}}function
|
|||
|
dumpFilename($hd){return
|
|||
|
friendly_url($hd!=""?$hd:(SERVER!=""?SERVER:"localhost"));}function
|
|||
|
dumpHeaders($hd,$se=false){$df=$_POST["output"];$yc=(preg_match('~sql~',$_POST["format"])?"sql":($se?"tar":"csv"));header("Content-Type: ".($df=="gz"?"application/x-gzip":($yc=="tar"?"application/x-tar":($yc=="sql"||$df!="file"?"text/plain":"text/csv")."; charset=utf-8")));if($df=="gz")ob_start('ob_gzencode',1e6);return$yc;}function
|
|||
|
homepage(){echo'<p class="links">'.($_GET["ns"]==""&&support("database")?'<a href="'.h(ME).'database=">'.lang(59)."</a>\n":""),(support("scheme")?"<a href='".h(ME)."scheme='>".($_GET["ns"]!=""?lang(60):lang(61))."</a>\n":""),($_GET["ns"]!==""?'<a href="'.h(ME).'schema=">'.lang(62)."</a>\n":""),(support("privileges")?"<a href='".h(ME)."privileges='>".lang(63)."</a>\n":"");return
|
|||
|
true;}function
|
|||
|
navigation($re){global$ia,$w,$Ub,$h;echo'<h1>
|
|||
|
',$this->name(),' <span class="version">',$ia,'</span>
|
|||
|
<a href="http://www.adminer.org/#download" target="_blank" id="version">',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),'</a>
|
|||
|
</h1>
|
|||
|
';if($re=="auth"){$Hc=true;foreach((array)$_SESSION["pwds"]as$Qh=>$vg){foreach($vg
|
|||
|
as$N=>$Lh){foreach($Lh
|
|||
|
as$V=>$G){if($G!==null){if($Hc){echo"<p id='logins' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";$Hc=false;}$Ib=$_SESSION["db"][$Qh][$N][$V];foreach(($Ib?array_keys($Ib):array(""))as$k)echo"<a href='".h(auth_url($Qh,$N,$V,$k))."'>($Ub[$Qh]) ".h($V.($N!=""?"@$N":"").($k!=""?" - $k":""))."</a><br>\n";}}}}}else{if($_GET["ns"]!==""&&!$re&&DB!=""){$h->select_db(DB);$S=table_status('',true);}if(support("sql")){echo'<script type="text/javascript" src="',h(preg_replace("~\\?.*~","",ME))."?file=jush.js&version=4.1.0",'"></script>
|
|||
|
<script type="text/javascript">
|
|||
|
';if($S){$Wd=array();foreach($S
|
|||
|
as$Q=>$U)$Wd[]=preg_quote($Q,'/');echo"var jushLinks = { $w: [ '".js_escape(ME).(support("table")?"table=":"select=")."\$&', /\\b(".implode("|",$Wd).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X)echo"jushLinks.$X = jushLinks.$w;\n";}echo'bodyLoad(\'',(is_object($h)?substr($h->server_info,0,3):""),'\');
|
|||
|
</script>
|
|||
|
';}$this->databasesPrint($re);if(DB==""||!$re){echo"<p class='links'>".(support("sql")?"<a href='".h(ME)."sql='".bold(isset($_GET["sql"])&&!isset($_GET["import"])).">".lang(55)."</a>\n<a href='".h(ME)."import='".bold(isset($_GET["import"])).">".lang(64)."</a>\n":"")."";if(support("dump"))echo"<a href='".h(ME)."dump=".urlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"])."' id='dump'".bold(isset($_GET["dump"])).">".lang(65)."</a>\n";}if($_GET["ns"]!==""&&!$re&&DB!=""){echo'<a href="'.h(ME).'create="'.bold($_GET["create"]==="").">".lang(66)."</a>\n";if(!$S)echo"<p class='message'>".lang(9)."\n";else$this->tablesPrint($S);}}}function
|
|||
|
databasesPrint($re){global$b,$h;$j=$this->databases();echo'<form action="">
|
|||
|
<p id="dbs">
|
|||
|
';hidden_fields_get();$Gb=" onmousedown='dbMouseDown(event, this);' onchange='dbChange(this);'";echo"<span title='".lang(67)."'>DB</span>: ".($j?"<select name='db'$Gb>".optionlist(array(""=>"")+$j,DB)."</select>":'<input name="db" value="'.h(DB).'" autocapitalize="off">'),"<input type='submit' value='".lang(20)."'".($j?" class='hidden'":"").">\n";if($re!="db"&&DB!=""&&$h->select_db(DB)){if(support("scheme")){echo"<br>".lang(68).": <select name='ns'$Gb>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>";if($_GET["ns"]!="")set_schema($_GET["ns"]);}}echo(isset($_GET["sql"])?'<input type="hidden" name="sql" value="">':(isset($_GET["schema"])?'<input type="hidden" name="schema" value="">':(isset($_GET["dump"])?'<input type="hidden" name="dump" value="">':(isset($_GET["privileges"])?'<input type="hidden" name="privileges" value="">':"")))),"</p></form>\n";}function
|
|||
|
tablesPrint($S){echo"<p id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";foreach($S
|
|||
|
as$Q=>$Eg){echo'<a href="'.h(ME).'select='.urlencode($Q).'"'.bold($_GET["select"]==$Q||$_GET["edit"]==$Q).">".lang(69)."</a> ";$C=$this->tableName($Eg);echo(support("table")||support("indexes")?'<a href="'.h(ME).'table='.urlencode($Q).'"'.bold(in_array($Q,array($_GET["table"],$_GET["create"],$_GET["indexes"],$_GET["foreign"],$_GET["trigger"])),(is_view($Eg)?"view":""))." title='".lang(39)."'>$C</a>":"<span>$C</span>")."<br>\n";}}}$b=(function_exists('adminer_object')?adminer_object():new
|
|||
|
Adminer);if($b->operators===null)$b->operators=$Oe;function
|
|||
|
page_header($hh,$m="",$Va=array(),$ih=""){global$ca,$ia,$b,$Ub,$w;page_headers();$jh=$hh.($ih!=""?": $ih":"");$kh=strip_tags($jh.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE html>
|
|||
|
<html lang="',$ca,'" dir="',lang(70),'">
|
|||
|
<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">
|
|||
|
<title>',$kh,'</title>
|
|||
|
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME))."?file=default.css&version=4.1.0",'">
|
|||
|
<script type="text/javascript" src="',h(preg_replace("~\\?.*~","",ME))."?file=functions.js&version=4.1.0",'"></script>
|
|||
|
';if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&version=4.1.0",'">
|
|||
|
<link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME))."?file=favicon.ico&version=4.1.0",'">
|
|||
|
';if(file_exists("adminer.css")){echo'<link rel="stylesheet" type="text/css" href="adminer.css">
|
|||
|
';}}echo'
|
|||
|
<body class="',lang(70),' nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);"',(isset($_COOKIE["adminer_version"])?"":" onload=\"verifyVersion('$ia');\""),'>
|
|||
|
<script type="text/javascript">
|
|||
|
document.body.className = document.body.className.replace(/ nojs/, \' js\');
|
|||
|
</script>
|
|||
|
|
|||
|
<div id="help" class="jush-',$w,' jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout(this, event);"></div>
|
|||
|
|
|||
|
<div id="content">
|
|||
|
';if($Va!==null){$_=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($_?$_:".").'">'.$Ub[DRIVER].'</a> » ';$_=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$N=(SERVER!=""?h(SERVER):lang(32));if($Va===false)echo"$N\n";else{echo"<a href='".($_?h($_):".")."' accesskey='1' title='Alt+Shift+1'>$N</a> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Va)))echo'<a href="'.h($_."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> » ';if(is_array($Va)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> » ';foreach($Va
|
|||
|
as$x=>$X){$Nb=(is_array($X)?$X[1]:h($X));if($Nb!="")echo"<a href='".h(ME."$x=").urlencode(is_array($X)?$X[0]:$X)."'>$Nb</a> » ";}}echo"$hh\n";}}echo"<h2>$jh</h2>\n";restart_session();page_messages($m);$j=&get_session("dbs");if(DB!=""&&$j&&!in_array(DB,$j,true))$j=null;stop_session();define("PAGE_HEADER",1);}function
|
|||
|
page_headers(){global$b;header("Content-Type: text/html; charset=utf-8");header("Cache-Control: no-cache");if($b->headers()){header("X-Frame-Options: deny");header("X-XSS-Protection: 0");}}function
|
|||
|
page_messages($m){$Gh=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$ne=$_SESSION["messages"][$Gh];if($ne){echo"<div class='message'>".implode("</div>\n<div class='message'>",$ne)."</div>\n";unset($_SESSION["messages"][$Gh]);}if($m)echo"<div class='error'>$m</div>\n";}function
|
|||
|
page_footer($re=""){global$b,$T;echo'</div>
|
|||
|
|
|||
|
';switch_lang();if($re!="auth"){echo'<form action="" method="post">
|
|||
|
<p class="logout">
|
|||
|
<input type="submit" name="logout" value="',lang(71),'" id="logout">
|
|||
|
<input type="hidden" name="token" value="',$T,'">
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
';}echo'<div id="menu">
|
|||
|
';$b->navigation($re);echo'</div>
|
|||
|
<script type="text/javascript">setupSubmitHighlight(document);</script>
|
|||
|
';}function
|
|||
|
int32($ue){while($ue>=2147483648)$ue-=4294967296;while($ue<=-2147483649)$ue+=4294967296;return(int)$ue;}function
|
|||
|
long2str($W,$Vh){$ig='';foreach($W
|
|||
|
as$X)$ig.=pack('V',$X);if($Vh)return
|
|||
|
substr($ig,0,end($W));return$ig;}function
|
|||
|
str2long($ig,$Vh){$W=array_values(unpack('V*',str_pad($ig,4*ceil(strlen($ig)/4),"\0")));if($Vh)$W[]=strlen($ig);return$W;}function
|
|||
|
xxtea_mx($bi,$ai,$Lg,$Dd){return
|
|||
|
int32((($bi>>5&0x7FFFFFF)^$ai<<2)+(($ai>>3&0x1FFFFFFF)^$bi<<4))^int32(($Lg^$ai)+($Dd^$bi));}function
|
|||
|
encrypt_string($Gg,$x){if($Gg=="")return"";$x=array_values(unpack("V*",pack("H*",md5($x))));$W=str2long($Gg,true);$ue=count($W)-1;$bi=$W[$ue];$ai=$W[0];$Hf=floor(6+52/($ue+1));$Lg=0;while($Hf-->0){$Lg=int32($Lg+0x9E3779B9);$bc=$Lg>>2&3;for($ef=0;$ef<$ue;$ef++){$ai=$W[$ef+1];$te=xxtea_mx($bi,$ai,$Lg,$x[$ef&3^$bc]);$bi=int32($W[$ef]+$te);$W[$ef]=$bi;}$ai=$W[0];$te=xxtea_mx($bi,$ai,$Lg,$x[$ef&3^$bc]);$bi=int32($W[$ue]+$te);$W[$ue]=$bi;}return
|
|||
|
long2str($W,false);}function
|
|||
|
decrypt_string($Gg,$x){if($Gg=="")return"";if(!$x)return
|
|||
|
false;$x=array_values(unpack("V*",pack("H*",md5($x))));$W=str2long($Gg,false);$ue=count($W)-1;$bi=$W[$ue];$ai=$W[0];$Hf=floor(6+52/($ue+1));$Lg=int32($Hf*0x9E3779B9);while($Lg){$bc=$Lg>>2&3;for($ef=$ue;$ef>0;$ef--){$bi=$W[$ef-1];$te=xxtea_mx($bi,$ai,$Lg,$x[$ef&3^$bc]);$ai=int32($W[$ef]-$te);$W[$ef]=$ai;}$bi=$W[$ue];$te=xxtea_mx($bi,$ai,$Lg,$x[$ef&3^$bc]);$ai=int32($W[0]-$te);$W[0]=$ai;$Lg=int32($Lg-0x9E3779B9);}return
|
|||
|
long2str($W,true);}$h='';$bd=$_SESSION["token"];if(!$bd)$_SESSION["token"]=rand(1,1e6);$T=get_token();$qf=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($x)=explode(":",$X);$qf[$x]=$X;}}function
|
|||
|
add_invalid_login(){global$b;$Fc=get_temp_dir()."/adminer.invalid";$Pc=@fopen($Fc,"r+");if(!$Pc){$Pc=@fopen($Fc,"w");if(!$Pc)return;}flock($Pc,LOCK_EX);$wd=unserialize(stream_get_contents($Pc));$eh=time();if($wd){foreach($wd
|
|||
|
as$xd=>$X){if($X[0]<$eh)unset($wd[$xd]);}}$vd=&$wd[$b->bruteForceKey()];if(!$vd)$vd=array($eh+30*60,0);$vd[1]++;$tg=serialize($wd);rewind($Pc);fwrite($Pc,$tg);ftruncate($Pc,strlen($tg));flock($Pc,LOCK_UN);fclose($Pc);}$Ja=$_POST["auth"];if($Ja){$wd=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$vd=$wd[$b->bruteForceKey()];$_e=($vd[1]>30?$vd[0]-time():0);if($_e>0)auth_error(lang(72,ceil($_e/60)));session_regenerate_id();$l=$Ja["driver"];$N=$Ja["server"];$V=$Ja["username"];$G=(string)$Ja["password"];$k=$Ja["db"];set_password($l,$N,$V,$G);$_SESSION["db"][$l][$N][$V][$k]=true;if($Ja["permanent"]){$x=base64_encode($l)."-".base64_encode($N)."-".base64_encode($V)."-".base64_encode($k);$Bf=$b->permanentLogin(true);$qf[$x]="$x:".base64_encode($Bf?encrypt_string($G,$Bf):"");cookie("adminer_permanent",implode(" ",$qf));}if(count($_POST)==1||DRIVER!=$l||SERVER!=$N||$_GET["username"]!==$V||DB!=$k)redirect(auth_url($l,$N,$V,$k));}elseif($_POST["logout"]){if($bd&&!verify_token()){page_header(lang(71),lang(73));page_footer("db");exit;}else{foreach(array("pwds","db","dbs","queries")as$x)set_session($x,null);unset_permanent();redirect(substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1),lang(74));}}elseif($qf&&!$_SESSION["pwds"]){session_regenerate_id();$Bf=$b->permanentLogin();foreach($qf
|
|||
|
as$x=>$X){list(,$eb)=explode(":",$X);list($Qh,$N,$V,$k)=array_map('base64_decode',explode("-",$x));set_password($Qh,$N,$V,decrypt_string(base64_decode($eb),$Bf));$_SESSION["db"][$Qh][$N][$V][$k]=true;}}function
|
|||
|
unset_permanent(){global$qf;foreach($qf
|
|||
|
as$x=>$X){list($Qh,$N,$V,$k)=array_map('base64_decode',explode("-",$x));if($Qh==DRIVER&&$N==SERVER&&$V==$_GET["username"]&&$k==DB)unset($qf[$x]);}cookie("adminer_permanent",implode(" ",$qf));}function
|
|||
|
auth_error($m){global$b,$bd;$wg=session_name();if(!$_COOKIE[$wg]&&$_GET[$wg]&&ini_bool("session.use_only_cookies"))$m=lang(75);elseif(isset($_GET["username"])){if(($_COOKIE[$wg]||$_GET[$wg])&&!$bd)$m=lang(76);else{add_invalid_login();$G=get_password();if($G!==null){if($G===false)$m.='<br>'.lang(77,'<code>permanentLogin()</code>');set_password(DRIVER,SERVER,$_GET["username"],null);}unset_permanent();}}$F=session_get_cookie_params();cookie("adminer_key",($_COOKIE["adminer_key"]?$_COOKIE["adminer_key"]:rand_string()),$F["lifetime"]);page_header(lang(36),$m,null);echo"<form action='' method='post'>\n";$b->loginForm();echo"<div>";hidden_fields($_POST,array("auth"));echo"</div>\n","</form>\n";page_footer("auth");exit;}if(isset($_GET["username"])){if(!class_exists("Min_DB")){unset($_SESSION["pwds"][DRIVER]);unset_permanent();page_header(lang(78),lang(79,implode(", ",$wf)),false);page_footer("auth");exit;}$h=connect();}$l=new
|
|||
|
Min_Driver($h);if(!is_object($h)||!$b->login($_GET["username"],get_password()))auth_error((is_string($h)?$h:lang(80)));if($Ja&&$_POST["token"])$_POST["token"]=$T;$m='';if($_POST){if(!verify_token()){$qd="max_input_vars";$he=ini_get($qd);if(extension_loaded("suhosin")){foreach(array("suhosin.request.max_vars","suhosin.post.max_vars")as$x){$X=ini_get($x);if($X&&(!$he||$X<$he)){$qd=$x;$he=$X;}}}$m=(!$_POST["token"]&&$he?lang(81,"'$qd'"):lang(73));}}elseif($_SERVER["REQUEST_METHOD"]=="POST"){$m=lang(82,"'post_max_size'");if(isset($_GET["sql"]))$m.=' '.lang(83);}if(!ini_bool("session.use_cookies")||@ini_set("session.use_cookies",false)!==false)session_write_close();function
|
|||
|
select($I,$i=null,$We=array()){global$w;$Wd=array();$v=array();$f=array();$Sa=array();$yh=array();$J=array();odd('');for($r=0;$K=$I->fetch_row();$r++){if(!$r){echo"<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($Cd=0;$Cd<count($K);$Cd++){$n=$I->fetch_field();$C=$n->name;$Ve=$n->orgtable;$Ue=$n->orgname;$J[$n->table]=$Ve;if($We&&$w=="sql")$Wd[$Cd]=($C=="table"?"table=":($C=="possible_keys"?"indexes=":null));elseif($Ve!=""){if(!isset($v[$Ve])){$v[$Ve]=array();foreach(indexes($Ve,$i)as$u){if($u["type"]=="PRIMARY"){$v[$Ve]=array_flip($u["columns"]);break;}}$f[$Ve]=$v[$Ve];}if(isset($f[$Ve][$Ue])){unset($f[$Ve][$Ue]);$v[$Ve][$Ue]=$Cd;$Wd[$Cd]=$Ve;}}if($n->charsetnr==63)$Sa[$Cd]=true;$yh[$Cd]=$n->type;echo"<th".($Ve!=""||$n->name!=$Ue?" title='".h(($Ve!=""?"$Ve.":"").$Ue)."'":"").">".h($C).($We?doc_link(array('sql'=>"explain-output.html#explain_".strtolower($C))):"");}echo"</thead>\n";}echo"<tr".odd().">";foreach($K
|
|||
|
as$x=>$X){if($X===null)$X="<i>NULL</i>";elseif($Sa[$x]&&!is_utf8($X))$X="<i>".lang(43,strlen($X))."</i>";elseif(!strlen($X))$X=" ";else{$X=h($X);if($yh[$x]==254)$X="<code>$X</code>";}if(isset($Wd[$x])&&!$f[$Wd[$x]]){if($We&&$w=="sql"){$Q=$K[array_search("table=",$Wd)];$_=$Wd[$x].urlencode($We[$Q]!=""?$We[$Q]:$Q);}else{$_="edit=".urlencode($Wd[$x]);foreach($v[$Wd[$x]]as$ib=>$Cd)$_.="&where".urlencode("[".bracket_escape($ib)."]")."=".urlencode($K[$Cd]);}$X="<a href='".h(ME.$_)."'>$X</a>";}echo"<td>$X";}}echo($r?"</table>":"<p class='message'>".lang(12))."\n";return$J;}function
|
|||
|
referencable_primary($qg){$J=array();foreach(table_status('',true)as$Pg=>$Q){if($Pg!=$qg&&fk_support($Q)){foreach(fields($Pg)as$n){if($n["primary"]){if($J[$Pg]){unset($J[$Pg]);break;}$J[$Pg]=$n;}}}}return$J;}function
|
|||
|
textarea($C,$Y,$L=10,$lb=80){global$w;echo"<textarea name='$C' rows='$L' cols='$lb' class='sqlarea jush-$w' spellcheck='false' wrap='off'>";if(is_array($Y)){foreach($Y
|
|||
|
as$X)echo
|
|||
|
h($X[0])."\n\n\n";}else
|
|||
|
echo
|
|||
|
h($Y);echo"</textarea>";}function
|
|||
|
edit_type($x,$n,$kb,$Lc=array()){global$Hg,$yh,$Eh,$Ke;$U=$n["type"];echo'<td><select name="',$x,'[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"',on_help("getTarget(event).value",1),'>';if($U&&!isset($yh[$U])&&!isset($Lc[$U]))array_unshift($Hg,$U);if($Lc)$Hg[lang(84)]=$Lc;echo
|
|||
|
optionlist($Hg,$U),'</select>
|
|||
|
<td><input name="',$x,'[length]" value="',h($n["length"]),'" size="3" onfocus="editingLengthFocus(this);"',(!$n["length"]&&preg_match('~var(char|binary)$~',$U)?" class='required'":""),' onchange="editingLengthChange(this);" onkeyup="this.onchange();"><td class="options">';echo"<select name='$x"."[collation]'".(preg_match('~(char|text|enum|set)$~',$U)?"":" class='hidden'").'><option value="">('.lang(85).')'.optionlist($kb,$n["collation"]).'</select>',($Eh?"<select name='$x"."[unsigned]'".(!$U||preg_match('~((^|[^o])int|float|double|decimal)$~',$U)?"":" class='hidden'").'><option>'.optionlist($Eh,$n["unsigned"]).'</select>':''),(isset($n['on_update'])?"<select name='$x"."[on_update]'".(preg_match('~timestamp|datetime~',$U)?"":" class='hidden'").'>'.optionlist(array(""=>"(".lang(86).")","CURRENT_TIMESTAMP"),$n["on_update"]).'</select>':''),($Lc?"<select name='$x"."[on_delete]'".(preg_match("~`~",$U)?"":" class='hidden'")."><option value=''>(".lang(87).")".optionlist(explode("|",$Ke),$n["on_delete"])."</select> ":" ");}function
|
|||
|
process_length($y){global$mc;return(preg_match("~^\\s*\\(?\\s*$mc(?:\\s*,\\s*$mc)*+\\s*\\)?\\s*\$~",$y)&&preg_match_all("~$mc~",$y,$be)?"(".implode(",",$be[0]).")":preg_replace('~^[0-9].*~','(\0)',preg_replace('~[^-0-9,+()[\]]~','',$y)));}function
|
|||
|
process_type($n,$jb="COLLATE"){global$Eh;return" $n[type]".process_length($n["length"]).(preg_match('~(^|[^o])int|float|double|decimal~',$n["type"])&&in_array($n["unsigned"],$Eh)?" $n[unsigned]":"").(preg_match('~char|text|enum|set~',$n["type"])&&$n["collation"]?" $jb ".q($n["collation"]):"");}function
|
|||
|
process_field($n,$wh){global$w;$Kb=$n["default"];return
|
|||
|
array(idf_escape(trim($n["field"])),process_type($wh),($n["null"]?" NULL":" NOT NULL"),(isset($Kb)?" DEFAULT ".((preg_match('~time~',$n["type"])&&preg_match('~^CURRENT_TIMESTAMP$~i',$Kb))||($n["type"]=="bit"&&preg_match("~^([0-9]+|b'[0-1]+')\$~",$Kb))||($w=="pgsql"&&preg_match("~^[a-z]+\\(('[^']*')+\\)\$~",$Kb))?$Kb:q($Kb)):""),(preg_match('~timestamp|datetime~',$n["type"])&&$n["on_update"]?" ON UPDATE $n[on_update]":""),(support("comment")&&$n["comment"]!=""?" COMMENT ".q($n["comment"]):""),($n["auto_increment"]?auto_increment():null),);}function
|
|||
|
type_class($U){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$x=>$X){if(preg_match("~$x|$X~",$U))return" class='$x'";}}function
|
|||
|
edit_fields($o,$kb,$U="TABLE",$Lc=array(),$pb=false){global$h,$rd;echo'<thead><tr class="wrap">
|
|||
|
';if($U=="PROCEDURE"){echo'<td> ';}echo'<th>',($U=="TABLE"?lang(88):lang(89)),'<td>',lang(90),'<textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur(this);"></textarea>
|
|||
|
<td>',lang(91),'<td>',lang(92);if($U=="TABLE"){echo'<td>NULL
|
|||
|
<td><input type="radio" name="auto_increment_col" value=""><acronym title="',lang(56),'">AI</acronym>',doc_link(array('sql'=>"example-auto-increment.html",'sqlite'=>"autoinc.html",'pgsql'=>"datatype.html#DATATYPE-SERIAL",'mssql'=>"ms186775.aspx",)),'<td>',lang(93),(support("comment")?"<td".($pb?"":" class='hidden'").">".lang(94):"");}echo'<td>',"<input type='image' class='icon' name='add[".(support("move_col")?0:count($o))."]' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&version=4.1.0' alt='+' title='".lang(95)."'>",'<script type="text/javascript">row_count = ',count($o),';</script>
|
|||
|
</thead>
|
|||
|
<tbody onkeydown="return editingKeydown(event);">
|
|||
|
';foreach($o
|
|||
|
as$r=>$n){$r++;$Xe=$n[($_POST?"orig":"field")];$Rb=(isset($_POST["add"][$r-1])||(isset($n["field"])&&!$_POST["drop_col"][$r]))&&(support("drop_col")||$Xe=="");echo'<tr',($Rb?"":" style='display: none;'"),'>
|
|||
|
',($U=="PROCEDURE"?"<td>".html_select("fields[$r][inout]",explode("|",$rd),$n["inout"]):""),'<th>';if($Rb){echo'<input name="fields[',$r,'][field]" value="',h($n["field"]),'" onchange="editingNameChange(this);',($n["field"]!=""||count($o)>1?'':' editingAddRow(this);" onkeyup="if (this.value) editingAddRow(this);'),'" maxlength="64" autocapitalize="off">';}echo'<input type="hidden" name="fields[',$r,'][orig]" value="',h($Xe),'">
|
|||
|
';edit_type("fields[$r]",$n,$kb,$Lc);if($U=="TABLE"){echo'<td>',checkbox("fields[$r][null]",1,$n["null"],"","","block"),'<td><label class="block"><input type="radio" name="auto_increment_col" value="',$r,'"';if($n["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[$r][has_default]",1,$n["has_default"]),'<input name="fields[',$r,'][default]" value="',h($n["default"]),'" onkeyup="keyupChange.call(this);" onchange="this.previousSibling.checked = true;">
|
|||
|
',(support("comment")?"<td".($pb?"":" class='hidden'")."><input name='fields[$r][comment]' value='".h($n["comment"])."' maxlength='".($h->server_info>=5.5?1024:255)."'>":"");}echo"<td>",(support("move_col")?"<input type='image' class='icon' name='add[$r]' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&version=4.1.0' alt='+' title='".lang(95)."' onclick='return !editingAddRow(this, 1);'> "."<input type='image' class='icon' name='up[$r]' src='".h(preg_replace("~\\?.*~","",ME))."?file=up.gif&version=4.1.0' alt='^' title='".lang(96)."'> "."<input type='image' class='icon' name='down[$r]' src='".h(preg_replace("~\\?.*~","",ME))."?file=down.gif&version=4.1.0' alt='v' title='".lang(97)."'> ":""),($Xe==""||support("drop_col")?"<input type='image' class='icon' name='drop_col[$r]' src='".h(preg_replace("~\\?.*~","",ME))."?file=cross.gif&version=4.1.0' alt='x' title='".lang(98)."' onclick=\"return !editingRemoveRow(this, 'fields\$1[field]');\">":""),"\n";}}function
|
|||
|
process_fields(&$o){ksort($o);$D=0;if($_POST["up"]){$Nd=0;foreach($o
|
|||
|
as$x=>$n){if(key($_POST["up"])==$x){unset($o[$x]);array_splice($o,$Nd,0,array($n));break;}if(isset($n["field"]))$Nd=$D;$D++;}}elseif($_POST["down"]){$Nc=false;foreach($o
|
|||
|
as$x=>$n){if(isset($n["field"])&&$Nc){unset($o[key($_POST["down"])]);array_splice($o,$D,0,array($Nc));break;}if(key($_POST["down"])==$x)$Nc=$n;$D++;}}elseif($_POST["add"]){$o=array_values($o);array_splice($o,key($_POST["add"]),0,array(array()));}elseif(!$_POST["drop_col"])return
|
|||
|
false;return
|
|||
|
true;}function
|
|||
|
normalize_enum($B){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($B[0][0].$B[0][0],$B[0][0],substr($B[0],1,-1))),'\\'))."'";}function
|
|||
|
grant($Tc,$Df,$f,$Je){if(!$Df)return
|
|||
|
true;if($Df==array("ALL PRIVILEGES","GRANT OPTION"))return($Tc=="GRANT"?queries("$Tc ALL PRIVILEGES$Je WITH GRANT OPTION"):queries("$Tc ALL PRIVILEGES$Je")&&queries("$Tc GRANT OPTION$Je"));return
|
|||
|
queries("$Tc ".preg_replace('~(GRANT OPTION)\\([^)]*\\)~','\\1',implode("$f, ",$Df).$f).$Je);}function
|
|||
|
drop_create($Vb,$zb,$Wb,$bh,$Yb,$A,$me,$ke,$le,$Ge,$xe){if($_POST["drop"])query_redirect($Vb,$A,$me);elseif($Ge=="")query_redirect($zb,$A,$le);elseif($Ge!=$xe){$Ab=queries($zb);queries_redirect($A,$ke,$Ab&&queries($Vb));if($Ab)queries($Wb);}else
|
|||
|
queries_redirect($A,$ke,queries($bh)&&queries($Yb)&&queries($Vb)&&queries($zb));}function
|
|||
|
create_trigger($Je,$K){global$w;$gh=" $K[Timing] $K[Event]".($K["Event"]=="UPDATE OF"?" ".idf_escape($K["Of"]):"");return"CREATE TRIGGER ".idf_escape($K["Trigger"]).($w=="mssql"?$Je.$gh:$gh.$Je).rtrim(" $K[Type]\n$K[Statement]",";").";";}function
|
|||
|
create_routine($eg,$K){global$rd;$O=array();$o=(array)$K["fields"];ksort($o);foreach($o
|
|||
|
as$n){if($n["field"]!="")$O[]=(preg_match("~^($rd)\$~",$n["inout"])?"$n[inout] ":"").idf_escape($n["field"]).process_type($n,"CHARACTER SET");}return"CREATE $eg ".idf_escape(trim($K["name"]))." (".implode(", ",$O).")".(isset($_GET["function"])?" RETURNS".process_type($K["returns"],"CHARACTER SET"):"").($K["language"]?" LANGUAGE $K[language]":"").rtrim("\n$K[definition]",";").";";}function
|
|||
|
remove_definer($H){return
|
|||
|
preg_replace('~^([A-Z =]+) DEFINER=`'.preg_replace('~@(.*)~','`@`(%|\\1)',logged_user()).'`~','\\1',$H);}function
|
|||
|
format_foreign_key($p){global$Ke;return" FOREIGN KEY (".implode(", ",array_map('idf_escape',$p["source"])).") REFERENCES ".table($p["table"])." (".implode(", ",array_map('idf_escape',$p["target"])).")".(preg_match("~^($Ke)\$~",$p["on_delete"])?" ON DELETE $p[on_delete]":"").(preg_match("~^($Ke)\$~",$p["on_update"])?" ON UPDATE $p[on_update]":"");}function
|
|||
|
tar_file($Fc,$lh){$J=pack("a100a8a8a8a12a12",$Fc,644,0,0,decoct($lh->size),decoct(time()));$cb=8*32;for($r=0;$r<strlen($J);$r++)$cb+=ord($J[$r]);$J.=sprintf("%06o",$cb)."\0 ";echo$J,str_repeat("\0",512-strlen($J));$lh->send();echo
|
|||
|
str_repeat("\0",511-($lh->size+511)%512);}function
|
|||
|
ini_bytes($qd){$X=ini_get($qd);switch(strtolower(substr($X,-1))){case'g':$X*=1024;case'm':$X*=1024;case'k':$X*=1024;}return$X;}function
|
|||
|
doc_link($of){global$w,$h;$Hh=array('sql'=>"http://dev.mysql.com/doc/refman/".substr($h->server_info,0,3)."/en/",'sqlite'=>"http://www.sqlite.org/",'pgsql'=>"http://www.postgresql.org/docs/".substr($h->server_info,0,3)."/static/",'mssql'=>"http://msdn.microsoft.com/library/",'oracle'=>"http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",);return($of[$w]?"<a href='$Hh[$w]$of[$w]' target='_blank' rel='noreferrer'><sup>?</sup></a>":"");}function
|
|||
|
ob_gzencode($P){return
|
|||
|
gzencode($P);}function
|
|||
|
db_size($k){global$h;if(!$h->select_db($k))return"?";$J=0;foreach(table_status()as$R)$J+=$R["Data_length"]+$R["Index_length"];return
|
|||
|
format_number($J);}function
|
|||
|
connect_error(){global$b,$h,$T,$m,$Ub;if(DB!=""){header("HTTP/1.1 404 Not Found");page_header(lang(35).": ".h(DB),lang(99),true);}else{if($_POST["db"]&&!$m)queries_redirect(substr(ME,0,-1),lang(100),drop_databases($_POST["db"]));page_header(lang(101),$m,false);echo"<p class='links'>\n";foreach(array('database'=>lang(102),'privileges'=>lang(63),'processlist'=>lang(103),'variables'=>lang(104),'status'=>lang(105),)as$x=>$X){if(support($x))echo"<a href='".h(ME)."$x='>$X</a>\n";}echo"<p>".lang(106,$Ub[DRIVER],"<b>".h($h->server_info)."</b>","<b>$h->extension</b>")."\n","<p>".lang(107,"<b>".h(logged_user())."</b>")."\n";$j=$b->databases();if($j){$lg=support("scheme");$kb=collations();echo"<form action='' method='post'>\n","<table cellspacing='0' class='checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n","<thead><tr>".(support("database")?"<td> ":"")."<th>".lang(35)." - <a href='".h(ME)."refresh=1'>".lang(108)."</a>"."<td>".lang(109)."<td>".lang(110)."<td>".lang(111)." - <a href='".h(ME)."dbsize=1' onclick=\"return !ajaxSetHtml('".js_escape(ME)."script=connect');\">".lang(112)."</a>"."</thead>\n";$j=($_GET["dbsize"]?count_tables($j):array_flip($j));foreach($j
|
|||
|
as$k=>$S){$dg=h(ME)."db=".urlencode($k);echo"<tr".odd().">".(support("database")?"<td>".checkbox("db[]",$k,in_array($k,(array)$_POST["db"])):""),"<th><a href='$dg'>".h($k)."</a>";$d=nbsp(db_collation($k,$kb));echo"<td>".(support("database")?"<a href='$dg".($lg?"&ns=":"")."&database=' title='".lang(59)."'>$d</a>":$d),"<td align='right'><a href='$dg&schema=' id='tables-".h($k)."' title='".lang(62)."'>".($_GET["dbsize"]?$S:"?")."</a>","<td align='right' id='size-".h($k)."'>".($_GET["dbsize"]?db_size($k):"?"),"\n";}echo"</table>\n",(support("database")?"<fieldset><legend>".lang(113)." <span id='selected'></span></legend><div>\n"."<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n"."<input type='submit' name='drop' value='".lang(114)."'".confirm().">\n"."</div></fieldset>\n":""),"<script type='text/javascript'>tableCheck();</script>\n","<input type='hidden' name='token' value='$T'>\n","</form>\n";}}page_footer("db");}if(isset($_GET["status"]))$_GET["variables"]=$_GET["status"];if(isset($_GET["import"]))$_GET["sql"]=$_GET["import"];if(!(DB!=""?$h->select_db(DB):isset($_GET["sql"])||isset($_GET["dump"])||isset($_GET["database"])||isset($_GET["processlist"])||isset($_GET["privileges"])||isset($_GET["user"])||isset($_GET["variables"])||$_GET["script"]=="connect"||$_GET["script"]=="kill")){if(DB!=""||$_GET["refresh"]){restart_session();set_session("dbs",null);}connect_error();exit;}if(support("scheme")&&DB!=""&&$_GET["ns"]!==""){if(!isset($_GET["ns"]))redirect(preg_replace('~ns=[^&]*&~','',ME)."ns=".get_schema());if(!set_schema($_GET["ns"])){header("HTTP/1.1 404 Not Found");page_header(lang(68).": ".h($_GET["ns"]),lang(115),true);page_footer("ns");exit;}}$Ke="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";class
|
|||
|
TmpFile{var$handler;var$size;function
|
|||
|
TmpFile(){$this->handler=tmpfile();}function
|
|||
|
write($ub){$this->size+=strlen($ub);fwrite($this->handler,$ub);}function
|
|||
|
send(){fseek($this->handler,0);fpassthru($this->handler);fclose($this->handler);}}$mc="'(?:''|[^'\\\\]|\\\\.)*'";$rd="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"];$o=fields($a);header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));$M=array(idf_escape($_GET["field"]));$I=$l->select($a,$M,array(where($_GET,$o)),$M);$K=($I?$I->fetch_row():array());echo$K[0];exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$o=fields($a);if(!$o)$m=error();$R=table_status1($a,true);page_header(($o&&is_view($R)?lang(116):lang(117)).": ".h($a),$m);$b->selectLinks($R);$ob=$R["Comment"];if($ob!="")echo"<p>".lang(94).": ".h($ob)."\n";if($o){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(118)."<td>".lang(90).(support("comment")?"<td>".lang(94):"")."</thead>\n";foreach($o
|
|||
|
as$n){echo"<tr".odd()."><th>".h($n["field"]),"<td title='".h($n["collation"])."'>".h($n["full_type"]).($n["null"]?" <i>NULL</i>":"").($n["auto_increment"]?" <i>".lang(56)."</i>":""),(isset($n["default"])?" [<b>".h($n["default"])."</b>]":""),(support("comment")?"<td>".nbsp($n["comment"]):""),"\n";}echo"</table>\n";}if(!is_view($R)){if(support("indexes")){echo"<h3 id='indexes'>".lang(119)."</h3>\n";$v=indexes($a);if($v){echo"<table cellspacing='0'>\n";foreach($v
|
|||
|
as$C=>$u){ksort($u["columns"]);$Af=array();foreach($u["columns"]as$x=>$X)$Af[]="<i>".h($X)."</i>".($u["lengths"][$x]?"(".$u["lengths"][$x].")":"").($u["descs"][$x]?" DESC":"");echo"<tr title='".h($C)."'><th>$u[type]<td>".implode(", ",$Af)."\n";}echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'indexes='.urlencode($a).'">'.lang(120)."</a>\n";}if(fk_support($R)){echo"<h3 id='foreign-keys'>".lang(84)."</h3>\n";$Lc=foreign_keys($a);if($Lc){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(121)."<td>".lang(122)."<td>".lang(87)."<td>".lang(86)."<td> </thead>\n";foreach($Lc
|
|||
|
as$C=>$p){echo"<tr title='".h($C)."'>","<th><i>".implode("</i>, <i>",array_map('h',$p["source"]))."</i>","<td><a href='".h($p["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($p["db"]),ME):($p["ns"]!=""?preg_replace('~ns=[^&]*~',"ns=".urlencode($p["ns"]),ME):ME))."table=".urlencode($p["table"])."'>".($p["db"]!=""?"<b>".h($p["db"])."</b>.":"").($p["ns"]!=""?"<b>".h($p["ns"])."</b>.":"").h($p["table"])."</a>","(<i>".implode("</i>, <i>",array_map('h',$p["target"]))."</i>)","<td>".nbsp($p["on_delete"])."\n","<td>".nbsp($p["on_update"])."\n",'<td><a href="'.h(ME.'foreign='.urlencode($a).'&name='.urlencode($C)).'">'.lang(123).'</a>';}echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'foreign='.urlencode($a).'">'.lang(124)."</a>\n";}}if(support(is_view($R)?"view_trigger":"trigger")){echo"<h3 id='triggers'>".lang(125)."</h3>\n";$vh=triggers($a);if($vh){echo"<table cellspacing='0'>\n";foreach($vh
|
|||
|
as$x=>$X)echo"<tr valign='top'><td>".h($X[0])."<td>".h($X[1])."<th>".h($x)."<td><a href='".h(ME.'trigger='.urlencode($a).'&name='.urlencode($x))."'>".lang(123)."</a>\n";echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'trigger='.urlencode($a).'">'.lang(126)."</a>\n";}}elseif(isset($_GET["schema"])){page_header(lang(62),"",array(),h(DB.($_GET["ns"]?".$_GET[ns]":"")));$Rg=array();$Sg=array();$C="adminer_schema";$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE[($_COOKIE["$C-".DB]?"$C-".DB:$C)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$be,PREG_SET_ORDER);foreach($be
|
|||
|
as$r=>$B){$Rg[$B[1]]=array($B[2],$B[3]);$Sg[]="\n\t'".js_escape($B[1])."': [ $B[2], $B[3] ]";}$nh=0;$Pa=-1;$kg=array();$Sf=array();$Rd=array();foreach(table_status('',true)as$Q=>$R){if(is_view($R))continue;$tf=0;$kg[$Q]["fields"]=array();foreach(fields($Q)as$C=>$n){$tf+=1.25;$n["pos"]=$tf;$kg[$Q]["fields"][$C]=$n;}$kg[$Q]["pos"]=($Rg[$Q]?$Rg[$Q]:array($nh,0));foreach($b->foreignKeys($Q)as$X){if(!$X["db"]){$Pd=$Pa;if($Rg[$Q][1]||$Rg[$X["table"]][1])$Pd=min(floatval($Rg[$Q][1]),floatval($Rg[$X["table"]][1]))-1;else$Pa-=.1;while($Rd[(string)$Pd])$Pd-=.0001;$kg[$Q]["references"][$X["table"]][(string)$Pd]=array($X["source"],$X["target"]);$Sf[$X["table"]][$Q][(string)$Pd]=$X["target"];$Rd[(string)$Pd]=true;}}$nh=max($nh,$kg[$Q]["pos"][0]+2.5+$tf);}echo'<div id="schema" style="height: ',$nh,'em;" onselectstart="return false;">
|
|||
|
<script type="text/javascript">
|
|||
|
var tablePos = {',implode(",",$Sg)."\n",'};
|
|||
|
var em = document.getElementById(\'schema\').offsetHeight / ',$nh,';
|
|||
|
document.onmousemove = schemaMousemove;
|
|||
|
document.onmouseup = function (ev) {
|
|||
|
schemaMouseup(ev, \'',js_escape(DB),'\');
|
|||
|
};
|
|||
|
</script>
|
|||
|
';foreach($kg
|
|||
|
as$C=>$Q){echo"<div class='table' style='top: ".$Q["pos"][0]."em; left: ".$Q["pos"][1]."em;' onmousedown='schemaMousedown(this, event);'>",'<a href="'.h(ME).'table='.urlencode($C).'"><b>'.h($C)."</b></a>";foreach($Q["fields"]as$n){$X='<span'.type_class($n["type"]).' title="'.h($n["full_type"].($n["null"]?" NULL":'')).'">'.h($n["field"]).'</span>';echo"<br>".($n["primary"]?"<i>$X</i>":$X);}foreach((array)$Q["references"]as$Yg=>$Tf){foreach($Tf
|
|||
|
as$Pd=>$Pf){$Qd=$Pd-$Rg[$C][1];$r=0;foreach($Pf[0]as$_g)echo"\n<div class='references' title='".h($Yg)."' id='refs$Pd-".($r++)."' style='left: $Qd"."em; top: ".$Q["fields"][$_g]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$Qd)."em;'></div></div>";}}foreach((array)$Sf[$C]as$Yg=>$Tf){foreach($Tf
|
|||
|
as$Pd=>$f){$Qd=$Pd-$Rg[$C][1];$r=0;foreach($f
|
|||
|
as$Xg)echo"\n<div class='references' title='".h($Yg)."' id='refd$Pd-".($r++)."' style='left: $Qd"."em; top: ".$Q["fields"][$Xg]["pos"]."em; height: 1.25em; background: url(".h(preg_replace("~\\?.*~","",ME))."?file=arrow.gif) no-repeat right center;&version=4.1.0'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$Qd)."em;'></div></div>";}}echo"\n</div>\n";}foreach($kg
|
|||
|
as$C=>$Q){foreach((array)$Q["references"]as$Yg=>$Tf){foreach($Tf
|
|||
|
as$Pd=>$Pf){$qe=$nh;$fe=-10;foreach($Pf[0]as$x=>$_g){$uf=$Q["pos"][0]+$Q["fields"][$_g]["pos"];$vf=$kg[$Yg]["pos"][0]+$kg[$Yg]["fields"][$Pf[1][$x]]["pos"];$qe=min($qe,$uf,$vf);$fe=max($fe,$uf,$vf);}echo"<div class='references' id='refl$Pd' style='left: $Pd"."em; top: $qe"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($fe-$qe)."em;'></div></div>\n";}}}echo'</div>
|
|||
|
<p class="links"><a href="',h(ME."schema=".urlencode($ea)),'" id="schema-link">',lang(127),'</a>
|
|||
|
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$m){$xb="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$x)$xb.="&$x=".urlencode($_POST[$x]);cookie("adminer_export",substr($xb,1));$S=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$yc=dump_headers((count($S)==1?key($S):DB),(DB==""||count($S)>1));$zd=preg_match('~sql~',$_POST["format"]);if($zd){echo"-- Adminer $ia ".$Ub[DRIVER]." dump\n\n";if($w=="sql"){echo"SET NAMES utf8;
|
|||
|
SET time_zone = '+00:00';
|
|||
|
".($_POST["data_style"]?"SET foreign_key_checks = 0;
|
|||
|
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
|||
|
":"")."
|
|||
|
";$h->query("SET time_zone = '+00:00';");}}$Ig=$_POST["db_style"];$j=array(DB);if(DB==""){$j=$_POST["databases"];if(is_string($j))$j=explode("\n",rtrim(str_replace("\r","",$j),"\n"));}foreach((array)$j
|
|||
|
as$k){$b->dumpDatabase($k);if($h->select_db($k)){if($zd&&preg_match('~CREATE~',$Ig)&&($zb=$h->result("SHOW CREATE DATABASE ".idf_escape($k),1))){if($Ig=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($k).";\n";echo"$zb;\n";}if($zd){if($Ig)echo
|
|||
|
use_sql($k).";\n\n";$cf="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$eg){foreach(get_rows("SHOW $eg STATUS WHERE Db = ".q($k),null,"-- ")as$K)$cf.=($Ig!='DROP+CREATE'?"DROP $eg IF EXISTS ".idf_escape($K["Name"]).";;\n":"").remove_definer($h->result("SHOW CREATE $eg ".idf_escape($K["Name"]),2)).";;\n\n";}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$K)$cf.=($Ig!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($K["Name"]).";;\n":"").remove_definer($h->result("SHOW CREATE EVENT ".idf_escape($K["Name"]),3)).";;\n\n";}if($cf)echo"DELIMITER ;;\n\n$cf"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$Th=array();foreach(table_status('',true)as$C=>$R){$Q=(DB==""||in_array($C,(array)$_POST["tables"]));$Db=(DB==""||in_array($C,(array)$_POST["data"]));if($Q||$Db){if($yc=="tar"){$lh=new
|
|||
|
TmpFile;ob_start(array($lh,'write'),1e5);}$b->dumpTable($C,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$Th[]=$C;elseif($Db){$o=fields($C);$b->dumpData($C,$_POST["data_style"],"SELECT *".convert_fields($o,$o)." FROM ".table($C));}if($zd&&$_POST["triggers"]&&$Q&&($vh=trigger_sql($C,$_POST["table_style"])))echo"\nDELIMITER ;;\n$vh\nDELIMITER ;\n";if($yc=="tar"){ob_end_flush();tar_file((DB!=""?"":"$k/")."$C.csv",$lh);}elseif($zd)echo"\n";}}foreach($Th
|
|||
|
as$Sh)$b->dumpTable($Sh,$_POST["table_style"],1);if($yc=="tar")echo
|
|||
|
pack("x512");}}}if($zd)echo"-- ".$h->result("SELECT NOW()")."\n";exit;}page_header(lang(128),$m,($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),h(DB));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0">
|
|||
|
';$Hb=array('','USE','DROP+CREATE','CREATE');$Tg=array('','DROP+CREATE','CREATE');$Eb=array('','TRUNCATE+INSERT','INSERT');if($w=="sql")$Eb[]='INSERT+UPDATE';parse_str($_COOKIE["adminer_export"],$K);if(!$K)$K=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($K["events"])){$K["routines"]=$K["events"]=($_GET["dump"]=="");$K["triggers"]=$K["table_style"];}echo"<tr><th>".lang(129)."<td>".html_select("output",$b->dumpOutput(),$K["output"],0)."\n";echo"<tr><th>".lang(130)."<td>".html_select("format",$b->dumpFormat(),$K["format"],0)."\n";echo($w=="sqlite"?"":"<tr><th>".lang(35)."<td>".html_select('db_style',$Hb,$K["db_style"]).(support("routine")?checkbox("routines",1,$K["routines"],lang(131)):"").(support("event")?checkbox("events",1,$K["events"],lang(132)):"")),"<tr><th>".lang(110)."<td>".html_select('table_style',$Tg,$K["table_style"]).checkbox("auto_increment",1,$K["auto_increment"],lang(56)).(support("trigger")?checkbox("triggers",1,$K["triggers"],lang(125)):""),"<tr><th>".lang(133)."<td>".html_select('data_style',$Eb,$K["data_style"]),'</table>
|
|||
|
<p><input type="submit" value="',lang(128),'">
|
|||
|
<input type="hidden" name="token" value="',$T,'">
|
|||
|
|
|||
|
<table cellspacing="0">
|
|||
|
';$yf=array();if(DB!=""){$ab=($a!=""?"":" checked");echo"<thead><tr>","<th style='text-align: left;'><label class='block'><input type='checkbox' id='check-tables'$ab onclick='formCheck(this, /^tables\\[/);'>".lang(110)."</label>","<th style='text-align: right;'><label class='block'>".lang(133)."<input type='checkbox' id='check-data'$ab onclick='formCheck(this, /^data\\[/);'></label>","</thead>\n";$Th="";$Ug=tables_list();foreach($Ug
|
|||
|
as$C=>$U){$xf=preg_replace('~_.*~','',$C);$ab=($a==""||$a==(substr($a,-1)=="%"?"$xf%":$C));$Af="<tr><td>".checkbox("tables[]",$C,$ab,$C,"checkboxClick(event, this); formUncheck('check-tables');","block");if($U!==null&&!preg_match('~table~i',$U))$Th.="$Af\n";else
|
|||
|
echo"$Af<td align='right'><label class='block'><span id='Rows-".h($C)."'></span>".checkbox("data[]",$C,$ab,"","checkboxClick(event, this); formUncheck('check-data');")."</label>\n";$yf[$xf]++;}echo$Th;if($Ug)echo"<script type='text/javascript'>ajaxSetHtml('".js_escape(ME)."script=db');</script>\n";}else{echo"<thead><tr><th style='text-align: left;'><label class='block'><input type='checkbox' id='check-databases'".($a==""?" checked":"")." onclick='formCheck(this, /^databases\\[/);'>".lang(35)."</label></thead>\n";$j=$b->databases();if($j){foreach($j
|
|||
|
as$k){if(!information_schema($k)){$xf=preg_replace('~_.*~','',$k);echo"<tr><td>".checkbox("databases[]",$k,$a==""||$a=="$xf%",$k,"formUncheck('check-databases');","block")."\n";$yf[$xf]++;}}}else
|
|||
|
echo"<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";}echo'</table>
|
|||
|
</form>
|
|||
|
';$Hc=true;foreach($yf
|
|||
|
as$x=>$X){if($x!=""&&$X>1){echo($Hc?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$x%")."'>".h($x)."</a>";$Hc=false;}}}elseif(isset($_GET["privileges"])){page_header(lang(63));$I=$h->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$Tc=$I;if(!$I)$I=$h->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");echo"<form action=''><p>\n";hidden_fields_get();echo"<input type='hidden' name='db' value='".h(DB)."'>\n",($Tc?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".lang(33)."<th>".lang(32)."<th> </thead>\n";while($K=$I->fetch_assoc())echo'<tr'.odd().'><td>'.h($K["User"])."<td>".h($K["Host"]).'<td><a href="'.h(ME.'user='.urlencode($K["User"]).'&host='.urlencode($K["Host"])).'">'.lang(10)."</a>\n";if(!$Tc||DB!="")echo"<tr".odd()."><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='".lang(10)."'>\n";echo"</table>\n","</form>\n",'<p class="links"><a href="'.h(ME).'user=">'.lang(134)."</a>";}elseif(isset($_GET["sql"])){if(!$m&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$dd=&get_session("queries");$cd=&$dd[DB];if(!$m&&$_POST["clear"]){$cd=array();redirect(remove_from_uri("history"));}page_header((isset($_GET["import"])?lang(64):lang(55)),$m);if(!$m&&$_POST){$Pc=false;if(!isset($_GET["import"]))$H=$_POST["query"];elseif($_POST["webfile"]){$Pc=@fopen((file_exists("adminer.sql")?"adminer.sql":"compress.zlib://adminer.sql.gz"),"rb");$H=($Pc?fread($Pc,1e6):false);}else$H=get_file("sql_file",true);if(is_string($H)){if(function_exists('memory_get_usage'))@ini_set("memory_limit",max(ini_bytes("memory_limit"),2*strlen($H)+memory_get_usage()+8e6));if($H!=""&&strlen($H)<1e6){$Hf=$H.(preg_match("~;[ \t\r\n]*\$~",$H)?"":";");if(!$cd||reset(end($cd))!=$Hf){restart_session();$cd[]=array($Hf,time());set_session("queries",$dd);stop_session();}}$Ag="(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\r?\n)";$Mb=";";$D=0;$jc=true;$i=connect();if(is_object($i)&&DB!="")$i->select_db(DB);$nb=0;$oc=array();$Vd=0;$hf='[\'"'.($w=="sql"?'`#':($w=="sqlite"?'`[':($w=="mssql"?'[':''))).']|/\\*|-- |$'.($w=="pgsql"?'|\\$[^$]*\\$':'');$oh=microtime(true);parse_str($_COOKIE["adminer_export"],$wa);$ac=$b->dumpFormat();unset($ac["sql"]);while($H!=""){if(!$D&&preg_match("~^$Ag*DELIMITER\\s+(\\S+)~i",$H,$B)){$Mb=$B[1];$H=substr($H,strlen($B[0]));}else{preg_match('('.preg_quote($Mb)."\\s*|$hf)",$H,$B,PREG_OFFSET_CAPTURE,$D);list($Nc,$tf)=$B[0];if(!$Nc&&$Pc&&!feof($Pc))$H.=fread($Pc,1e5);else{if(!$Nc&&rtrim($H)=="")break;$D=$tf+strlen($Nc);if($Nc&&rtrim($Nc)!=$Mb){while(preg_match('('.($Nc=='/*'?'\\*/':($Nc=='['?']':(preg_match('~^-- |^#~',$Nc)?"\n":preg_quote($Nc)."|\\\\."))).'|$)s',$H,$B,PREG_OFFSET_CAPTURE,$D)){$ig=$B[0][0];if(!$ig&&$Pc&&!feof($Pc))$H.=fread($Pc,1e5);else{$D=$B[0][1]+strlen($ig);if($ig[0]!="\\")break;}}}else{$jc=false;$Hf=substr($H,0,$tf);$nb++;$Af="<pre id='sql-$nb'><code class='jush-$w'>".shorten_utf8(trim($Hf),1000)."</code></pre>\n";if(!$_POST["only_errors"]){echo$Af;ob_flush();flush();}$Dg=microtime(true);if($h->multi_query($Hf)&&is_object($i)&&preg_match("~^$Ag*USE\\b~isU",$Hf))$i->query($Hf);do{$I=$h->store_result();$eh=" <span class='time'>(".format_time($Dg).")</span>".(strlen($Hf)<1000?" <a href='".h(ME)."sql=".urlencode(trim($Hf))."'>".lang(10)."</a>":"");if($h->error){echo($_POST["only_errors"]?$Af:""),"<p class='error'>".lang(135).($h->errno?" ($h->errno)":"").": ".error()."\n";$oc[]=" <a href='#sql-$nb'>$nb</a>";if($_POST["error_stops"])break
|
|||
|
2;}elseif(is_object($I)){$We=select($I,$i);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n","<p>".($I->num_rows?lang(136,$I->num_rows):"").$eh;$s="export-$nb";$xc=", <a href='#$s' onclick=\"return !toggle('$s');\">".lang(128)."</a><span id='$s' class='hidden'>: ".html_select("output",$b->dumpOutput(),$wa["output"])." ".html_select("format",$ac,$wa["format"])."<input type='hidden' name='query' value='".h($Hf)."'>"." <input type='submit' name='export' value='".lang(128)."'><input type='hidden' name='token' value='$T'></span>\n";if($i&&preg_match("~^($Ag|\\()*SELECT\\b~isU",$Hf)&&($wc=explain($i,$Hf))){$s="explain-$nb";echo", <a href='#$s' onclick=\"return !toggle('$s');\">EXPLAIN</a>$xc","<div id='$s' class='hidden'>\n";select($wc,$i,$We);echo"</div>\n";}else
|
|||
|
echo$xc;echo"</form>\n";}}else{if(preg_match("~^$Ag*(CREATE|DROP|ALTER)$Ag+(DATABASE|SCHEMA)\\b~isU",$Hf)){restart_session();set_session("dbs",null);stop_session();}if(!$_POST["only_errors"])echo"<p class='message' title='".h($h->info)."'>".lang(137,$h->affected_rows)."$eh\n";}$Dg=microtime(true);}while($h->next_result());$Vd+=substr_count($Hf.$Nc,"\n");$H=substr($H,$D);$D=0;}}}}if($jc)echo"<p class='message'>".lang(138)."\n";elseif($_POST["only_errors"]){echo"<p class='message'>".lang(139,$nb-count($oc))," <span class='time'>(".format_time($oh).")</span>\n";}elseif($oc&&$nb>1)echo"<p class='error'>".lang(135).": ".implode("",$oc)."\n";}else
|
|||
|
echo"<p class='error'>".upload_error($H)."\n";}echo'
|
|||
|
<form action="" method="post" enctype="multipart/form-data" id="form">
|
|||
|
';$tc="<input type='submit' value='".lang(140)."' title='Ctrl+Enter'>";if(!isset($_GET["import"])){$Hf=$_GET["sql"];if($_POST)$Hf=$_POST["query"];elseif($_GET["history"]=="all")$Hf=$cd;elseif($_GET["history"]!="")$Hf=$cd[$_GET["history"]][0];echo"<p>";textarea("query",$Hf,20);echo($_POST?"":"<script type='text/javascript'>focus(document.getElementsByTagName('textarea')[0]);</script>\n"),"<p>$tc\n";}else{echo"<fieldset><legend>".lang(141)."</legend><div>",(ini_bool("file_uploads")?'<input type="file" name="sql_file[]" multiple> (< '.ini_get("upload_max_filesize").'B)':lang(142)),"\n$tc","</div></fieldset>\n","<fieldset><legend>".lang(143)."</legend><div>",lang(144,"<code>adminer.sql".(extension_loaded("zlib")?"[.gz]":"")."</code>"),' <input type="submit" name="webfile" value="'.lang(145).'">',"</div></fieldset>\n","<p>";}echo
|
|||
|
checkbox("error_stops",1,($_POST?$_POST["error_stops"]:isset($_GET["import"])),lang(146))."\n",checkbox("only_errors",1,($_POST?$_POST["only_errors"]:isset($_GET["import"])),lang(147))."\n","<input type='hidden' name='token' value='$T'>\n";if(!isset($_GET["import"])&&$cd){print_fieldset("history",lang(148),$_GET["history"]!="");for($X=end($cd);$X;$X=prev($cd)){$x=key($cd);list($Hf,$eh,$ec)=$X;echo'<a href="'.h(ME."sql=&history=$x").'">'.lang(10)."</a>"." <span class='time' title='".@date('Y-m-d',$eh)."'>".@date("H:i:s",$eh)."</span>"." <code class='jush-$w'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$Hf)))),80,"</code>").($ec?" <span class='time'>($ec)</span>":"")."<br>\n";}echo"<input type='submit' name='clear' value='".lang(149)."'>\n","<a href='".h(ME."sql=&history=all")."'>".lang(150)."</a>\n","</div></fieldset>\n";}echo'</form>
|
|||
|
';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$o=fields($a);$Z=(isset($_GET["select"])?(count($_POST["check"])==1?where_check($_POST["check"][0],$o):""):where($_GET,$o));$Fh=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($o
|
|||
|
as$C=>$n){if(!isset($n["privileges"][$Fh?"update":"insert"])||$b->fieldName($n)=="")unset($o[$C]);}if($_POST&&!$m&&!isset($_GET["select"])){$A=$_POST["referer"];if($_POST["insert"])$A=($Fh?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$A))$A=ME."select=".urlencode($a);$v=indexes($a);$Ah=unique_array($_GET["where"],$v);$Kf="\nWHERE $Z";if(isset($_POST["delete"]))queries_redirect($A,lang(151),$l->delete($a,$Kf,!$Ah));else{$O=array();foreach($o
|
|||
|
as$C=>$n){$X=process_input($n);if($X!==false&&$X!==null)$O[idf_escape($C)]=$X;}if($Fh){if(!$O)redirect($A);queries_redirect($A,lang(152),$l->update($a,$O,$Kf,!$Ah));if(is_ajax()){page_headers();page_messages($m);exit;}}else{$I=$l->insert($a,$O);$Od=($I?last_id():0);queries_redirect($A,lang(153,($Od?" $Od":"")),$I);}}}$K=null;if($_POST["save"])$K=(array)$_POST["fields"];elseif($Z){$M=array();foreach($o
|
|||
|
as$C=>$n){if(isset($n["privileges"]["select"])){$Fa=convert_field($n);if($_POST["clone"]&&$n["auto_increment"])$Fa="''";if($w=="sql"&&preg_match("~enum|set~",$n["type"]))$Fa="1*".idf_escape($C);$M[]=($Fa?"$Fa AS ":"").idf_escape($C);}}$K=array();if(!support("table"))$M=array("*");if($M){$I=$l->select($a,$M,array($Z),$M,array(),(isset($_GET["select"])?2:1));$K=$I->fetch_assoc();if(!$K)$K=false;if(isset($_GET["select"])&&(!$K||$I->fetch_assoc()))$K=null;}}if(!support("table")&&!$o){if(!$Z){$I=$l->select($a,array("*"),$Z,array("*"));$K=($I?$I->fetch_assoc():false);if(!$K)$K=array($l->primary=>"");}if($K){foreach($K
|
|||
|
as$x=>$X){if(!$Z)$K[$x]=null;$o[$x]=array("field"=>$x,"null"=>($x!=$l->primary),"auto_increment"=>($x==$l->primary));}}}edit_form($a,$o,$K,$Fh);}elseif(isset($_GET["create"])){$a=$_GET["create"];$if=array();foreach(array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST')as$x)$if[$x]=$x;$Rf=referencable_primary($a);$Lc=array();foreach($Rf
|
|||
|
as$Pg=>$n)$Lc[str_replace("`","``",$Pg)."`".str_replace("`","``",$n["field"])]=$Pg;$Ze=array();$R=array();if($a!=""){$Ze=fields($a);$R=table_status($a);if(!$R)$m=lang(9);}$K=$_POST;$K["fields"]=(array)$K["fields"];if($K["auto_increment_col"])$K["fields"][$K["auto_increment_col"]]["auto_increment"]=true;if($_POST&&!process_fields($K["fields"])&&!$m){if($_POST["drop"])queries_redirect(substr(ME,0,-1),lang(154),drop_tables(array($a)));else{$o=array();$Ca=array();$Ih=false;$Jc=array();ksort($K["fields"]);$Ye=reset($Ze);$_a=" FIRST";foreach($K["fields"]as$x=>$n){$p=$Lc[$n["type"]];$wh=($p!==null?$Rf[$p]:$n);if($n["field"]!=""){if(!$n["has_default"])$n["default"]=null;if($x==$K["auto_increment_col"])$n["auto_increment"]=true;$Ff=process_field($n,$wh);$Ca[]=array($n["orig"],$Ff,$_a);if($Ff!=process_field($Ye,$Ye)){$o[]=array($n["orig"],$Ff,$_a);if($n["orig"]!=""||$_a)$Ih=true;}if($p!==null)$Jc[idf_escape($n["field"])]=($a!=""&&$w!="sqlite"?"ADD":" ").format_foreign_key(array('table'=>$Lc[$n["type"]],'source'=>array($n["field"]),'target'=>array($wh["field"]),'on_delete'=>$n["on_delete"],));$_a=" AFTER ".idf_escape($n["field"]);}elseif($n["orig"]!=""){$Ih=true;$o[]=array($n["orig"]);}if($n["orig"]!=""){$Ye=next($Ze);if(!$Ye)$_a="";}}$kf="";if($if[$K["partition_by"]]){$lf=array();if($K["partition_by"]=='RANGE'||$K["partition_by"]=='LIST'){foreach(array_filter($K["partition_names"])as$x=>$X){$Y=$K["partition_values"][$x];$lf[]="\n PARTITION ".idf_escape($X)." VALUES ".($K["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$kf.="\nPARTITION BY $K[partition_by]($K[partition])".($lf?" (".implode(",",$lf)."\n)":($K["partitions"]?" PARTITIONS ".(+$K["partitions"]):""));}elseif(support("partitioning")&&preg_match("~partitioned~",$R["Create_options"]))$kf.="\nREMOVE PARTITIONING";$je=lang(155);if($a==""){cookie("adminer_engine",$K["Engine"]);$je=lang(156);}$C=trim($K["name"]);queries_redirect(ME.(support("table")?"table=":"select=").urlencode($C),$je,alter_table($a,$C,($w=="sqlite"&&($Ih||$Jc)?$Ca:$o),$Jc,$K["Comment"],($K["Engine"]&&$K["Engine"]!=$R["Engine"]?$K["Engine"]:""),($K["Collation"]&&$K["Collation"]!=$R["Collation"]?$K["Collation"]:""),($K["Auto_increment"]!=""?+$K["Auto_increment"]:""),$kf));}}page_header(($a!=""?lang(41):lang(66)),$m,array("table"=>$a),h($a));if(!$_POST){$K=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($yh["int"])?"int":(isset($yh["integer"])?"integer":"")))),"partition_names"=>array(""),);if($a!=""){$K=$R;$K["name"]=$a;$K["fields"]=array();if(!$_GET["auto_increment"])$K["Auto_increment"]="";foreach($Ze
|
|||
|
as$n){$n["has_default"]=isset($n["default"]);$K["fields"][]=$n;}if(support("partitioning")){$Qc="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$I=$h->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $Qc ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($K["partition_by"],$K["partitions"],$K["partition"])=$I->fetch_row();$lf=get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $Qc AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");$lf[""]="";$K["partition_names"]=array_keys($lf);$K["partition_values"]=array_values($lf);}}}$kb=collations();$lc=engines();foreach($lc
|
|||
|
as$kc){if(!strcasecmp($kc,$K["Engine"])){$K["Engine"]=$kc;break;}}echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>
|
|||
|
';if(support("columns")||$a==""){echo
|
|||
|
lang(157),': <input name="name" maxlength="64" value="',h($K["name"]),'" autocapitalize="off">
|
|||
|
';if($a==""&&!$_POST){?><script type='text/javascript'>focus(document.getElementById('form')['name']);</script><?php }echo($lc?"<select name='Engine' onchange='helpClose();'".on_help("getTarget(event).value",1).">".optionlist(array(""=>"(".lang(158).")")+$lc,$K["Engine"])."</select>":""),' ',($kb&&!preg_match("~sqlite|mssql~",$w)?html_select("Collation",array(""=>"(".lang(85).")")+$kb,$K["Collation"]):""),' <input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if(support("columns")){echo'<table cellspacing="0" id="edit-fields" class="nowrap">
|
|||
|
';$pb=($_POST?$_POST["comments"]:$K["Comment"]!="");if(!$_POST&&!$pb){foreach($K["fields"]as$n){if($n["comment"]!=""){$pb=true;break;}}}edit_fields($K["fields"],$kb,"TABLE",$Lc,$pb);echo'</table>
|
|||
|
<p>
|
|||
|
',lang(56),': <input type="number" name="Auto_increment" size="6" value="',h($K["Auto_increment"]),'">
|
|||
|
',checkbox("defaults",1,true,lang(93),"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();\"".($pb?" checked":"").">".lang(94)."</label>".' <input name="Comment" id="Comment" value="'.h($K["Comment"]).'" maxlength="'.($h->server_info>=5.5?2048:60).'"'.($pb?'':' class="hidden"').'>':''),'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if($a!=""){echo'<input type="submit" name="drop" value="',lang(114),'"',confirm(),'>';}if(support("partitioning")){$jf=preg_match('~RANGE|LIST~',$K["partition_by"]);print_fieldset("partition",lang(159),$K["partition_by"]);echo'<p>
|
|||
|
',"<select name='partition_by' onchange='partitionByChange(this);'".on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')",1).">".optionlist(array(""=>"")+$if,$K["partition_by"])."</select>",'(<input name="partition" value="',h($K["partition"]),'">)
|
|||
|
',lang(160),': <input type="number" name="partitions" class="size',($jf||!$K["partition_by"]?" hidden":""),'" value="',h($K["partitions"]),'">
|
|||
|
<table cellspacing="0" id="partition-table"',($jf?"":" class='hidden'"),'>
|
|||
|
<thead><tr><th>',lang(161),'<th>',lang(162),'</thead>
|
|||
|
';foreach($K["partition_names"]as$x=>$X){echo'<tr>','<td><input name="partition_names[]" value="'.h($X).'"'.($x==count($K["partition_names"])-1?' onchange="partitionNameChange(this);"':'').' autocapitalize="off">','<td><input name="partition_values[]" value="'.h($K["partition_values"][$x]).'">';}echo'</table>
|
|||
|
</div></fieldset>
|
|||
|
';}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$md=array("PRIMARY","UNIQUE","INDEX");$R=table_status($a,true);if(preg_match('~MyISAM|M?aria'.($h->server_info>=5.6?'|InnoDB':'').'~i',$R["Engine"]))$md[]="FULLTEXT";$v=indexes($a);$zf=array();if($w=="mongo"){$zf=$v["_id_"];unset($md[0]);unset($v["_id_"]);}$K=$_POST;if($_POST&&!$m&&!$_POST["add"]&&!$_POST["drop_col"]){$c=array();foreach($K["indexes"]as$u){$C=$u["name"];if(in_array($u["type"],$md)){$f=array();$Td=array();$Ob=array();$O=array();ksort($u["columns"]);foreach($u["columns"]as$x=>$e){if($e!=""){$y=$u["lengths"][$x];$Nb=$u["descs"][$x];$O[]=idf_escape($e).($y?"(".(+$y).")":"").($Nb?" DESC":"");$f[]=$e;$Td[]=($y?$y:null);$Ob[]=$Nb;}}if($f){$uc=$v[$C];if($uc){ksort($uc["columns"]);ksort($uc["lengths"]);ksort($uc["descs"]);if($u["type"]==$uc["type"]&&array_values($uc["columns"])===$f&&(!$uc["lengths"]||array_values($uc["lengths"])===$Td)&&array_values($uc["descs"])===$Ob){unset($v[$C]);continue;}}$c[]=array($u["type"],$C,$O);}}}foreach($v
|
|||
|
as$C=>$uc)$c[]=array($uc["type"],$C,"DROP");if(!$c)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),lang(163),alter_indexes($a,$c));}page_header(lang(119),$m,array("table"=>$a),h($a));$o=array_keys(fields($a));if($_POST["add"]){foreach($K["indexes"]as$x=>$u){if($u["columns"][count($u["columns"])]!="")$K["indexes"][$x]["columns"][]="";}$u=end($K["indexes"]);if($u["type"]||array_filter($u["columns"],'strlen'))$K["indexes"][]=array("columns"=>array(1=>""));}if(!$K){foreach($v
|
|||
|
as$x=>$u){$v[$x]["name"]=$x;$v[$x]["columns"][]="";}$v[]=array("columns"=>array(1=>""));$K["indexes"]=$v;}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
<thead><tr>
|
|||
|
<th>',lang(164),'<th><input type="submit" style="left: -1000px; position: absolute;">',lang(165),'<th>',lang(166);?>
|
|||
|
<th><noscript><input type='image' class='icon' name='add[0]' src='" . h(preg_replace("~\\?.*~", "", ME)) . "?file=plus.gif&version=4.1.0' alt='+' title='<?php echo
|
|||
|
lang(95),'\'></noscript>
|
|||
|
</thead>
|
|||
|
';if($zf){echo"<tr><td>PRIMARY<td>";foreach($zf["columns"]as$x=>$e){echo
|
|||
|
select_input(" disabled",$o,$e),"<label><input disabled type='checkbox'>".lang(50)."</label> ";}echo"<td><td>\n";}$Cd=1;foreach($K["indexes"]as$u){if(!$_POST["drop_col"]||$Cd!=key($_POST["drop_col"])){echo"<tr><td>".html_select("indexes[$Cd][type]",array(-1=>"")+$md,$u["type"],($Cd==count($K["indexes"])?"indexesAddRow(this);":1)),"<td>";ksort($u["columns"]);$r=1;foreach($u["columns"]as$x=>$e){echo"<span>".select_input(" name='indexes[$Cd][columns][$r]' onchange=\"".($r==count($u["columns"])?"indexesAddColumn":"indexesChangeColumn")."(this, '".js_escape($w=="sql"?"":$_GET["indexes"]."_")."');\"",($o?array_combine($o,$o):$o),$e),($w=="sql"||$w=="mssql"?"<input type='number' name='indexes[$Cd][lengths][$r]' class='size' value='".h($u["lengths"][$x])."'>":""),($w!="sql"?checkbox("indexes[$Cd][descs][$r]",1,$u["descs"][$x],lang(50)):"")," </span>";$r++;}echo"<td><input name='indexes[$Cd][name]' value='".h($u["name"])."' autocapitalize='off'>\n","<td><input type='image' class='icon' name='drop_col[$Cd]' src='".h(preg_replace("~\\?.*~","",ME))."?file=cross.gif&version=4.1.0' alt='x' title='".lang(98)."' onclick=\"return !editingRemoveRow(this, 'indexes\$1[type]');\">\n";}$Cd++;}echo'</table>
|
|||
|
<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["database"])){$K=$_POST;if($_POST&&!$m&&!isset($_POST["add_x"])){restart_session();$C=trim($K["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(167),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace('~\bdb=[^&]*&~','',ME)."db=".urlencode($C),lang(168),rename_database($C,$K["collation"]));}else{$j=explode("\n",str_replace("\r","",$C));$Jg=true;$Nd="";foreach($j
|
|||
|
as$k){if(count($j)==1||$k!=""){if(!create_database($k,$K["collation"]))$Jg=false;$Nd=$k;}}queries_redirect(ME."db=".urlencode($Nd),lang(169),$Jg);}}else{if(!$K["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($C).(preg_match('~^[a-z0-9_]+$~i',$K["collation"])?" COLLATE $K[collation]":""),substr(ME,0,-1),lang(170));}}page_header(DB!=""?lang(59):lang(171),$m,array(),h(DB));$kb=collations();$C=DB;if($_POST)$C=$K["name"];elseif(DB!="")$K["collation"]=db_collation(DB,$kb);elseif($w=="sql"){foreach(get_vals("SHOW GRANTS")as$Tc){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~',$Tc,$B)&&$B[1]){$C=stripcslashes(idf_unescape("`$B[2]`"));break;}}}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
',($_POST["add_x"]||strpos($C,"\n")?'<textarea id="name" name="name" rows="10" cols="40">'.h($C).'</textarea><br>':'<input name="name" id="name" value="'.h($C).'" maxlength="64" autocapitalize="off">')."\n".($kb?html_select("collation",array(""=>"(".lang(85).")")+$kb,$K["collation"]).doc_link(array('sql'=>"charset-charsets.html",'mssql'=>"ms187963.aspx",)):"");?>
|
|||
|
<script type='text/javascript'>focus(document.getElementById('name'));</script>
|
|||
|
<input type="submit" value="<?php echo
|
|||
|
lang(14),'">
|
|||
|
';if(DB!="")echo"<input type='submit' name='drop' value='".lang(114)."'".confirm().">\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type='image' class='icon' name='add' src='".h(preg_replace("~\\?.*~","",ME))."?file=plus.gif&version=4.1.0' alt='+' title='".lang(95)."'>\n";echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["scheme"])){$K=$_POST;if($_POST&&!$m){$_=preg_replace('~ns=[^&]*&~','',ME)."ns=";if($_POST["drop"])query_redirect("DROP SCHEMA ".idf_escape($_GET["ns"]),$_,lang(172));else{$C=trim($K["name"]);$_.=urlencode($C);if($_GET["ns"]=="")query_redirect("CREATE SCHEMA ".idf_escape($C),$_,lang(173));elseif($_GET["ns"]!=$C)query_redirect("ALTER SCHEMA ".idf_escape($_GET["ns"])." RENAME TO ".idf_escape($C),$_,lang(174));else
|
|||
|
redirect($_);}}page_header($_GET["ns"]!=""?lang(60):lang(61),$m);if(!$K)$K["name"]=$_GET["ns"];echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" id="name" value="',h($K["name"]);?>" autocapitalize="off">
|
|||
|
<script type='text/javascript'>focus(document.getElementById('name'));</script>
|
|||
|
<input type="submit" value="<?php echo
|
|||
|
lang(14),'">
|
|||
|
';if($_GET["ns"]!="")echo"<input type='submit' name='drop' value='".lang(114)."'".confirm().">\n";echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header(lang(175).": ".h($da),$m);$eg=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$kd=array();$cf=array();foreach($eg["fields"]as$r=>$n){if(substr($n["inout"],-3)=="OUT")$cf[$r]="@".idf_escape($n["field"])." AS ".idf_escape($n["field"]);if(!$n["inout"]||substr($n["inout"],0,2)=="IN")$kd[]=$r;}if(!$m&&$_POST){$Xa=array();foreach($eg["fields"]as$x=>$n){if(in_array($x,$kd)){$X=process_input($n);if($X===false)$X="''";if(isset($cf[$x]))$h->query("SET @".idf_escape($n["field"])." = $X");}$Xa[]=(isset($cf[$x])?"@".idf_escape($n["field"]):$X);}$H=(isset($_GET["callf"])?"SELECT":"CALL")." ".idf_escape($da)."(".implode(", ",$Xa).")";echo"<p><code class='jush-$w'>".h($H)."</code> <a href='".h(ME)."sql=".urlencode($H)."'>".lang(10)."</a>\n";if(!$h->multi_query($H))echo"<p class='error'>".error()."\n";else{$i=connect();if(is_object($i))$i->select_db(DB);do{$I=$h->store_result();if(is_object($I))select($I,$i);else
|
|||
|
echo"<p class='message'>".lang(176,$h->affected_rows)."\n";}while($h->next_result());if($cf)select($h->query("SELECT ".implode(", ",$cf)));}}echo'
|
|||
|
<form action="" method="post">
|
|||
|
';if($kd){echo"<table cellspacing='0'>\n";foreach($kd
|
|||
|
as$x){$n=$eg["fields"][$x];$C=$n["field"];echo"<tr><th>".$b->fieldName($n);$Y=$_POST["fields"][$C];if($Y!=""){if($n["type"]=="enum")$Y=+$Y;if($n["type"]=="set")$Y=array_sum($Y);}input($n,$Y,(string)$_POST["function"][$C]);echo"\n";}echo"</table>\n";}echo'<p>
|
|||
|
<input type="submit" value="',lang(175),'">
|
|||
|
<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$K=$_POST;if($_POST&&!$m&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$je=($_POST["drop"]?lang(177):($C!=""?lang(178):lang(179)));$A=ME."table=".urlencode($a);$K["source"]=array_filter($K["source"],'strlen');ksort($K["source"]);$Xg=array();foreach($K["source"]as$x=>$X)$Xg[$x]=$K["target"][$x];$K["target"]=$Xg;if($w=="sqlite")queries_redirect($A,$je,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($K)))));else{$c="ALTER TABLE ".table($a);$Vb="\nDROP ".($w=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$Vb,$A,$je);else{query_redirect($c.($C!=""?"$Vb,":"")."\nADD".format_foreign_key($K),$A,$je);$m=lang(180)."<br>$m";}}}page_header(lang(181),$m,array("table"=>$a),h($a));if($_POST){ksort($K["source"]);if($_POST["add"])$K["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$K["target"]=array();}elseif($C!=""){$Lc=foreign_keys($a);$K=$Lc[$C];$K["source"][]="";}else{$K["table"]=$a;$K["source"]=array("");}$_g=array_keys(fields($a));$Xg=($a===$K["table"]?$_g:array_keys(fields($K["table"])));$Qf=array_keys(array_filter(table_status('',true),'fk_support'));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
';if($K["db"]==""&&$K["ns"]==""){echo
|
|||
|
lang(182),':
|
|||
|
',html_select("table",$Qf,$K["table"],"this.form['change-js'].value = '1'; this.form.submit();"),'<input type="hidden" name="change-js" value="">
|
|||
|
<noscript><p><input type="submit" name="change" value="',lang(183),'"></noscript>
|
|||
|
<table cellspacing="0">
|
|||
|
<thead><tr><th>',lang(121),'<th>',lang(122),'</thead>
|
|||
|
';$Cd=0;foreach($K["source"]as$x=>$X){echo"<tr>","<td>".html_select("source[".(+$x)."]",array(-1=>"")+$_g,$X,($Cd==count($K["source"])-1?"foreignAddRow(this);":1)),"<td>".html_select("target[".(+$x)."]",$Xg,$K["target"][$x]);$Cd++;}echo'</table>
|
|||
|
<p>
|
|||
|
',lang(87),': ',html_select("on_delete",array(-1=>"")+explode("|",$Ke),$K["on_delete"]),' ',lang(86),': ',html_select("on_update",array(-1=>"")+explode("|",$Ke),$K["on_update"]),doc_link(array('sql'=>"innodb-foreign-key-constraints.html",'pgsql'=>"sql-createtable.html#SQL-CREATETABLE-REFERENCES",'mssql'=>"ms174979.aspx",'oracle'=>"clauses002.htm#sthref2903",)),'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
<noscript><p><input type="submit" name="add" value="',lang(184),'"></noscript>
|
|||
|
';}if($C!=""){echo'<input type="submit" name="drop" value="',lang(114),'"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$K=$_POST;if($_POST&&!$m){$C=trim($K["name"]);$Fa=" AS\n$K[select]";$A=ME."table=".urlencode($C);$je=lang(185);if(!$_POST["drop"]&&$a==$C&&$w!="sqlite")query_redirect(($w=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Fa,$A,$je);else{$Zg=$C."_adminer_".uniqid();drop_create("DROP VIEW ".table($a),"CREATE VIEW ".table($C).$Fa,"DROP VIEW ".table($C),"CREATE VIEW ".table($Zg).$Fa,"DROP VIEW ".table($Zg),($_POST["drop"]?substr(ME,0,-1):$A),lang(186),$je,lang(187),$a,$C);}}if(!$_POST&&$a!=""){$K=view($a);$K["name"]=$a;if(!$m)$m=$h->error;}page_header(($a!=""?lang(40):lang(188)),$m,array("table"=>$a),h($a));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>',lang(166),': <input name="name" value="',h($K["name"]),'" maxlength="64" autocapitalize="off">
|
|||
|
<p>';textarea("select",$K["select"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($_GET["view"]!=""){echo'<input type="submit" name="drop" value="',lang(114),'"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$ud=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$Fg=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$K=$_POST;if($_POST&&!$m){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(189));elseif(in_array($K["INTERVAL_FIELD"],$ud)&&isset($Fg[$K["STATUS"]])){$jg="\nON SCHEDULE ".($K["INTERVAL_VALUE"]?"EVERY ".q($K["INTERVAL_VALUE"])." $K[INTERVAL_FIELD]".($K["STARTS"]?" STARTS ".q($K["STARTS"]):"").($K["ENDS"]?" ENDS ".q($K["ENDS"]):""):"AT ".q($K["STARTS"]))." ON COMPLETION".($K["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(190):lang(191)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$jg.($aa!=$K["EVENT_NAME"]?"\nRENAME TO ".idf_escape($K["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($K["EVENT_NAME"]).$jg)."\n".$Fg[$K["STATUS"]]." COMMENT ".q($K["EVENT_COMMENT"]).rtrim(" DO\n$K[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(192).": ".h($aa):lang(193)),$m);if(!$K&&$aa!=""){$L=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$K=reset($L);}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(166),'<td><input name="EVENT_NAME" value="',h($K["EVENT_NAME"]),'" maxlength="64" autocapitalize="off">
|
|||
|
<tr><th title="datetime">',lang(194),'<td><input name="STARTS" value="',h("$K[EXECUTE_AT]$K[STARTS]"),'">
|
|||
|
<tr><th title="datetime">',lang(195),'<td><input name="ENDS" value="',h($K["ENDS"]),'">
|
|||
|
<tr><th>',lang(196),'<td><input type="number" name="INTERVAL_VALUE" value="',h($K["INTERVAL_VALUE"]),'" class="size"> ',html_select("INTERVAL_FIELD",$ud,$K["INTERVAL_FIELD"]),'<tr><th>',lang(105),'<td>',html_select("STATUS",$Fg,$K["STATUS"]),'<tr><th>',lang(94),'<td><input name="EVENT_COMMENT" value="',h($K["EVENT_COMMENT"]),'" maxlength="64">
|
|||
|
<tr><th> <td>',checkbox("ON_COMPLETION","PRESERVE",$K["ON_COMPLETION"]=="PRESERVE",lang(197)),'</table>
|
|||
|
<p>';textarea("EVENT_DEFINITION",$K["EVENT_DEFINITION"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($aa!=""){echo'<input type="submit" name="drop" value="',lang(114),'"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$eg=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$K=$_POST;$K["fields"]=(array)$K["fields"];if($_POST&&!process_fields($K["fields"])&&!$m){$Zg="$K[name]_adminer_".uniqid();drop_create("DROP $eg ".idf_escape($da),create_routine($eg,$K),"DROP $eg ".idf_escape($K["name"]),create_routine($eg,array("name"=>$Zg)+$K),"DROP $eg ".idf_escape($Zg),substr(ME,0,-1),lang(198),lang(199),lang(200),$da,$K["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(201):lang(202)).": ".h($da):(isset($_GET["function"])?lang(203):lang(204))),$m);if(!$_POST&&$da!=""){$K=routine($da,$eg);$K["name"]=$da;}$kb=get_vals("SHOW CHARACTER SET");sort($kb);$fg=routine_languages();echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>',lang(166),': <input name="name" value="',h($K["name"]),'" maxlength="64" autocapitalize="off">
|
|||
|
',($fg?lang(19).": ".html_select("language",$fg,$K["language"]):""),'<input type="submit" value="',lang(14),'">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
';edit_fields($K["fields"],$kb,$eg);if(isset($_GET["function"])){echo"<tr><td>".lang(205);edit_type("returns",$K["returns"],$kb);}echo'</table>
|
|||
|
<p>';textarea("definition",$K["definition"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($da!=""){echo'<input type="submit" name="drop" value="',lang(114),'"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["sequence"])){$fa=$_GET["sequence"];$K=$_POST;if($_POST&&!$m){$_=substr(ME,0,-1);$C=trim($K["name"]);if($_POST["drop"])query_redirect("DROP SEQUENCE ".idf_escape($fa),$_,lang(206));elseif($fa=="")query_redirect("CREATE SEQUENCE ".idf_escape($C),$_,lang(207));elseif($fa!=$C)query_redirect("ALTER SEQUENCE ".idf_escape($fa)." RENAME TO ".idf_escape($C),$_,lang(208));else
|
|||
|
redirect($_);}page_header($fa!=""?lang(209).": ".h($fa):lang(210),$m);if(!$K)$K["name"]=$fa;echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" value="',h($K["name"]),'" autocapitalize="off">
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($fa!="")echo"<input type='submit' name='drop' value='".lang(114)."'".confirm().">\n";echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["type"])){$ga=$_GET["type"];$K=$_POST;if($_POST&&!$m){$_=substr(ME,0,-1);if($_POST["drop"])query_redirect("DROP TYPE ".idf_escape($ga),$_,lang(211));else
|
|||
|
query_redirect("CREATE TYPE ".idf_escape(trim($K["name"]))." $K[as]",$_,lang(212));}page_header($ga!=""?lang(213).": ".h($ga):lang(214),$m);if(!$K)$K["as"]="AS ";echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
';if($ga!="")echo"<input type='submit' name='drop' value='".lang(114)."'".confirm().">\n";else{echo"<input name='name' value='".h($K['name'])."' autocapitalize='off'>\n";textarea("as",$K["as"]);echo"<p><input type='submit' value='".lang(14)."'>\n";}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$uh=trigger_options();$K=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$m&&in_array($_POST["Timing"],$uh["Timing"])&&in_array($_POST["Event"],$uh["Event"])&&in_array($_POST["Type"],$uh["Type"])){$Je=" ON ".table($a);$Vb="DROP TRIGGER ".idf_escape($C).($w=="pgsql"?$Je:"");$A=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($Vb,$A,lang(215));else{if($C!="")queries($Vb);queries_redirect($A,($C!=""?lang(216):lang(217)),queries(create_trigger($Je,$_POST)));if($C!="")queries(create_trigger($Je,$K+array("Type"=>reset($uh["Type"]))));}}$K=$_POST;}page_header(($C!=""?lang(218).": ".h($C):lang(219)),$m,array("table"=>$a));echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(220),'<td>',html_select("Timing",$uh["Timing"],$K["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, '".js_escape($a)."', this.form);"),'<tr><th>',lang(221),'<td>',html_select("Event",$uh["Event"],$K["Event"],"this.form['Timing'].onchange();"),(in_array("UPDATE OF",$uh["Event"])?" <input name='Of' value='".h($K["Of"])."' class='hidden'>":""),'<tr><th>',lang(90),'<td>',html_select("Type",$uh["Type"],$K["Type"]),'</table>
|
|||
|
<p>',lang(166),': <input name="Trigger" value="',h($K["Trigger"]);?>" maxlength="64" autocapitalize="off">
|
|||
|
<script type="text/javascript">document.getElementById('form')['Timing'].onchange();</script>
|
|||
|
<p><?php textarea("Statement",$K["Statement"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($C!=""){echo'<input type="submit" name="drop" value="',lang(114),'"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$Df=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$K){foreach(explode(",",($K["Privilege"]=="Grant option"?"":$K["Context"]))as$vb)$Df[$vb][$K["Privilege"]]=$K["Comment"];}$Df["Server Admin"]+=$Df["File access on server"];$Df["Databases"]["Create routine"]=$Df["Procedures"]["Create routine"];unset($Df["Procedures"]["Create routine"]);$Df["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$Df["Columns"][$X]=$Df["Tables"][$X];unset($Df["Server Admin"]["Usage"]);foreach($Df["Tables"]as$x=>$X)unset($Df["Databases"][$x]);$we=array();if($_POST){foreach($_POST["objects"]as$x=>$X)$we[$X]=(array)$we[$X]+(array)$_POST["grants"][$x];}$Uc=array();$He="";if(isset($_GET["host"])&&($I=$h->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($K=$I->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$K[0],$B)&&preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~',$B[1],$be,PREG_SET_ORDER)){foreach($be
|
|||
|
as$X){if($X[1]!="USAGE")$Uc["$B[2]$X[2]"][$X[1]]=true;if(preg_match('~ WITH GRANT OPTION~',$K[0]))$Uc["$B[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$K[0],$B))$He=$B[1];}}if($_POST&&!$m){$Ie=(isset($_GET["host"])?q($ha)."@".q($_GET["host"]):"''");if($_POST["drop"])query_redirect("DROP USER $Ie",ME."privileges=",lang(222));else{$ye=q($_POST["user"])."@".q($_POST["host"]);$mf=$_POST["pass"];if($mf!=''&&!$_POST["hashed"]){$mf=$h->result("SELECT PASSWORD(".q($mf).")");$m=!$mf;}$Ab=false;if(!$m){if($Ie!=$ye){$Ab=queries(($h->server_info<5?"GRANT USAGE ON *.* TO":"CREATE USER")." $ye IDENTIFIED BY PASSWORD ".q($mf));$m=!$Ab;}elseif($mf!=$He)queries("SET PASSWORD FOR $ye = ".q($mf));}if(!$m){$bg=array();foreach($we
|
|||
|
as$Ce=>$Tc){if(isset($_GET["grant"]))$Tc=array_filter($Tc);$Tc=array_keys($Tc);if(isset($_GET["grant"]))$bg=array_diff(array_keys(array_filter($we[$Ce],'strlen')),$Tc);elseif($Ie==$ye){$Fe=array_keys((array)$Uc[$Ce]);$bg=array_diff($Fe,$Tc);$Tc=array_diff($Tc,$Fe);unset($Uc[$Ce]);}if(preg_match('~^(.+)\\s*(\\(.*\\))?$~U',$Ce,$B)&&(!grant("REVOKE",$bg,$B[2]," ON $B[1] FROM $ye")||!grant("GRANT",$Tc,$B[2]," ON $B[1] TO $ye"))){$m=true;break;}}}if(!$m&&isset($_GET["host"])){if($Ie!=$ye)queries("DROP USER $Ie");elseif(!isset($_GET["grant"])){foreach($Uc
|
|||
|
as$Ce=>$bg){if(preg_match('~^(.+)(\\(.*\\))?$~U',$Ce,$B))grant("REVOKE",array_keys($bg),$B[2]," ON $B[1] FROM $ye");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?lang(223):lang(224)),!$m);if($Ab)$h->query("DROP USER $ye");}}page_header((isset($_GET["host"])?lang(33).": ".h("$ha@$_GET[host]"):lang(134)),$m,array("privileges"=>array('',lang(63))));if($_POST){$K=$_POST;$Uc=$we;}else{$K=$_GET+array("host"=>$h->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$K["pass"]=$He;if($He!="")$K["hashed"]=true;$Uc[(DB==""||$Uc?"":idf_escape(addcslashes(DB,"%_\\"))).".*"]=array();}echo'<form action="" method="post">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(32),'<td><input name="host" maxlength="60" value="',h($K["host"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(33),'<td><input name="user" maxlength="16" value="',h($K["user"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(34),'<td><input name="pass" id="pass" value="',h($K["pass"]),'">
|
|||
|
';if(!$K["hashed"]){echo'<script type="text/javascript">typePassword(document.getElementById(\'pass\'));</script>';}echo
|
|||
|
checkbox("hashed",1,$K["hashed"],lang(225),"typePassword(this.form['pass'], this.checked);"),'</table>
|
|||
|
|
|||
|
';echo"<table cellspacing='0'>\n","<thead><tr><th colspan='2'>".lang(63).doc_link(array('sql'=>"grant.html#priv_level"));$r=0;foreach($Uc
|
|||
|
as$Ce=>$Tc){echo'<th>'.($Ce!="*.*"?"<input name='objects[$r]' value='".h($Ce)."' size='10' autocapitalize='off'>":"<input type='hidden' name='objects[$r]' value='*.*' size='10'>*.*");$r++;}echo"</thead>\n";foreach(array(""=>"","Server Admin"=>lang(32),"Databases"=>lang(35),"Tables"=>lang(117),"Columns"=>lang(118),"Procedures"=>lang(226),)as$vb=>$Nb){foreach((array)$Df[$vb]as$Cf=>$ob){echo"<tr".odd()."><td".($Nb?">$Nb<td":" colspan='2'").' lang="en" title="'.h($ob).'">'.h($Cf);$r=0;foreach($Uc
|
|||
|
as$Ce=>$Tc){$C="'grants[$r][".h(strtoupper($Cf))."]'";$Y=$Tc[strtoupper($Cf)];if($vb=="Server Admin"&&$Ce!=(isset($Uc["*.*"])?"*.*":".*"))echo"<td> ";elseif(isset($_GET["grant"]))echo"<td><select name=$C><option><option value='1'".($Y?" selected":"").">".lang(227)."<option value='0'".($Y=="0"?" selected":"").">".lang(228)."</select>";else
|
|||
|
echo"<td align='center'><label class='block'><input type='checkbox' name=$C value='1'".($Y?" checked":"").($Cf=="All privileges"?" id='grants-$r-all'":($Cf=="Grant option"?"":" onclick=\"if (this.checked) formUncheck('grants-$r-all');\""))."></label>";$r++;}}}echo"</table>\n",'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if(isset($_GET["host"])){echo'<input type="submit" name="drop" value="',lang(114),'"',confirm(),'>';}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$m){$Jd=0;foreach((array)$_POST["kill"]as$X){if(queries("KILL ".(+$X)))$Jd++;}queries_redirect(ME."processlist=",lang(229,$Jd),$Jd||!$_POST["kill"]);}page_header(lang(103),$m);echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" onclick="tableClick(event);" ondblclick="tableClick(event, true);" class="nowrap checkable">
|
|||
|
';$r=-1;foreach(process_list()as$r=>$K){if(!$r){echo"<thead><tr lang='en'>".(support("kill")?"<th> ":"");foreach($K
|
|||
|
as$x=>$X)echo"<th>$x".doc_link(array('sql'=>"show-processlist.html#processlist_".strtolower($x),'pgsql'=>"monitoring-stats.html#PG-STAT-ACTIVITY-VIEW",'oracle'=>"../b14237/dynviews_2088.htm",));echo"</thead>\n";}echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$K["Id"],0):"");foreach($K
|
|||
|
as$x=>$X)echo"<td>".(($w=="sql"&&$x=="Info"&&preg_match("~Query|Killed~",$K["Command"])&&$X!="")||($w=="pgsql"&&$x=="current_query"&&$X!="<IDLE>")||($w=="oracle"&&$x=="sql_text"&&$X!="")?"<code class='jush-$w'>".shorten_utf8($X,100,"</code>").' <a href="'.h(ME.($K["db"]!=""?"db=".urlencode($K["db"])."&":"")."sql=".urlencode($X)).'">'.lang(230).'</a>':nbsp($X));echo"\n";}echo'</table>
|
|||
|
<script type=\'text/javascript\'>tableCheck();</script>
|
|||
|
<p>
|
|||
|
';if(support("kill")){echo($r+1)."/".lang(231,$h->result("SELECT @@max_connections")),"<p><input type='submit' value='".lang(232)."'>\n";}echo'<input type="hidden" name="token" value="',$T,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["select"])){$a=$_GET["select"];$R=table_status1($a);$v=indexes($a);$o=fields($a);$Lc=column_foreign_keys($a);$Ee="";if($R["Oid"]){$Ee=($w=="sqlite"?"rowid":"oid");$v[]=array("type"=>"PRIMARY","columns"=>array($Ee));}parse_str($_COOKIE["adminer_import"],$xa);$cg=array();$f=array();$dh=null;foreach($o
|
|||
|
as$x=>$n){$C=$b->fieldName($n);if(isset($n["privileges"]["select"])&&$C!=""){$f[$x]=html_entity_decode(strip_tags($C),ENT_QUOTES);if(is_shortable($n))$dh=$b->selectLengthProcess();}$cg+=$n["privileges"];}list($M,$Vc)=$b->selectColumnsProcess($f,$v);$yd=count($Vc)<count($M);$Z=$b->selectSearchProcess($o,$v);$Te=$b->selectOrderProcess($o,$v);$z=$b->selectLimitProcess();$Qc=($M?implode(", ",$M):"*".($Ee?", $Ee":"")).convert_fields($f,$o,$M)."\nFROM ".table($a);$Wc=($Vc&&$yd?"\nGROUP BY ".implode(", ",$Vc):"").($Te?"\nORDER BY ".implode(", ",$Te):"");if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$Bh=>$K){$Fa=convert_field($o[key($K)]);$M=array($Fa?$Fa:idf_escape(key($K)));$Z[]=where_check($Bh,$o);$J=$l->select($a,$M,$Z,$M);if($J)echo
|
|||
|
reset($J->fetch_row());}exit;}if($_POST&&!$m){$Xh=$Z;if(!$_POST["all"]&&is_array($_POST["check"])){$bb=array();foreach($_POST["check"]as$Za)$bb[]=where_check($Za,$o);$Xh[]="((".implode(") OR (",$bb)."))";}$Xh=($Xh?"\nWHERE ".implode(" AND ",$Xh):"");$zf=$Dh=null;foreach($v
|
|||
|
as$u){if($u["type"]=="PRIMARY"){$zf=array_flip($u["columns"]);$Dh=($M?$zf:array());break;}}foreach((array)$Dh
|
|||
|
as$x=>$X){if(in_array(idf_escape($x),$M))unset($Dh[$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"])||$Dh===array())$H="SELECT $Qc$Xh$Wc";else{$_h=array();foreach($_POST["check"]as$X)$_h[]="(SELECT".limit($Qc,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$o).$Wc,1).")";$H=implode(" UNION ALL ",$_h);}$b->dumpData($a,"table",$H);exit;}if(!$b->selectEmailProcess($Z,$Lc)){if($_POST["save"]||$_POST["delete"]){$I=true;$ya=0;$O=array();if(!$_POST["delete"]){foreach($f
|
|||
|
as$C=>$X){$X=process_input($o[$C]);if($X!==null&&($_POST["clone"]||$X!==false))$O[idf_escape($C)]=($X!==false?$X:idf_escape($C));}}if($_POST["delete"]||$O){if($_POST["clone"])$H="INTO ".table($a)." (".implode(", ",array_keys($O)).")\nSELECT ".implode(", ",$O)."\nFROM ".table($a);if($_POST["all"]||($Dh===array()&&is_array($_POST["check"]))||$yd){$I=($_POST["delete"]?$l->delete($a,$Xh):($_POST["clone"]?queries("INSERT $H$Xh"):$l->update($a,$O,$Xh)));$ya=$h->affected_rows;}else{foreach((array)$_POST["check"]as$X){$Wh="\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$o);$I=($_POST["delete"]?$l->delete($a,$Wh,1):($_POST["clone"]?queries("INSERT".limit1($H,$Wh)):$l->update($a,$O,$Wh)));if(!$I)break;$ya+=$h->affected_rows;}}}$je=lang(233,$ya);if($_POST["clone"]&&$I&&$ya==1){$Od=last_id();if($Od)$je=lang(153," $Od");}queries_redirect(remove_from_uri($_POST["all"]&&$_POST["delete"]?"page":""),$je,$I);if(!$_POST["delete"]){edit_form($a,$o,(array)$_POST["fields"],!$_POST["clone"]);page_footer();exit;}}elseif(!$_POST["import"]){if(!$_POST["val"])$m=lang(234);else{$I=true;$ya=0;foreach($_POST["val"]as$Bh=>$K){$O=array();foreach($K
|
|||
|
as$x=>$X){$x=bracket_escape($x,1);$O[idf_escape($x)]=(preg_match('~char|text~',$o[$x]["type"])||$X!=""?$b->processInput($o[$x],$X):"NULL");}$I=$l->update($a,$O," WHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($Bh,$o),!($yd||$Dh===array())," ");if(!$I)break;$ya+=$h->affected_rows;}queries_redirect(remove_from_uri(),lang(233,$ya),$I);}}elseif(!is_string($Ec=get_file("csv_file",true)))$m=upload_error($Ec);elseif(!preg_match('~~u',$Ec))$m=lang(235);else{cookie("adminer_import","output=".urlencode($xa["output"])."&format=".urlencode($_POST["separator"]));$I=true;$lb=array_keys($o);preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~',$Ec,$be);$ya=count($be[0]);$l->begin();$rg=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));$L=array();foreach($be[0]as$x=>$X){preg_match_all("~((?>\"[^\"]*\")+|[^$rg]*)$rg~",$X.$rg,$ce);if(!$x&&!array_diff($ce[1],$lb)){$lb=$ce[1];$ya--;}else{$O=array();foreach($ce[1]as$r=>$ib)$O[idf_escape($lb[$r])]=($ib==""&&$o[$lb[$r]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$ib))));$L[]=$O;}}$I=(!$L||$l->insertUpdate($a,$L,$zf));if($I)$l->commit();queries_redirect(remove_from_uri("page"),lang(236,$ya),$I);$l->rollback();}}}$Pg=$b->tableName($R);if(is_ajax()){page_headers();ob_start();}else
|
|||
|
page_header(lang(44).": $Pg",$m);$O=null;if(isset($cg["insert"])||!support("table")){$O="";foreach((array)$_GET["where"]as$X){if(count($Lc[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!preg_match('~[_%]~',$X["val"]))))$O.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($R,$O);if(!$f&&support("table"))echo"<p class='error'>".lang(237).($o?".":": ".error())."\n";else{echo"<form action='' id='form'>\n","<div style='display: none;'>";hidden_fields_get();echo(DB!=""?'<input type="hidden" name="db" value="'.h(DB).'">'.(isset($_GET["ns"])?'<input type="hidden" name="ns" value="'.h($_GET["ns"]).'">':""):"");echo'<input type="hidden" name="select" value="'.h($a).'">',"</div>\n";$b->selectColumnsPrint($M,$f);$b->selectSearchPrint($Z,$f,$v);$b->selectOrderPrint($Te,$f,$v);$b->selectLimitPrint($z);$b->selectLengthPrint($dh);$b->selectActionPrint($v);echo"</form>\n";$E=$_GET["page"];if($E=="last"){$Oc=$h->result(count_rows($a,$Z,$yd,$Vc));$E=floor(max(0,$Oc-1)/$z);}$og=$M;if(!$og){$og[]="*";if($Ee)$og[]=$Ee;}$wb=convert_fields($f,$o,$M);if($wb)$og[]=substr($wb,2);$I=$l->select($a,$og,$Z,$Vc,$Te,$z,$E,true);if(!$I)echo"<p class='error'>".error()."\n";else{if($w=="mssql"&&$E)$I->seek($z*$E);$ic=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$L=array();while($K=$I->fetch_assoc()){if($E&&$w=="oracle")unset($K["RNUM"]);$L[]=$K;}if($_GET["page"]!="last"&&+$z&&$Vc&&$yd&&$w=="sql")$Oc=$h->result(" SELECT FOUND_ROWS()");if(!$L)echo"<p class='message'>".lang(12)."\n";else{$Oa=$b->backwardKeys($a,$Pg);echo"<table id='table' cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);' onkeydown='return editingKeydown(event);'>\n","<thead><tr>".(!$Vc&&$M?"":"<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".lang(238)."</a>");$ve=array();$Sc=array();reset($M);$Mf=1;foreach($L[0]as$x=>$X){if($x!=$Ee){$X=$_GET["columns"][key($M)];$n=$o[$M?($X?$X["col"]:current($M)):$x];$C=($n?$b->fieldName($n,$Mf):($X["fun"]?"*":$x));if($C!=""){$Mf++;$ve[$x]=$C;$e=idf_escape($x);$gd=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($x);$Nb="&desc%5B0%5D=1";echo'<th onmouseover="columnMouse(this);" onmouseout="columnMouse(this, \' hidden\');">','<a href="'.h($gd.($Te[0]==$e||$Te[0]==$x||(!$Te&&$yd&&$Vc[0]==$e)?$Nb:'')).'">';echo
|
|||
|
apply_sql_function($X["fun"],$C)."</a>";echo"<span class='column hidden'>","<a href='".h($gd.$Nb)."' title='".lang(50)."' class='text'> ↓</a>";if(!$X["fun"])echo'<a href="#fieldset-search" onclick="selectSearch(\''.h(js_escape($x)).'\'); return false;" title="'.lang(47).'" class="text jsonly"> =</a>';echo"</span>";}$Sc[$x]=$X["fun"];next($M);}}$Td=array();if($_GET["modify"]){foreach($L
|
|||
|
as$K){foreach($K
|
|||
|
as$x=>$X)$Td[$x]=max($Td[$x],min(40,strlen(utf8_decode($X))));}}echo($Oa?"<th>".lang(239):"")."</thead>\n";if(is_ajax()){if($z%2==1&&$E%2==1)odd();ob_end_clean();}foreach($b->rowDescriptions($L,$Lc)as$ue=>$K){$Ah=unique_array($L[$ue],$v);if(!$Ah){$Ah=array();foreach($L[$ue]as$x=>$X){if(!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~',$x))$Ah[$x]=$X;}}$Bh="";foreach($Ah
|
|||
|
as$x=>$X){if(($w=="sql"||$w=="pgsql")&&strlen($X)>64){$x="MD5(".(strpos($x,'(')?$x:idf_escape($x)).")";$X=md5($X);}$Bh.="&".($X!==null?urlencode("where[".bracket_escape($x)."]")."=".urlencode($X):"null%5B%5D=".urlencode($x));}echo"<tr".odd().">".(!$Vc&&$M?"":"<td>".checkbox("check[]",substr($Bh,1),in_array(substr($Bh,1),(array)$_POST["check"]),"","this.form['all'].checked = false; formUncheck('all-page');").($yd||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$Bh)."'>".lang(240)."</a>"));foreach($K
|
|||
|
as$x=>$X){if(isset($ve[$x])){$n=$o[$x];if($X!=""&&(!isset($ic[$x])||$ic[$x]!=""))$ic[$x]=(is_mail($X)?$ve[$x]:"");$_="";if(preg_match('~blob|bytea|raw|file~',$n["type"])&&$X!="")$_=ME.'download='.urlencode($a).'&field='.urlencode($x).$Bh;if(!$_&&$X!==null){foreach((array)$Lc[$x]as$p){if(count($Lc[$x])==1||end($p["source"])==$x){$_="";foreach($p["source"]as$r=>$_g)$_.=where_link($r,$p["target"][$r],$L[$ue][$_g]);$_=($p["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\\1'.urlencode($p["db"]),ME):ME).'select='.urlencode($p["table"]).$_;if(count($p["source"])==1)break;}}}if($x=="COUNT(*)"){$_=ME."select=".urlencode($a);$r=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$Ah))$_.=where_link($r++,$W["col"],$W["val"],$W["op"]);}foreach($Ah
|
|||
|
as$Dd=>$W)$_.=where_link($r++,$Dd,$W);}$X=select_value($X,$_,$n,$dh);$s=h("val[$Bh][".bracket_escape($x)."]");$Y=$_POST["val"][$Bh][bracket_escape($x)];$dc=!is_array($K[$x])&&is_utf8($X)&&$L[$ue][$x]==$K[$x]&&!$Sc[$x];$ch=preg_match('~text|lob~',$n["type"]);if(($_GET["modify"]&&$dc)||$Y!==null){$Yc=h($Y!==null?$Y:$K[$x]);echo"<td>".($ch?"<textarea name='$s' cols='30' rows='".(substr_count($K[$x],"\n")+1)."'>$Yc</textarea>":"<input name='$s' value='$Yc' size='$Td[$x]'>");}else{$Yd=strpos($X,"<i>...</i>");echo"<td id='$s' onclick=\"selectClick(this, event, ".($Yd?2:($ch?1:0)).($dc?"":", '".h(lang(241))."'").");\">$X";}}}if($Oa)echo"<td>";$b->backwardKeysPrint($Oa,$L[$ue]);echo"</tr>\n";}if(is_ajax())exit;echo"</table>\n";}if(($L||$E)&&!is_ajax()){$sc=true;if($_GET["page"]!="last"){if(!+$z)$Oc=count($L);elseif($w!="sql"||!$yd){$Oc=($yd?false:found_rows($R,$Z));if($Oc<max(1e4,2*($E+1)*$z))$Oc=reset(slow_query(count_rows($a,$Z,$yd,$Vc)));else$sc=false;}}if(+$z&&($Oc===false||$Oc>$z||$E)){echo"<p class='pages'>";$ee=($Oc===false?$E+(count($L)>=$z?2:1):floor(($Oc-1)/$z));if($w!="simpledb"){echo'<a href="'.h(remove_from_uri("page"))."\" onclick=\"pageClick(this.href, +prompt('".lang(242)."', '".($E+1)."'), event); return false;\">".lang(242)."</a>:",pagination(0,$E).($E>5?" ...":"");for($r=max(1,$E-4);$r<min($ee,$E+5);$r++)echo
|
|||
|
pagination($r,$E);if($ee>0){echo($E+5<$ee?" ...":""),($sc&&$Oc!==false?pagination($ee,$E):" <a href='".h(remove_from_uri("page")."&page=last")."' title='~$ee'>".lang(243)."</a>");}echo(($Oc===false?count($L)+1:$Oc-$E*$z)>$z?' <a href="'.h(remove_from_uri("page")."&page=".($E+1)).'" onclick="return !selectLoadMore(this, '.(+$z).', \''.lang(244).'...\');" class="loadmore">'.lang(245).'</a>':'');}else{echo
|
|||
|
lang(242).":",pagination(0,$E).($E>1?" ...":""),($E?pagination($E,$E):""),($ee>$E?pagination($E+1,$E).($ee>$E+1?" ...":""):"");}}echo"<p class='count'>\n",($Oc!==false?"(".($sc?"":"~ ").lang(136,$Oc).") ":"");$Sb=($sc?"":"~ ").$Oc;echo
|
|||
|
checkbox("all",1,0,lang(246),"var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$Sb' : checked); selectCount('selected2', this.checked || !checked ? '$Sb' : checked);")."\n";if($b->selectCommandPrint()){echo'<fieldset',($_GET["modify"]?'':' class="jsonly"'),'><legend>',lang(238),'</legend><div>
|
|||
|
<input type="submit" value="',lang(14),'"',($_GET["modify"]?'':' title="'.lang(234).'"'),'>
|
|||
|
</div></fieldset>
|
|||
|
<fieldset><legend>',lang(113),' <span id="selected"></span></legend><div>
|
|||
|
<input type="submit" name="edit" value="',lang(10),'">
|
|||
|
<input type="submit" name="clone" value="',lang(230),'">
|
|||
|
<input type="submit" name="delete" value="',lang(18),'"',confirm(),'>
|
|||
|
</div></fieldset>
|
|||
|
';}$Mc=$b->dumpFormat();foreach((array)$_GET["columns"]as$e){if($e["fun"]){unset($Mc['sql']);break;}}if($Mc){print_fieldset("export",lang(128)." <span id='selected2'></span>");$df=$b->dumpOutput();echo($df?html_select("output",$df,$xa["output"])." ":""),html_select("format",$Mc,$xa["format"])," <input type='submit' name='export' value='".lang(128)."'>\n","</div></fieldset>\n";}echo(!$Vc&&$M?"":"<script type='text/javascript'>tableCheck();</script>\n");}if($b->selectImportPrint()){print_fieldset("import",lang(64),!$L);echo"<input type='file' name='csv_file'> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$xa["format"],1);echo" <input type='submit' name='import' value='".lang(64)."'>","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($ic,'strlen'),$f);echo"<p><input type='hidden' name='token' value='$T'></p>\n","</form>\n";}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$Eg=isset($_GET["status"]);page_header($Eg?lang(105):lang(104));$Ph=($Eg?show_status():show_variables());if(!$Ph)echo"<p class='message'>".lang(12)."\n";else{echo"<table cellspacing='0'>\n";foreach($Ph
|
|||
|
as$x=>$X){echo"<tr>","<th><code class='jush-".$w.($Eg?"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"){$Mg=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$C=>$R){$s=js_escape($C);json_row("Comment-$s",nbsp($R["Comment"]));if(!is_view($R)){foreach(array("Engine","Collation")as$x)json_row("$x-$s",nbsp($R[$x]));foreach($Mg+array("Auto_increment"=>0,"Rows"=>0)as$x=>$X){if($R[$x]!=""){$X=format_number($R[$x]);json_row("$x-$s",($x=="Rows"&&$X&&$R["Engine"]==($Bg=="pgsql"?"table":"InnoDB")?"~ $X":$X));if(isset($Mg[$x]))$Mg[$x]+=($R["Engine"]!="InnoDB"||$x!="Data_free"?$R[$x]:0);}elseif(array_key_exists($x,$R))json_row("$x-$s");}}}foreach($Mg
|
|||
|
as$x=>$X)json_row("sum-$x",format_number($X));json_row("");}elseif($_GET["script"]=="kill")$h->query("KILL ".(+$_POST["kill"]));else{foreach(count_tables($b->databases())as$k=>$X){json_row("tables-$k",$X);json_row("size-$k",db_size($k));}json_row("");}exit;}else{$Vg=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Vg&&!$m&&!$_POST["search"]){$I=true;$je="";if($w=="sql"&&count($_POST["tables"])>1&&($_POST["drop"]||$_POST["truncate"]||$_POST["copy"]))queries("SET foreign_key_checks = 0");if($_POST["truncate"]){if($_POST["tables"])$I=truncate_tables($_POST["tables"]);$je=lang(247);}elseif($_POST["move"]){$I=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$je=lang(248);}elseif($_POST["copy"]){$I=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$je=lang(249);}elseif($_POST["drop"]){if($_POST["views"])$I=drop_views($_POST["views"]);if($I&&$_POST["tables"])$I=drop_tables($_POST["tables"]);$je=lang(250);}elseif($w!="sql"){$I=($w=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$je=lang(251);}elseif(!$_POST["tables"])$je=lang(9);elseif($I=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"])))){while($K=$I->fetch_assoc())$je.="<b>".h($K["Table"])."</b>: ".h($K["Msg_text"])."<br>";}queries_redirect(substr(ME,0,-1),$je,$I);}page_header(($_GET["ns"]==""?lang(35).": ".h(DB):lang(68).": ".h($_GET["ns"])),$m,true);if($b->homepage()){if($_GET["ns"]!==""){echo"<h3 id='tables-views'>".lang(252)."</h3>\n";$Ug=tables_list();if(!$Ug)echo"<p class='message'>".lang(9)."\n";else{echo"<form action='' method='post'>\n";if(support("table")){echo"<fieldset><legend>".lang(253)." <span id='selected2'></span></legend><div>","<input type='search' name='query' value='".h($_POST["query"])."'> <input type='submit' name='search' value='".lang(47)."'>\n","</div></fieldset>\n";if($_POST["search"]&&$_POST["query"]!="")search_tables();}echo"<table cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n",'<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);">','<th>'.lang(117),'<td>'.lang(254),'<td>'.lang(109),'<td>'.lang(255),'<td>'.lang(256),'<td>'.lang(257),'<td>'.lang(56),'<td>'.lang(258),(support("comment")?'<td>'.lang(94):''),"</thead>\n";$S=0;foreach($Ug
|
|||
|
as$C=>$U){$Sh=($U!==null&&!preg_match('~table~i',$U));echo'<tr'.odd().'><td>'.checkbox(($Sh?"views[]":"tables[]"),$C,in_array($C,$Vg,true),"","formUncheck('check-all');"),'<th>'.(support("table")||support("indexes")?'<a href="'.h(ME).'table='.urlencode($C).'" title="'.lang(39).'">'.h($C).'</a>':h($C));if($Sh){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($C).'" title="'.lang(40).'">'.lang(116).'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($C).'" title="'.lang(38).'">?</a>';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",lang(41)),"Index_length"=>array("indexes",lang(120)),"Data_free"=>array("edit",lang(42)),"Auto_increment"=>array("auto_increment=1&create",lang(41)),"Rows"=>array("select",lang(38)),)as$x=>$_){$s=" id='$x-".h($C)."'";echo($_?"<td align='right'>".(support("table")||$x=="Rows"||(support("indexes")&&$x!="Data_length")?"<a href='".h(ME."$_[0]=").urlencode($C)."'$s title='$_[1]'>?</a>":"<span$s>?</span>"):"<td id='$x-".h($C)."'> ");}$S++;}echo(support("comment")?"<td id='Comment-".h($C)."'> ":"");}echo"<tr><td> <th>".lang(231,count($Ug)),"<td>".nbsp($w=="sql"?$h->result("SELECT @@storage_engine"):""),"<td>".nbsp(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$x)echo"<td align='right' id='sum-$x'> ";echo"</table>\n";if(!information_schema(DB)){$Mh="<input type='submit' value='".lang(259)."'".on_help("'VACUUM'")."> ";$Pe="<input type='submit' name='optimize' value='".lang(260)."'".on_help($w=="sql"?"'OPTIMIZE TABLE'":"'VACUUM OPTIMIZE'")."> ";echo"<fieldset><legend>".lang(113)." <span id='selected'></span></legend><div>".($w=="sqlite"?$Mh:($w=="pgsql"?$Mh.$Pe:($w=="sql"?"<input type='submit' value='".lang(261)."'".on_help("'ANALYZE TABLE'")."> ".$Pe."<input type='submit' name='check' value='".lang(262)."'".on_help("'CHECK TABLE'")."> "."<input type='submit' name='repair' value='".lang(263)."'".on_help("'REPAIR TABLE'")."> ":"")))."<input type='submit' name='truncate' value='".lang(264)."'".confirm().on_help($w=="sqlite"?"'DELETE'":"'TRUNCATE".($w=="pgsql"?"'":" TABLE'"))."> "."<input type='submit' name='drop' value='".lang(114)."'".confirm().on_help("'DROP TABLE'").">\n";$j=(support("scheme")?$b->schemas():$b->databases());if(count($j)!=1&&$w!="sqlite"){$k=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"<p>".lang(265).": ",($j?html_select("target",$j,$k):'<input name="target" value="'.h($k).'" autocapitalize="off">')," <input type='submit' name='move' value='".lang(266)."'>",(support("copy")?" <input type='submit' name='copy' value='".lang(267)."'>":""),"\n";}echo"<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^(tables|views)\[/));".(support("table")?" selectCount('selected2', formChecked(this, /^tables\[/) || $S);":"")."\">\n";echo"<input type='hidden' name='token' value='$T'>\n","</div></fieldset>\n";}echo"</form>\n","<script type='text/javascript'>tableCheck();</script>\n";}echo'<p class="links"><a href="'.h(ME).'create=">'.lang(66)."</a>\n",(support("view")?'<a href="'.h(ME).'view=">'.lang(188)."</a>\n":"");if(support("routine")){echo"<h3 id='routines'>".lang(131)."</h3>\n";$gg=routines();if($gg){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.lang(166).'<td>'.lang(90).'<td>'.lang(205)."<td> </thead>\n";odd('');foreach($gg
|
|||
|
as$K){echo'<tr'.odd().'>','<th><a href="'.h(ME).($K["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($K["ROUTINE_NAME"]).'">'.h($K["ROUTINE_NAME"]).'</a>','<td>'.h($K["ROUTINE_TYPE"]),'<td>'.h($K["DTD_IDENTIFIER"]),'<td><a href="'.h(ME).($K["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($K["ROUTINE_NAME"]).'">'.lang(123)."</a>";}echo"</table>\n";}echo'<p class="links">'.(support("procedure")?'<a href="'.h(ME).'procedure=">'.lang(204).'</a>':'').'<a href="'.h(ME).'function=">'.lang(203)."</a>\n";}if(support("sequence")){echo"<h3 id='sequences'>".lang(268)."</h3>\n";$sg=get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema()");if($sg){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(166)."</thead>\n";odd('');foreach($sg
|
|||
|
as$X)echo"<tr".odd()."><th><a href='".h(ME)."sequence=".urlencode($X)."'>".h($X)."</a>\n";echo"</table>\n";}echo"<p class='links'><a href='".h(ME)."sequence='>".lang(210)."</a>\n";}if(support("type")){echo"<h3 id='user-types'>".lang(23)."</h3>\n";$Kh=types();if($Kh){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(166)."</thead>\n";odd('');foreach($Kh
|
|||
|
as$X)echo"<tr".odd()."><th><a href='".h(ME)."type=".urlencode($X)."'>".h($X)."</a>\n";echo"</table>\n";}echo"<p class='links'><a href='".h(ME)."type='>".lang(214)."</a>\n";}if(support("event")){echo"<h3 id='events'>".lang(132)."</h3>\n";$L=get_rows("SHOW EVENTS");if($L){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(166)."<td>".lang(269)."<td>".lang(194)."<td>".lang(195)."<td></thead>\n";foreach($L
|
|||
|
as$K){echo"<tr>","<th>".h($K["Name"]),"<td>".($K["Execute at"]?lang(270)."<td>".$K["Execute at"]:lang(196)." ".$K["Interval value"]." ".$K["Interval field"]."<td>$K[Starts]"),"<td>$K[Ends]",'<td><a href="'.h(ME).'event='.urlencode($K["Name"]).'">'.lang(123).'</a>';}echo"</table>\n";$qc=$h->result("SELECT @@event_scheduler");if($qc&&$qc!="ON")echo"<p class='error'><code class='jush-sqlset'>event_scheduler</code>: ".h($qc)."\n";}echo'<p class="links"><a href="'.h(ME).'event=">'.lang(193)."</a>\n";}if($Ug)echo"<script type='text/javascript'>ajaxSetHtml('".js_escape(ME)."script=db');</script>\n";}}}page_footer();
|