mirror of
https://github.com/tennc/webshell
synced 2024-11-22 19:23:05 +00:00
1902 lines
440 KiB
PHP
1902 lines
440 KiB
PHP
|
<?php
|
|||
|
/** Adminer - Compact database management
|
|||
|
* @link https://www.adminer.org/
|
|||
|
* @author Jakub Vrana, https://www.vrana.cz/
|
|||
|
* @copyright 2007 Jakub Vrana
|
|||
|
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
|||
|
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
|||
|
* @version 4.5.0
|
|||
|
*/error_reporting(6135);$Uc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($Uc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$vi=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($vi)$$X=$vi;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");if(isset($_GET["file"])){if($_SERVER["HTTP_IF_MODIFIED_SINCE"]){header("HTTP/1.1 304 Not Modified");exit;}header("Expires: ".gmdate("D, d M Y H:i:s",time()+365*24*60*60)." GMT");header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");header("Cache-Control: immutable");if($_GET["file"]=="favicon.ico"){header("Content-Type: image/x-icon");echo
|
|||
|
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><31><16><>`<60>8(<28><>3M<33><4D>\"<EFBFBD>39<EFBFBD>?E<0C>e=Ҭ<>~<7E><><EFBFBD><1B><1C><>Ӹ7;<3B>C<EFBFBD><05><><EFBFBD>E\rd!)<29>a*<2A>5ajo\0<EFBFBD>#`<60>38<33>\0<EFBFBD><EFBFBD>]<5D>e<EFBFBD><65><EFBFBD><EFBFBD>2<EFBFBD> mk<18><0E>e]<5D><><EFBFBD>AZs<5A>StZ<74>Z!)BR<42>G+<2B>#Jv2(<28><><EFBFBD><EFBFBD>c<>4<<3C>#sB<73>0<EFBFBD><30><EFBFBD>6YL\r<EFBFBD>=<3D><><EFBFBD>[<5B>73<37><33><<3C>:<3A><>bx<62><78>J= m_ <20><><EFBFBD>f<EFBFBD>l<><19>t<EFBFBD><74>I<EFBFBD><49>H<EFBFBD>3<EFBFBD>x*<2A><><EFBFBD>6`t6<74><36>%<25>U<>L<EFBFBD>eق<65><<05>\0<EFBFBD>AQ<P<:<3A>#u/<2F>:T\\><3E><>-<2D>xJ<78>͍QH\nj<>L+j<>z<EFBFBD><7A><EFBFBD>7<EFBFBD><37><EFBFBD>`<60><><EFBFBD><EFBFBD>\nk<EFBFBD><EFBFBD>'<27>N<EFBFBD>vX><3E>C-T˩<54><CBA9><EFBFBD><EFBFBD><EFBFBD>4*L<>%Cj>7ߨ<37>ި<03><>-<2D><><EFBFBD><EFBFBD>2<EFBFBD><32>p<EFBFBD>3<EFBFBD><33><EFBFBD>b<EFBFBD><62>٥<EFBFBD><D9A5><EFBFBD><0E>v><3E><>p\\<EFBFBD><EFBFBD><EFBFBD><08>6_H<0E>ۻCx<43>W<EFBFBD>1Oj<4F>A<EFBFBD>wH7q<37><71>\\Ɏ#<23><>ɮ<EFBFBD>r<EFBFBD>4v=<3D>n<EFBFBD>v<EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD>6<EFBFBD>gWp<><70><EFBFBD>'e<>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>0<EFBFBD>#z6=<3D>րu<15><>\\_<EFBFBD>.<2E><><EFBFBD>>H<r<>+cz%}<7D>w<EFBFBD><77>V<EFBFBD>A*<2A><>×B>dR:\r<06><>\r<EFBFBD><EFBFBD>l\r<EFBFBD>9<EFBFBD>j<>43<34><33>qm\rPN <11><>A<17><>`<06><><EFBFBD><EFBFBD>xoèm\r<EFBFBD><EFBFBD>8?<02><><EFBFBD><13>, E<>,U<><55><18><><06><><EFBFBD><EFBFBD>%z<>ʛ<05>5<EFBFBD><35><EFBFBD>v<EFBFBD><76><EFBFBD>vE<76>86H0[C<>Lmj<6D>2D<32><44><EFBFBD><EFBFBD>`p<><70>1?<3F>R<EFBFBD>Q<EFBFBD><51><EFBFBD>M<><01>x<EFBFBD><78>b<EFBFBD>u<0C><><EFBFBD>&<0C><>I-\"<EFBFBD><EFBFBD><03><><EFBFBD>V\"<EFBFBD><0C>pG\"W<><57><EFBFBD><EFBFBD>\$<EFBFBD><EFBFBD><EFBFBD>J\$6<EFBFBD>P<EFBFBD>P<EFBFBD><EFBFBD>u\"<EFBFBD>T7CH<EFBFBD>֖{<EFBFBD><EFBFBD><EFBFBD> H<><1E><><EFBFBD>8FK<46>r#D@<40>YKKcp1<><31>葈Y\r<06><18>D<EFBFBD>^X#<23><0C><><EFBFBD>Y<EFBFBD>5<EFBFBD>\ne̲<08><>\$<EFBFBD>\"<EFBFBD>SH\$<EFBFBD>{ก.<2E>%<25>XF<06>Ji@8L<0B>if\ri<EFBFBD>gBstD<EFBFBD><EFBFBD>N<EFBFBD>SzmM<EFBFBD><EFBFBD>9'zm<7A>\rx<EFBFBD><EFBFBD><EFBFBD>I<><49><EFBFBD><EFBFBD>О-<2D><0C><01>7:q\$3p<><0B>Q<EFBFBD>f<EFBFBD>,<2C><><EFBFBD><1B>Hb2]<5D>\n<EFBFBD><EFBFBD><1C>'̹?P<>mC։<43>rI<72><49>4<EFBFBD><34>XA<58>Pn<50><6E><EFBFBD><EFBFBD>iCxp<78><70>L<EFBFBD><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD>D<EFBFBD><EFBFBD><EFBFBD><03>H<1B>4.A<>;<3B><><EFBFBD><EFBFBD>Vq<56>Of1<>2\"O<EFBFBD><EFBFBD>>K<>4<EFBFBD>s+C<>qSFL<46>SPr <20>@<40><><EFBFBD>\"<EFBFBD><EFBFBD>S*<2A>L<EFBFBD><13>L<15><>K<><03>EE<45>\n<EFBFBD><EFBFBD>k)<29><>j<EFBFBD><6A>4u\r<EFBFBD>I7A<37><41><EFBFBD>0<EFBFBD><1C><>a7p칀<>!s<>A<>4<EFBFBD><34>(y<><79><EFBFBD>*o<><6F><EFBFBD>f<1E><><EFBFBD>.<2E><><EFBFBD>2<14>ZǞ[ VG<56>\$<EFBFBD><10><04><>^<5E>n&1E<08>)ʀ-<2D>\r%<25>ZP<5A>Ȳ<><C8B2>QR#xZc,S<> <20>دҔ<D8AF>l<EFBFBD>H.!i<>78<37>e<0E>yr6<72>X<EFBFBD><58>Z<EFBFBD>\\<EFBFBD>lYB)\$<EFBFBD>(<28>\n<EFBFBD> <09>I\\Sx<EFBFBD>ѽ<EFBFBD>*up<1C><><EFBFBD>/<2F>\0p<05><>E<EFBFBD><45>x<15>4<<3C>UGvx<76><78>Y<EFBFBD>=<3D><>X<EFBFBD><58>ǁʥ<C781><CAA5><EFBFBD>L<EFBFBD><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>τ<>\$2C<10>cÐf!<0E>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>HA<EFBFBD>w<><77><EFBFBD><EFBFBD><EFBFBD><17>f<12>jl<1D><>4<EFBFBD><34><EFBFBD> <20><>B<EFBFBD>bL <09>\nO<EFBFBD><EFBFBD><EFBFBD>»7!<12># <20>t<EFBFBD>7DEz<18>&<26><><EFBFBD><EFBFBD><EFBFBD>&T<><54>R<EFBFBD>ji\\]g<>v!<21>Æqɬ<>Cdʄk<CA84>逓<EFBFBD>l<EFBFBD>ѭ<>UP20<>Bq=<3D><>8<EFBFBD>3><3E><>!<21>ȸ<EFBFBD>u<EFBFBD>+-<2D><><EFBFBD><16>mD<6D>03s\"<18><><EFBFBD><EFBFBD><EFBFBD>{<EFBFBD>x<EFBFBD>*+E<>0><3E>3<EFBFBD>.`Q<>,E<>֖<EFBFBD>^<5E>M<EFBFBD><4D><EFBFBD>5 e<>]+_<>><3E>=̫<1F>C<EFBFBD><43>)<29>7۠\r<EFBFBD>u<EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><EFBFBD><EFBFBD>z<0E>k<EFBFBD>@<40><>#<23>ZY<5A>q<EFBFBD><71><EFBFBD><EFBFBD>5<EFBFBD>]<5D>QԾǟ<D4BE><C79F><EFBFBD><EFBFBD>=bn<62>b<EFBFBD>Ī<EFBFBD><C4AA><EFBFBD><EFBFBD><08><><EFBFBD>i<EFBFBD><69><EFBFBD>E<EFBFBD><45>J<0C>u~<7E>e<>k<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD><EFBFBD><1A>0<EFBFBD><30>'̘n[w<><77><EFBFBD><EFBFBD><EFBFBD><EFBFBD>k<EFBFBD>%<25><>,ݢ<>g<EFBFBD><67>)<29>L<EFBFBD><4C><EFBFBD><06>W<EFBFBD>e<EFBFBD>i<EFBFBD>Գ<>><3E><>>){<0C>P<>t r<0E><><06>1<EFBFBD><31>Ua<55><17>\$<EFBFBD>.I|<7C><>#Z<><5A>r<>y&<26><>2<EFBFBD><32>:H'<27><>ݓ{*<2A><<3C>ۗї<DB97>;P<><50>87<38>>I<><49><EFBFBD>ܷW<DCB7><57><EFBFBD><EFBFBD><EFBFBD>v<15>2p7{'<27>.[́k]9<>8]cl<63><6C><EFBFBD>d<EFBFBD>G<EFBFBD>7~c<>u<><75>ݛ<EFBFBD><03><>e<EFBFBD><65>\$t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>W<EFBFBD><EFBFBD>ov<6F>O<EFBFBD><4F><EFBFBD>><3E>~2<>g<EFBFBD>=><3E>^<5E><><EFBFBD>?JQ!F<><46><EFBFBD>M<EFBFBD>!0>ࡡ<><E0A1A1><EFBFBD><EFBFBD><EFBFBD>-1@<40>4<>R<1E><><EFBFBD><EFBFBD><EFBFBD><03><>_<1B><><EFBFBD>sOl<1A><>,c<>r`ȷ?<3F>u<EFBFBD>)<29>Ƀ0<C983>e<EFBFBD><65><19><><EFBFBD>\"<1D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NÛ; m<>><3E><>+<2B><>aퟷ<61><ED9FB7>C\"u4<EFBFBD>l<EFBFBD>W<EFBFBD><EFBFBD><EFBFBD>?<3F><><EFBFBD><EFBFBD><1E><>u<0F><><EFBFBD>Bm|I<>E<EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>B<EFBFBD><EFBFBD><EFBFBD> <09>=KZkoz<6F>O<EFBFBD><4F>Ϧ<EFBFBD>萋e6<65>K]\0<EFBFBD><04><>d<><64><EFBFBD>Hص<48><D8B5>A<0F>6<EFBFBD>lX)`+d <20><>.7 <20>\r<EFBFBD><EFBFBD> <20>ڃj6<6A><36>p-<04>E\"oPR7<02><04>:\0<EFBFBD>\0<EFBFBD>{@<40>PM<06>mPt7x<0B>c<05>Z<EFBFBD>p<EFBFBD>4P<08><><06><><EFBFBD>B<EFBFBD>/<2F><><04><><06><>#D<0E><><06><><EFBFBD><EFBFBD>V<EFBFBD><04>\0fi,<2C><><EFBFBD><08><> i<03>wG<>\r<EFBFBD><EFBFBD>\r<EFBFBD><EFBFBD><0E><><08>]\n@[ <20>G<EFBFBD><47>Sp<53><08><>\r<EFBFBD><EFBFBD><0F><><0F><>([j<><0B><><0F>%<25><> &<26><><EFBFBD>p<><0F><>\0r<EFBFBD>p<EFBFBD>\npm\r<EFBFBD><EFBFBD>0m 9<0E><><13><><EFBFBD>MF.<2E>Kp<><12>ZW<5A><57>1=<14>E<10><>Q)qR<71>@<40><>)<14><10>'<27>u<EFBFBD>0<EFBFBD>\n<EFBFBD>+0<1E>D<12><>q'<04><><0C>B<EFBFBD><42><EFBFBD>=<3D><><EFBFBD><EFBFBD><EFBFBD>- <20>P<><1A><>iPM<1B>q<11><1C>q<1C>@\r<EFBFBD><EFBFBD>H<10><0C><><08><>Ѧ<0B>7 <09>q<>q<><1B><><03><>P<><1C><1C><><1D><>P<><50>q<EFBFBD>SQ❊<51><0C><>\r\0<EFBFBD>ѧ <20>\r<EFBFBD>h<>/p<> <20><>#<23>=2K\$<EFBFBD><04>rU1<>@`诱<>,<11> 1<><0F>m <20>m<1D><>q<EFBFBD><71>_<EFBFBD>K<03><><EFBFBD>}(]<08><><0C><> 2<>)Q<><05><03><>l<EFBFBD><0E><>z<EFBFBD><7A><EFBFBD>#q<08>&f a\$Q]0<>)<29>i<1B><>R<>,<2C>m'Qv<0B>,<12>\r<EFBFBD><EFBFBD>rЪH<D0AA>.2<EFBFBD><10><><0B><><0C><>.<2E>;.r<>/<2F><>-<2D><>\rpl\r<EFBFBD><1E>R<EFBFBD>&<26>o1S1<11>/c\\i<>/r<>2S+2<> <09><0C><>p<>SI<1E>:]<5D>o5<10><>be<08>!3Y,n<><6E><EFBFBD><0E><10>2<EFBFBD>_4)<29><><EFBFBD>^<5E>B<>G\nLq<08> <20><><EFBFBD>#<08>r<EFBFBD>(<28>5<>M&<26><><EFBFBD><EFBFBD><03><>:Ы/ӣ 3^<5E>0<EFBFBD>3s<33><0F>](+8I<0C>d<EFBFBD> ة<><D8A9>219&<26>q<16><><15><>\"<EFBFBD>=-<10><><08><>>rU@<11>3<><04><>@S\r@<40>o@<40>>1S<><53><03>)<03><><02>o)~@P;-<2D><0E><><05><><EFBFBD><EFBFBD>:\nl\"<EFBFBD>\n<EFBFBD>#g7cl<63>C\0000C<08><><EFBFBD>D|1h<31>.<2E><><EFBFBD>Q<EFBFBD>A\$\rÆ.<2E><>8.2t2#<23>6o<36>AC<41><43>D <20>DtJH<4A>Q+K<>ք<EFBFBD><0F>");}elseif($_GET["file"]=="functions.js"){header("Content-Type: text/javascript; charset=utf-8");echo
|
|||
|
lzw_decompress("f:<3A><>gCI<43><49>\n8<EFBFBD><EFBFBD>3)<29><>7<><37>'<27><><EFBFBD><EFBFBD>u9<1B>Cy<43><79>m2<6D><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>r<<3C><><EFBFBD><EFBFBD><EFBFBD>F+<2B>D<EFBFBD>g<EFBFBD>\n <06>͒<>t<EFBFBD>Xc<58><0C><><EFBFBD>L<EFBFBD>a9<02><>1<EFBFBD>\$<EFBFBD><<3C>Dg<44><19><>|<7C>G<EFBFBD>!H<>+<17><>)e<>X<EFBFBD>n3<6E>\rщvg5<67><35>`<60><><EFBFBD><EFBFBD><EFBFBD>\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޅD<EFBFBD>I<EFBFBD><12><><EFBFBD><EFBFBD>A6N<36><4E>X<EFBFBD>vi<01><><14>!<21>vf7Q<37>\0<EFBFBD>A<EFBFBD><EFBFBD>A9<1C>'<27>q<EFBFBD><71>p6E<06><>\$Y<EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>1H<EFBFBD>ti1<EFBFBD>E<1A><><EFBFBD>p<EFBFBD><70><EFBFBD><17><><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>\"<EFBFBD>Q<EFBFBD><EFBFBD><EFBFBD>9g<EFBFBD><EFBFBD><EFBFBD><EFBFBD><15>9eM<65>8<>1<EFBFBD><31><EFBFBD>s<EFBFBD>'Q<><51>k<EFBFBD><15><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܅؟<><D89F>0.<2E>s<EFBFBD><73>|k<><6B><<3C>`<60><>:<0E>f<EFBFBD>&ː6<>#<23><><EFBFBD><0E><>,cz0ܢc2\\<EFBFBD><EFBFBD>#X<><<3C>Px\n<EFBFBD><EFBFBD>*'<08>(<28><>/<2F>H971\\><3E><0F>|<12>2<EFBFBD><10>!<21><><08><>!<21><>{<1F><>\n@\$#ć\"cH<EFBFBD>!<21><>r<18>\"<EFBFBD><01><>*<2A>Ҽ<EFBFBD>2<EFBFBD>ȫP0<50>!@<40>2<EFBFBD><32>(<28>88P/<0F><><EFBFBD><EFBFBD><04>\\<EFBFBD>\"K<EFBFBD>\\<EFBFBD>9c<>H<14><>HX<13><><EFBFBD><15>t<><74><07>8A:<3A><><EFBFBD>@<04>\ng2(:Z3<5A><33>pP4<50><34><02>6)<29>PNε<02>-<2D><><EFBFBD><EFBFBD><1E>d<>V<EFBFBD><56><EFBFBD>z<13>c Ȑ<><C890>hOJW5<57><35>K7<4B><37>,<2C>A<14><14>\r<EFBFBD>X<EFBFBD><EFBFBD>K<EFBFBD>H<EFBFBD>7<05>#F<>p<>k(A<><41>2<EFBFBD><32>P<EFBFBD>0<EFBFBD>NwnL`<60>qܷ@\\3<EFBFBD><EFBFBD>ct<14>v<EFBFBD><76><EFBFBD>\\<EFBFBD><EFBFBD>b<EFBFBD>J<EFBFBD>}<7D>g<EFBFBD>Q<EFBFBD><51>7OA<4F><41>5<EFBFBD>(<28><>:<3A>K<>;\$<EFBFBD>p<EFBFBD>+\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD>4-<2D>X<EFBFBD>\r<EFBFBD>b[3#ݙg7A8<41>2A<32><41><EFBFBD>/<2F><03>,<2C><07><>N7<>ݵ'4Rʳ}<7D>c+r<0C>*<1C>M<EFBFBD>ĿKh<4B>mV<>@<40>:<03>t<17>㾬<EFBFBD><E3BEAC>zN\"#8_<38><5F><EFBFBD>p^<1F><08>E[<5B><><EFBFBD><EFBFBD>:zL<7A>3g#(<28><><EFBFBD>c<EFBFBD>c<EFBFBD><63><12>\\6<EFBFBD><EFBFBD>x<EFBFBD>2<EFBFBD>Zv<EFBFBD><EFBFBD>6<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=n7\r<EFBFBD>><3E><><EFBFBD>à<EFBFBD><C3A0>ý@<40>Vẇ<56>p<EFBFBD><70>%<25>\r\0<EFBFBD><EFBFBD><04><>\\<06>(<28><>I<EFBFBD><49><0E>p<EFBFBD>7<EFBFBD><37>h<EFBFBD><1F>7<EFBFBD>Lu݆<75>2<08><>D&9<>U&<26>:W=<3D><>#<23>1<EFBFBD><Z2<><32>?<3F><><0E>'<<3C><><EFBFBD>jA<6A>^<19><><EFBFBD><0C>Ǒ({<1A><>iA<69><41>q<EFBFBD><71>:<3A><><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><4E><EFBFBD>6<EFBFBD>7<EFBFBD><0E><18>Z<>.J<><02>R<0B>qC!<21><><EFBFBD><02><>J<>N<0F><>6F<36><46>k<EFBFBD>kL<6B><4C>@4<>@[-<2D>Ю<EFBFBD><10>C<>(c<><63>9<EFBFBD><39><EFBFBD><03>=<3D><><19>p<><70>}I<0F><07><>L<EFBFBD><4C>h<>eKà̱<C3A0>13!)<29><11>5<EFBFBD>mP!<0C>\r<01><>ȧ<EFBFBD>LISXŒ<58><C592>e<EFBFBD>1u(<28><> <18>@ͱ0(A<>\$<EFBFBD><EFBFBD><EFBFBD>q<1A>䌣<EFBFBD><E48CA3>LL<4C><4C>s<0C><><1E>6<EFBFBD><0B>sq<>=F<><46>r<><11>=<3D>V<EFBFBD><56><EFBFBD>u(A<>GRLU<4C>ɵa<><61><EFBFBD><EFBFBD><EFBFBD><01><><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>D_<44>+AG8*;<3B>bǝʢ\"<EFBFBD>yp\0<EFBFBD>ΚSZmɴ<15>Ξ<>H\$f`<60>4<EFBFBD>C<EFBFBD><08>.<2E>a<EFBFBD>X̧r<CCA7><72>s<EFBFBD>2E <20>JӺ<4A>e<EFBFBD><0E>T<EFBFBD><10>ved<65><64><12>)*D<>v\r<EFBFBD>N\r<EFBFBD>왬R<EFBFBD>%Q8<0E><>І0֬U<14><07><><EFBFBD>Mi^ 皖G\$<EFBFBD>%Ә<1C><1B>!<21>x234<33>=hdI<>M\r <20><><EFBFBD><EFBFBD>\r<EFBFBD>m<EFBFBD><18>Nh²<68><C2B2>n<EFBFBD><6E><EFBFBD>><3E>l7<01>r<EFBFBD><72>GG<0C>&<0B><>*ҵ̍f<CC8D><07>a\r%>\n<EFBFBD><01>k<EFBFBD>\$@<40>N<EFBFBD>\0,<02>+en<65>T<EFBFBD><54><EFBFBD><EFBFBD>.<2E><>D<EFBFBD><44>SeLi<4C><17><><EFBFBD>\n<01><><0B><>=<3D>0<EFBFBD><30><13>/<0C>\rG<EFBFBD>E<02>J<EFBFBD><4A>!<21><>&*<2A>B<EFBFBD>'<27><>)(<8I\"<EFBFBD>]& n<><6E>҇+)<29>'R<>vSP<53>X<EFBFBD><58>EAC7p`<60><>W<EFBFBD><57>HKHhm<68><6D>W<>C`<60><>=<3D><><EFBFBD>-<2D><><EFBFBD><04><1C>2q<32>0<><18>e<EFBFBD>I<EFBFBD><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD><DAB0><EFBFBD>[<5B>#<1C>b<EFBFBD>\n<EFBFBD>qR<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Xm)<29>6JR8<12>͐svB<76><06>.L<>,<2C>f<EFBFBD><66><EFBFBD>\$<EFBFBD><EFBFBD>T<EFBFBD>V.<2E>AZ`]x4弖<34><E5BC96>Щ<EFBFBD>nnbT<62><11><1D>;<3B>=<3D>ʽ<><CABD><EFBFBD><EFBFBD>+q}<7D><><EFBFBD><EFBFBD><15>ۦ<EFBFBD>\"<EFBFBD>ޢ<EFBFBD>_G<EFBFBD><EFBFBD><EFBFBD>C6l<>!<21>j<EFBFBD><16><><EFBFBD><EFBFBD>zoN&<26><><06>p\n<13>~<7E><>)<29><><EFBFBD>\$<EFBFBD><EFBFBD>b<EFBFBD>K<EFBFBD>B|<7C><>JS<4A>\0rfx<EFBFBD><EFBFBD><EFBFBD><EFBFBD><1A><><EFBFBD>jn<6A><6E>O<(Z0<5A>j<EFBFBD><6A><EFBFBD>z\\\\|<16>U3<0C>%<25>E@<40><15>vL<0E>:+_<><5F>A<EFBFBD>U TB<54>܅I<12>=vUj<55>ۘ<>E<>ˉFx<46><78>5<EFBFBD>#ܯ<>\n<EFBFBD>2<EFBFBD>˭\\<EFBFBD>L<>4Z纫<5A>t<EFBFBD><74>{<EFBFBD>wf<EFBFBD><EFBFBD>4rdI<64><49>9<><39><EFBFBD>o=Ǥ7<C7A4><37>gX-|<7C>%<25>R<EFBFBD><52>:<3A><><15><><EFBFBD>6|<7C>j<EFBFBD><6A>h-J<><4A><EFBFBD><EFBFBD><01><><EFBFBD>z݊<><0E><10>\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8`<60><>S<EFBFBD>i<>ew<65>\0<EFBFBD>YJ<EFBFBD>S35\\so'<27><><EFBFBD><1C><>A<EFBFBD>5<EFBFBD>E)<29><>8<EFBFBD><38>\0<EFBFBD><01>0<EFBFBD><30>F%D<>;R %7%'\n<EFBFBD>á<EFBFBD>7<EFBFBD><EFBFBD><EFBFBD><EFBFBD>I<EFBFBD><EFBFBD>ݺ<EFBFBD>{%Jc+<2B>L<EFBFBD>ԡ<EFBFBD><1E>u<EFBFBD>k<>籖\"u<EFBFBD>Z<EFBFBD>R<>?<3F>_<EFBFBD><5F>,<2C><>&Qe<51>N*<2A>J<EFBFBD><4A><EFBFBD>nu<07>#2i<32>v<EFBFBD><76>6<EFBFBD><36>4<EFBFBD>U<EFBFBD>|<7C>qs`}[I<0F>P<EFBFBD><50>NV]݁<>zO}<7D><><EFBFBD>\r<EFBFBD><EFBFBD>|*8<>=<3D><>C<EFBFBD><0C><>%<25><>v\n,<2C><01><><EFBFBD><EFBFBD>1<EFBFBD>R<EFBFBD>=<3D>W:i<>aӹt<D3B9><74><17><><EFBFBD>Pu<<3C>5q<35><71><EFBFBD>cF<><46><<3C><><EFBFBD><13>lf<6C><66><EFBFBD><EFBFBD>}n<>h\0<EFBFBD>dp}<7D><>x<EFBFBD><78>h<EFBFBD>:<3A><><EFBFBD><EFBFBD>엲<EFBFBD>Z<EFBFBD><5A>S<EFBFBD><53> |<7C>Ĵ[;|<7C><>=Ӽ<><D3BC>Z3j<\n<EFBFBD><EFBFBD><EFBFBD>^<5E><><EFBFBD><EFBFBD><1E>]q\$L13<EFBFBD>}h<>A<EFBFBD>;<3B><01>({<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)~aQ*5H<35>\r:<3A><><EFBFBD><EFBFBD><EFBFBD>AZ<41><5A>& {<EFBFBD>H<EFBFBD><EFBFBD>hl<EFBFBD><EFBFBD><1E>k<EFBFBD><6B>ʂ@T <09>1[<5B>`<60><18><>;q<71><07><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\"<EFBFBD><18><EFBFBD>\r'<06><><EFBFBD>fS.<2E><>S<EFBFBD>5<EFBFBD>P<>AC<41>s\na<EFBFBD>%<25>0<EFBFBD><30><EFBFBD>4<0F><><EFBFBD><EFBFBD><2e<32><65><EFBFBD>P\r*<0C>Y\0<EFBFBD>Lڭ<EFBFBD>H<EFBFBD><EFBFBD>'w<02>d#<23><>.@]@<40><0C>{<03><>Q<1C> bQ<62>M<01><><02>r<0C><>%(R<>p<EFBFBD><70>+`<60> <09>Z<EFBFBD><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>eIR<49>\r<EFBFBD>;<3B><>Pm<50><6D>`<>v&<26><0C><>]@<40><03><> <09><>\n<05>\n<EFBFBD>.\r\0} Ϙట\n\"-@<40>-B<><06>N@i(yg(\r<EFBFBD>Z<0C><><EFBFBD>n<><6E>,<2C><0F><><EFBFBD>\$0n<EFBFBD>Hp<EFBFBD>0<EFBFBD>L<10>\$<EFBFBD><EFBFBD>FL<46>G<1A><><EFBFBD>%t\nM`<60><05><>b<1A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>P<>J<EFBFBD><4A><EFBFBD>üY<C3BC><59><0B>v<EFBFBD><76>8<EFBFBD>.B\r<10>^<08><>@<40>(<28><14>\r<0C>qX\\<EFBFBD><EFBFBD><EFBFBD>N<EFBFBD>M<EFBFBD><EFBFBD>fq,<0E>n<EFBFBD>몺<EFBFBD><EBAABA><EFBFBD><EFBFBD>,<2C><>'<17>R<EFBFBD><52><EFBFBD><EFBFBD><EFBFBD>LDz<44><7A><EFBFBD> Z@<40><0B><><EFBFBD>`V<05><04>L%-<18>f<EFBFBD><66><EFBFBD>W`<60>n<EFBFBD>T<EFBFBD>k<16><02>qp<71>v<>\r<04><>Ҳ<EFBFBD><D2B2>Ю<EFBFBD><D0AE>.<2E><18>k<1E><>oQ<6F>L<EFBFBD>t<05><><19><>m3<1A> &<26><>m*V<><56>R<EFBFBD>!\nf<EFBFBD><EFBFBD>^<5E>Ndݧ<64><0B><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>2,<2C>h<EFBFBD>U<EFBFBD><18>B<>f<EFBFBD><66><EFBFBD><L<08>u<EFBFBD> r<>0hDh<44>%B<>Ί'`8Nnڭ<6E><05>X<EFBFBD><58>vV<76>bb<>'rzಀ<10>9<EFBFBD>P!<21>f<66>r<EFBFBD>\0<EFBFBD><EFBFBD><EFBFBD>^<5E>rdF\0<EFBFBD>*<2A><><EFBFBD>ʾ)-<01><>\$<EFBFBD>\$ɮ*<2A>#\n<EFBFBD>q<EFBFBD>(q<><02><><EFBFBD><EFBFBD>\r<EFBFBD><EFBFBD>B<EFBFBD><18>r<01><>2`<60>ДXf=\rQ<EFBFBD><17><>/1<><31><EFBFBD><EFBFBD>I<EFBFBD>_-b>lM<1A><>\0<EFBFBD>%\"ŀ<EFBFBD>1r<12>ej<04>\r-<2D><>.S\$\$<02>R<EFBFBD><52><EFBFBD><EFBFBD>b<0C><><EFBFBD><EFBFBD><14><><EFBFBD><EFBFBD>\0G<15><>]@[)<29><>R<EFBFBD>Y32@qŴy<C5B4><79><1C>h<EFBFBD><68><EFBFBD><EFBFBD>1<EFBFBD><07>i0,.<2E><>h<07>z<7A>i,.(<28><><EFBFBD><04>o<02>L<EFBFBD>h<EFBFBD>#<23>Q8<51><38><EFBFBD>n %l<>oK4NF<4E>PV<50>{B<>\"s<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<2B><>K<EFBFBD><4B>\r <20>9 <20><>H-<05><>ELk<><04>z@<40><><EFBFBD><EFBFBD>@<40>fsh6<68>4#<23>=<3D><>8<EFBFBD><38><EFBFBD><EFBFBD>z<EFBFBD>bw')'b@<40>&<26><>}\"@B2k9<6B>}\$s&<26><ؤ\$<EFBFBD><07>烍'dP<64>T*<2A><><EFBFBD>F<06><><EFBFBD>D<EFBFBD><44><EFBFBD><0C><>&<26>o@X<>&<26> Ĥ{\0<EFBFBD>%<25><><EFBFBD><EFBFBD>(<28><>C<07><>-J\$9<EFBFBD>B<05><><EFBFBD> <20>\n<EFBFBD><EFBFBD><EFBFBD>DOHtN\"ԙIԠ(<28><><EFBFBD>ğAt%I<0E>(<28>?'<27>#(4R_<52><5F>'<27>z2<>wi<77>;<3B><><0E><06>m<EFBFBD>J&~<7E><>hڔ<68>Ė#̂Tp%<25>COj_P\"<0C><>J1<31>5<08>Cl<43><6C>b<EFBFBD>ԗ@o<>\\<EFBFBD><EFBFBD>#)ژ<><DA98>#NaF <20>r[T<>H<EFBFBD><48>DCeI-<2D>tI<14>\$n<EFBFBD>IΈC<EFBFBD><EFBFBD>Or <20><> <20>`OMЋIM<49>Pn<50>4<><34><EFBFBD>]Q<>F<04><>Ip<49>\rg]@<40>\r\"@Bə)<29><><EFBFBD>U<EFBFBD>ϕ<EFBFBD><CF95>`Y)<12>F<EFBFBD><0E>o<EFBFBD>q4h<34>qDh%RyLr<4C><07>h[\\<EFBFBD>?] f<13>K<EFBFBD>|<7C><04><>ID4<44>H0<48><30>OU\\<EFBFBD><EFBFBD>\"5<EFBFBD>Q<EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>W<EFBFBD>N<0F><><0F><><EFBFBD><EFBFBD><0C>,<2C>t<EFBFBD>,N<>v q+N<>`<60><><EFBFBD>ޟ<EFBFBD>\"<EFBFBD>V\$<EFBFBD>\r<EFBFBD>1a\0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Wm<EFBFBD>d4<EFBFBD>;9K<1C>O<EFBFBD><0C><>b<EFBFBD><62>b<EFBFBD><06><>R<EFBFBD><52>_d<5F><64>fNf<>f<><66><EFBFBD><EFBFBD><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD>D_TS4S\0<EFBFBD><EFBFBD><EFBFBD>T<EFBFBD>Ub)<29>S<EFBFBD><53><0E><>cK!<21><>ڕ/A0SOYS<59>^<5E>1W>Q<1C>B<EFBFBD>*^<5E>\$<EFBFBD>j<><0B>s <20>Pech<63>:(¹<><C2B9><EFBFBD>\"%<25>\n<EFBFBD>W\" z %v<>e<EFBFBD>T(ȶ<><C8B6>p<EFBFBD><0E>O\"<06>r<0C><><EFBFBD><10><><EFBFBD>(<28>E<EFBFBD>\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FJ<EFBFBD><EFBFBD>Zo<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD>KR\"<EFBFBD><EFBFBD>7F<37>wJ\\<EFBFBD>OuUu<55><75> <20>+rj\0*<2A><>QdCK<43>0}`<60>p<EFBFBD>8<EFBFBD><38>AV<41>Ss7<73><37><EFBFBD>t3s`<60>s<EFBFBD>2<07>cyU]tWIGN\\<EFBFBD><EFBFBD>w,+w`Yy<59><79>z<EFBFBD><7A><e. <20>F\0<EFBFBD>N t<>j<EFBFBD>gB\r<EFBFBD><EFBFBD>G<EFBFBD>i>p<>e<>\0<EFBFBD>x<EFBFBD>2<>6<EFBFBD>eD3\rr<EFBFBD>2<EFBFBD>a<EFBFBD><EFBFBD>`<60>#=<3D>*<2A><0C>R<EFBFBD>%<25>̐<EFBFBD>y:<3A><C ݀<>& x+\r<EFBFBD><EFBFBD>U<EFBFBD>YSQme<EFBFBD>m<EFBFBD>+<12>
|
|||
|
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><>jLƁU`<60>S<EFBFBD>`Z^<5E>|<0F><>r<EFBFBD>=<3D><0F>n登<6E><E799BB>TU 1Hyk<79><6B>t+\0v<1C>D<EFBFBD>\r <<3C><>ƙ<EFBFBD><C699>jG<><1E><>t<EFBFBD>*3%k<>YܲT*<2A>|\"C<1E><>lhE<68>(<28>\r<EFBFBD>8r<EFBFBD><EFBFBD>{<EFBFBD><18>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD>_<EFBFBD><5F>.6и<EFBFBD>;<3B><><EFBFBD><EFBFBD>rBj<1B>O'ۜ<><DB9C><EFBFBD>>\$<EFBFBD><EFBFBD>`^6<><36>9<EFBFBD>#<19><><EFBFBD><14>4X<03><>mh8:<3A><>c<EFBFBD><06>0<1D><>;<3B>/ԉ<><D489><EFBFBD><EFBFBD>;<3B>\\'(<28><><EFBFBD>t<EFBFBD>'+<0B><1C><><EFBFBD><EFBFBD>̷<EFBFBD>^<0B>]<5D><>N<EFBFBD>v<EFBFBD><76>#<23>,<08>v<EFBFBD><76><EFBFBD>O<EFBFBD>i<>ϖ<EFBFBD>><3E><><S<0E>A\\<02>\\<EFBFBD><EFBFBD><EFBFBD>!<21>3*tl`<60>u<EFBFBD>\0p'<27>7<EFBFBD>P<EFBFBD>9<7F>bs<62>{<EFBFBD>v<EFBFBD>{<EFBFBD><EFBFBD>7<EFBFBD>\"{<EFBFBD><EFBFBD>r<EFBFBD>a<EFBFBD>(<28>^<5E><><EFBFBD>E<EFBFBD><45><EFBFBD><EFBFBD><EFBFBD>g<><67>/<2F><><EFBFBD>U<EFBFBD>9g<39><67><EFBFBD>/<2F><>`<60>\nL\n<EFBFBD>)<07><><14>(A<>a<EFBFBD>\" <20><03><> <09>&<26>P<EFBFBD><14>@O\n師0<>(M&<17>FJ'<27>! <20>0<EFBFBD><<3C>H<EFBFBD><48><EFBFBD><EFBFBD><0E><><EFBFBD>*<2A>|<7C><>*<2A>OZ<4F>m*n/b<>/<2F><><EFBFBD><EFBFBD><EFBFBD><0C><>.<2E><><EFBFBD>o\0<EFBFBD><EFBFBD>dn<EFBFBD>)<29><1E><><EFBFBD>i<EFBFBD>:R<><52><EFBFBD>P2<50>m<EFBFBD>\0/v<>OX<4F><58><1C>Fʳψ<CAB3><0F><><EFBFBD>\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<04>0<08><><EFBFBD><EFBFBD><16>0b<30><62>gj<><6A>\$<EFBFBD>n<EFBFBD>0}<05> <05>@<40>=MƂ0n<30>P<EFBFBD>/p<>ot<6F><10><><EFBFBD><EFBFBD><EFBFBD>.<12>̽<0B>g\0<EFBFBD>)o<>\n0<EFBFBD><EFBFBD><EFBFBD>\rF<><46><0B><07>b<EFBFBD>i<EFBFBD><69>o}\n<EFBFBD>̯<> NQ<0B>'<0B>x<EFBFBD>Fa<46>J<04><><EFBFBD><EFBFBD>L<EFBFBD><10><0F><><04><>\r<EFBFBD><EFBFBD>\r<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<><07>'<0C><><EFBFBD>d oep<><13>4D<34><44>ʐ<>q(~<7E><> <20>\r<EFBFBD>E<10><>pr<70>QVFH<46>l<EFBFBD><6C>Kj<4B><6A><EFBFBD>N&<26>j!<21>H`<11>_bh\r1<EFBFBD><0C><>n!<21>Ɏ<>z<><7A><EFBFBD><13><><0C>\\<0F><>\r<EFBFBD><07><><EFBFBD>`V_k<5F><6B>\"\\ׂ'V<05><>\0ʾ`AC<><43><EFBFBD><EFBFBD><18><>V<EFBFBD>`\r%<25><><EFBFBD><02><><EFBFBD>\r<EFBFBD><EFBFBD><0E><>k@N<><4E><EFBFBD><EFBFBD>B<>횙<11> <20>!<21>\n<EFBFBD>\0Z<EFBFBD>6<>\$d<EFBFBD><EFBFBD>,%<03>%la<19>H<EFBFBD>\n<EFBFBD>#<23>S\$!\$@<40><>2<><32><EFBFBD>I\$r<EFBFBD>{!<21><>J<EFBFBD>2H<32>ZM\\<EFBFBD><EFBFBD>hb,<2C>'||cj~g<>r<EFBFBD>`<60>ļ<EFBFBD>\$<EFBFBD><EFBFBD><EFBFBD>+<2B>A1<41><31>E<1F><><1F><> <<3C>L<EFBFBD><11>\$<EFBFBD>Y%-FD<46><44>d<EFBFBD>L焳<><E784B3>\n@<40>bVf<56><66>;2_(<28><>L<EFBFBD>п<EFBFBD><05><%@ڜ,\"<EFBFBD>d<EFBFBD><EFBFBD>N<EFBFBD>er<EFBFBD>\0<EFBFBD><EFBFBD>`<60><0E>Z<0C><>4<EFBFBD>'ld9-<2D>#`<60><>Ŗ<EFBFBD><C596><EFBFBD><EFBFBD><EFBFBD>j6<6A>ƣ<EFBFBD>v<07><><04>N<EFBFBD>͐f<CD90><66>@܆<>&<26>B\$<0B><>(<28>Z&<26><><EFBFBD>278I <20><><EFBFBD>P\rk\\<EFBFBD><EFBFBD><EFBFBD>2`<60>\rdLb@E<14><>2`P( B'<27><0B><><0F><>0<EFBFBD>&<05><>{<EFBFBD><EFBFBD><EFBFBD>:<3A><>dB<64>1<EFBFBD>^؉*\r\0c<K<>|<06>5sZ<73>`<60><><EFBFBD>O3<4F>5=@<40>5<EFBFBD>C>@<40>W* =\0N<g<>6s67Sm7u? {<&L<04>.3~D<><44>\rŚ<0C>x<EFBFBD><13>),r<>in<>/<2F><>O\0o{0k<EFBFBD>]3>m<><05>1\0<EFBFBD>I@<40>9T34+ԙ@e<0F>GFMC<4D>\rE3<EFBFBD>Etm!<13>#1<>D @<40>H(<28><>n <20><><g,V`R]@<40><><EFBFBD><EFBFBD>3Cr7s~<7E>GI<>i@\0v<EFBFBD><EFBFBD>5\rV<EFBFBD>'<1A><><EFBFBD><0C><><08>P<05><>\r<EFBFBD>\$<b<>%(<28>Dd<44><64>PW<50><57><EFBFBD><EFBFBD>b<EFBFBD>fO <20>x\0<EFBFBD>} <20><0B><>lb<6C>&<26>vj4<>LS<1A><>ִԶ5&dsF M<>4<EFBFBD><18>\".H<>M0<4D>1uL<>\"<EFBFBD><EFBFBD>/J`<60>{<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>xǐYu*\"U.I53Q<33>3Q<33><51>J<EFBFBD><4A>g<EFBFBD><67>5<EFBFBD>s<><73><EFBFBD>&jь<6A><D18C>u<EFBFBD>٭ЪGQMTmGB<47>tl-c<>*<2A><>\r<02><>Z7<5A><37><1B>*hs/RUV<55><56><EFBFBD><EFBFBD>B<EFBFBD>Nˈ<4E><CB88><06><><EFBFBD>Ԋ<>i<EFBFBD>Lk<4C>.<2E><><EFBFBD>t<EFBFBD><74>龩<EFBFBD>rYi<59><69><EFBFBD>-S<><53>3<EFBFBD>\\<EFBFBD>T<EFBFBD>OM^<5E>G><3E>ZQj<51><07><>\"<EFBFBD><EFBFBD><EFBFBD>i<EFBFBD><EFBFBD>MsS<EFBFBD>S\$Ib f<><13><>u<EFBFBD><75><08><><EFBFBD>:<04>SB|i<><69>Y¦<0F><>8 v<07>#<02><>D<EFBFBD>4`<60><>.<2E><>^<5E>H<EFBFBD>M<EFBFBD>_ռ<5F>u<EFBFBD><75>U<EFBFBD>z`Z<>J e<><65><EFBFBD>@Ce<43><65>a<EFBFBD>\"m<>b<12>6ԯJR<4A><EFBFBD><0C>T<EFBFBD>?ԣXMZ<4D><5A>І<EFBFBD><D086>p<EFBFBD><70><0F><>Qv<51>j<13>jV<6A>{<EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>\r<EFBFBD><EFBFBD>7<16>Tʞ<54> <20><>5{P<EFBFBD><EFBFBD>]<12>\r<EFBFBD>?Q<>AA<41><41><07><><EFBFBD><EFBFBD>2V)Ji<><69>-N99f<39>l Jm<><6D>;u<>@<40><F<>Ѡ<EFBFBD>e<EFBFBD>j<0C><>Ħ<>I<EFBFBD><+CW@<40><><18><><EFBFBD>Z<EFBFBD>l<EFBFBD>1<EFBFBD><2<>iF<69>7`KG<4B>~L&+N<08><>YtWH飑w <0E><1A><><19>l<EFBFBD><6C>s'g<04><>q+L<>zbiz<69><7A><EFBFBD>Ţ<EFBFBD>.Њ<>zW<7A><57> <20>zd<06>W<EFBFBD><57><EFBFBD><EFBFBD>(<17>y)v<>E4,\0<EFBFBD>\"d<><64>\$B<EFBFBD>{<EFBFBD><EFBFBD>!)1U<31>5bp#<23>}m=<3D><>@<40>w<12> P\0<EFBFBD>\r<EFBFBD><0C><><EFBFBD><EFBFBD>`O|<7C><><0E> <09>ɍ<EFBFBD><C98D><EFBFBD><EFBFBD>Y<EFBFBD><59>JՂ<15>E<EFBFBD><45>Ou<4F>_<EFBFBD>\n`F`<60>}
|
|||
|
connection(){global$g;return$g;}function
|
|||
|
adminer(){global$b;return$b;}function
|
|||
|
idf_unescape($u){$je=substr($u,-1);return
|
|||
|
str_replace($je.$je,$je,substr($u,1,-1));}function
|
|||
|
escape_string($X){return
|
|||
|
substr(q($X),1,-1);}function
|
|||
|
number($X){return
|
|||
|
preg_replace('~[^0-9]+~','',$X);}function
|
|||
|
remove_slashes($gg,$Uc=false){if(get_magic_quotes_gpc()){while(list($y,$X)=each($gg)){foreach($X
|
|||
|
as$Yd=>$W){unset($gg[$y][$Yd]);if(is_array($W)){$gg[$y][stripslashes($Yd)]=$W;$gg[]=&$gg[$y][stripslashes($Yd)];}else$gg[$y][stripslashes($Yd)]=($Uc?$W:stripslashes($W));}}}}function
|
|||
|
bracket_escape($u,$Oa=false){static$gi=array(':'=>':1',']'=>':2','['=>':3','"'=>':4');return
|
|||
|
strtr($u,($Oa?array_flip($gi):$gi));}function
|
|||
|
charset($g){return(version_compare($g->server_info,"5.5.3")>=0?"utf8mb4":"utf8");}function
|
|||
|
script($lh,$fi="\n"){return"<script".nonce().">$lh</script>$fi";}function
|
|||
|
script_src($_i){return"<script src='".h($_i)."'".nonce()."></script>\n";}function
|
|||
|
nonce(){return' nonce="'.get_nonce().'"';}function
|
|||
|
target_blank(){return' target="_blank" rel="noopener"';}function
|
|||
|
h($P){return
|
|||
|
str_replace("\0","�",htmlspecialchars($P,ENT_QUOTES,'utf-8'));}function
|
|||
|
nbsp($P){return(trim($P)!=""?h($P):" ");}function
|
|||
|
nl_br($P){return
|
|||
|
str_replace("\n","<br>",$P);}function
|
|||
|
checkbox($C,$Y,$fb,$fe="",$jf="",$kb="",$ge=""){$I="<input type='checkbox' name='$C' value='".h($Y)."'".($fb?" checked":"").($ge?" aria-labelledby='$ge'":"").">".($jf?script("qsl('input').onclick = function () { $jf };",""):"");return($fe!=""||$kb?"<label".($kb?" class='$kb'":"").">$I".h($fe)."</label>":$I);}function
|
|||
|
optionlist($pf,$Wg=null,$Di=false){$I="";foreach($pf
|
|||
|
as$Yd=>$W){$qf=array($Yd=>$W);if(is_array($W)){$I.='<optgroup label="'.h($Yd).'">';$qf=$W;}foreach($qf
|
|||
|
as$y=>$X)$I.='<option'.($Di||is_string($y)?' value="'.h($y).'"':'').(($Di||is_string($y)?(string)$y:$X)===$Wg?' selected':'').'>'.h($X);if(is_array($W))$I.='</optgroup>';}return$I;}function
|
|||
|
html_select($C,$pf,$Y="",$if=true,$ge=""){if($if)return"<select name='".h($C)."'".($ge?" aria-labelledby='$ge'":"").">".optionlist($pf,$Y)."</select>".(is_string($if)?script("qsl('select').onchange = function () { $if };",""):"");$I="";foreach($pf
|
|||
|
as$y=>$X)$I.="<label><input type='radio' name='".h($C)."' value='".h($y)."'".($y==$Y?" checked":"").">".h($X)."</label>";return$I;}function
|
|||
|
select_input($Ka,$pf,$Y="",$if="",$Sf=""){$Kh=($pf?"select":"input");return"<$Kh$Ka".($pf?"><option value=''>$Sf".optionlist($pf,$Y,true)."</select>":" size='10' value='".h($Y)."' placeholder='$Sf'>").($if?script("qsl('$Kh').onchange = $if;",""):"");}function
|
|||
|
confirm($Ee="",$Xg="qsl('input')"){return
|
|||
|
script("$Xg.onclick = function () { return confirm('".($Ee?js_escape($Ee):lang(0))."'); };","");}function
|
|||
|
print_fieldset($t,$oe,$Oi=false){echo"<fieldset><legend>","<a href='#fieldset-$t'>$oe</a>",script("qsl('a').onclick = partial(toggle, 'fieldset-$t');",""),"</legend>","<div id='fieldset-$t'".($Oi?"":" class='hidden'").">\n";}function
|
|||
|
bold($Wa,$kb=""){return($Wa?" class='active $kb'":($kb?" class='$kb'":""));}function
|
|||
|
odd($I=' class="odd"'){static$s=0;if(!$I)$s=-1;return($s++%2?$I:'');}function
|
|||
|
js_escape($P){return
|
|||
|
addcslashes($P,"\r\n'\\/");}function
|
|||
|
json_row($y,$X=null){static$Vc=true;if($Vc)echo"{";if($y!=""){echo($Vc?"":",")."\n\t\"".addcslashes($y,"\r\n\t\"\\/").'": '.($X!==null?'"'.addcslashes($X,"\r\n\"\\/").'"':'null');$Vc=false;}else{echo"\n}\n";$Vc=true;}}function
|
|||
|
ini_bool($Kd){$X=ini_get($Kd);return(preg_match('~^(on|true|yes)$~i',$X)||(int)$X);}function
|
|||
|
sid(){static$I;if($I===null)$I=(SID&&!($_COOKIE&&ini_bool("session.use_cookies")));return$I;}function
|
|||
|
set_password($Ki,$M,$V,$F){$_SESSION["pwds"][$Ki][$M][$V]=($_COOKIE["adminer_key"]&&is_string($F)?array(encrypt_string($F,$_COOKIE["adminer_key"])):$F);}function
|
|||
|
get_password(){$I=get_session("pwds");if(is_array($I))$I=($_COOKIE["adminer_key"]?decrypt_string($I[0],$_COOKIE["adminer_key"]):false);return$I;}function
|
|||
|
q($P){global$g;return$g->quote($P);}function
|
|||
|
get_vals($G,$d=0){global$g;$I=array();$H=$g->query($G);if(is_object($H)){while($J=$H->fetch_row())$I[]=$J[$d];}return$I;}function
|
|||
|
get_key_vals($G,$h=null,$Th=0,$fh=true){global$g;if(!is_object($h))$h=$g;$I=array();$h->timeout=$Th;$H=$h->query($G);$h->timeout=0;if(is_object($H)){while($J=$H->fetch_row()){if($fh)$I[$J[0]]=$J[1];else$I[]=$J[0];}}return$I;}function
|
|||
|
get_rows($G,$h=null,$n="<p class='error'>"){global$g;$yb=(is_object($h)?$h:$g);$I=array();$H=$yb->query($G);if(is_object($H)){while($J=$H->fetch_assoc())$I[]=$J;}elseif(!$H&&!is_object($h)&&$n&&defined("PAGE_HEADER"))echo$n.error()."\n";return$I;}function
|
|||
|
unique_array($J,$w){foreach($w
|
|||
|
as$v){if(preg_match("~PRIMARY|UNIQUE~",$v["type"])){$I=array();foreach($v["columns"]as$y){if(!isset($J[$y]))continue
|
|||
|
2;$I[$y]=$J[$y];}return$I;}}}function
|
|||
|
escape_key($y){if(preg_match('(^([\w(]+)('.str_replace("_",".*",preg_quote(idf_escape("_"))).')([ \w)]+)$)',$y,$B))return$B[1].idf_escape(idf_unescape($B[2])).$B[3];return
|
|||
|
idf_escape($y);}function
|
|||
|
where($Z,$p=array()){global$g,$x;$I=array();foreach((array)$Z["where"]as$y=>$X){$y=bracket_escape($y,1);$d=escape_key($y);$I[]=$d.($x=="sql"&&preg_match('~^[0-9]*\\.[0-9]*$~',$X)?" LIKE ".q(addcslashes($X,"%_\\")):($x=="mssql"?" LIKE ".q(preg_replace('~[_%[]~','[\0]',$X)):" = ".unconvert_field($p[$y],q($X))));if($x=="sql"&&preg_match('~char|text~',$p[$y]["type"])&&preg_match("~[^ -@]~",$X))$I[]="$d = ".q($X)." COLLATE ".charset($g)."_bin";}foreach((array)$Z["null"]as$y)$I[]=escape_key($y)." IS NULL";return
|
|||
|
implode(" AND ",$I);}function
|
|||
|
where_check($X,$p=array()){parse_str($X,$db);remove_slashes(array(&$db));return
|
|||
|
where($db,$p);}function
|
|||
|
where_link($s,$d,$Y,$lf="="){return"&where%5B$s%5D%5Bcol%5D=".urlencode($d)."&where%5B$s%5D%5Bop%5D=".urlencode(($Y!==null?$lf:"IS NULL"))."&where%5B$s%5D%5Bval%5D=".urlencode($Y);}function
|
|||
|
convert_fields($e,$p,$L=array()){$I="";foreach($e
|
|||
|
as$y=>$X){if($L&&!in_array(idf_escape($y),$L))continue;$Ha=convert_field($p[$y]);if($Ha)$I.=", $Ha AS ".idf_escape($y);}return$I;}function
|
|||
|
cookie($C,$Y,$re=2592000){global$ba;return
|
|||
|
header("Set-Cookie: $C=".urlencode($Y).($re?"; expires=".gmdate("D, d M Y H:i:s",time()+$re)." GMT":"")."; path=".preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]).($ba?"; secure":"")."; HttpOnly; SameSite=lax",false);}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($y){return$_SESSION[$y][DRIVER][SERVER][$_GET["username"]];}function
|
|||
|
set_session($y,$X){$_SESSION[$y][DRIVER][SERVER][$_GET["username"]]=$X;}function
|
|||
|
auth_url($Ki,$M,$V,$m=null){global$ec;preg_match('~([^?]*)\\??(.*)~',remove_from_uri(implode("|",array_keys($ec))."|username|".($m!==null?"db|":"").session_name()),$B);return"$B[1]?".(sid()?SID."&":"").($Ki!="server"||$M!=""?urlencode($Ki)."=".urlencode($M)."&":"")."username=".urlencode($V).($m!=""?"&db=".urlencode($m):"").($B[2]?"&$B[2]":"");}function
|
|||
|
is_ajax(){return($_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest");}function
|
|||
|
redirect($A,$Ee=null){if($Ee!==null){restart_session();$_SESSION["messages"][preg_replace('~^[^?]*~','',($A!==null?$A:$_SERVER["REQUEST_URI"]))][]=$Ee;}if($A!==null){if($A=="")$A=".";header("Location: $A");exit;}}function
|
|||
|
query_redirect($G,$A,$Ee,$tg=true,$Cc=true,$Mc=false,$Sh=""){global$g,$n,$b;if($Cc){$sh=microtime(true);$Mc=!$g->query($G);$Sh=format_time($sh);}$ph="";if($G)$ph=$b->messageQuery($G,$Sh);if($Mc){$n=error().$ph.script("messagesPrint();");return
|
|||
|
false;}if($tg)redirect($A,$Ee.$ph);return
|
|||
|
true;}function
|
|||
|
queries($G){global$g;static$mg=array();static$sh;if(!$sh)$sh=microtime(true);if($G===null)return
|
|||
|
array(implode("\n",$mg),format_time($sh));$mg[]=(preg_match('~;$~',$G)?"DELIMITER ;;\n$G;\nDELIMITER ":$G).";";return$g->query($G);}function
|
|||
|
apply_queries($G,$S,$zc='table'){foreach($S
|
|||
|
as$Q){if(!queries("$G ".$zc($Q)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
queries_redirect($A,$Ee,$tg){list($mg,$Sh)=queries(null);return
|
|||
|
query_redirect($mg,$A,$Ee,$tg,false,!$tg,$Sh);}function
|
|||
|
format_time($sh){return
|
|||
|
lang(1,max(0,microtime(true)-$sh));}function
|
|||
|
remove_from_uri($Df=""){return
|
|||
|
substr(preg_replace("~(?<=[?&])($Df".(SID?"":"|".session_name()).")=[^&]*&~",'',"$_SERVER[REQUEST_URI]&"),0,-1);}function
|
|||
|
pagination($E,$Jb){return" ".($E==$Jb?$E+1:'<a href="'.h(remove_from_uri("page").($E?"&page=$E".($_GET["next"]?"&next=".urlencode($_GET["next"]):""):"")).'">'.($E+1)."</a>");}function
|
|||
|
get_file($y,$Rb=false){$Sc=$_FILES[$y];if(!$Sc)return
|
|||
|
null;foreach($Sc
|
|||
|
as$y=>$X)$Sc[$y]=(array)$X;$I='';foreach($Sc["error"]as$y=>$n){if($n)return$n;$C=$Sc["name"][$y];$ai=$Sc["tmp_name"][$y];$_b=file_get_contents($Rb&&preg_match('~\\.gz$~',$C)?"compress.zlib://$ai":$ai);if($Rb){$sh=substr($_b,0,3);if(function_exists("iconv")&&preg_match("~^\xFE\xFF|^\xFF\xFE~",$sh,$zg))$_b=iconv("utf-16","utf-8",$_b);elseif($sh=="\xEF\xBB\xBF")$_b=substr($_b,3);$I.=$_b."\n\n";}else$I.=$_b;}return$I;}function
|
|||
|
upload_error($n){$Be=($n==UPLOAD_ERR_INI_SIZE?ini_get("upload_max_filesize"):0);return($n?lang(2).($Be?" ".lang(3,$Be):""):lang(4));}function
|
|||
|
repeat_pattern($Qf,$pe){return
|
|||
|
str_repeat("$Qf{0,65535}",$pe/65535)."$Qf{0,".($pe%65535)."}";}function
|
|||
|
is_utf8($X){return(preg_match('~~u',$X)&&!preg_match('~[\\0-\\x8\\xB\\xC\\xE-\\x1F]~',$X));}function
|
|||
|
shorten_utf8($P,$pe=80,$zh=""){if(!preg_match("(^(".repeat_pattern("[\t\r\n -\x{10FFFF}]",$pe).")($)?)u",$P,$B))preg_match("(^(".repeat_pattern("[\t\r\n -~]",$pe).")($)?)",$P,$B);return
|
|||
|
h($B[1]).$zh.(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($gg,$Ad=array()){while(list($y,$X)=each($gg)){if(!in_array($y,$Ad)){if(is_array($X)){foreach($X
|
|||
|
as$Yd=>$W)$gg[$y."[$Yd]"]=$W;}else
|
|||
|
echo'<input type="hidden" name="'.h($y).'" 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,$Nc=false){$I=table_status($Q,$Nc);return($I?$I:array("Name"=>$Q));}function
|
|||
|
column_foreign_keys($Q){global$b;$I=array();foreach($b->foreignKeys($Q)as$q){foreach($q["source"]as$X)$I[$X][]=$q;}return$I;}function
|
|||
|
enum_input($T,$Ka,$o,$Y,$tc=null){global$b;preg_match_all("~'((?:[^']|'')*)'~",$o["length"],$xe);$I=($tc!==null?"<label><input type='$T'$Ka value='$tc'".((is_array($Y)?in_array($tc,$Y):$Y===0)?" checked":"")."><i>".lang(7)."</i></label>":"");foreach($xe[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$fb=(is_int($Y)?$Y==$s+1:(is_array($Y)?in_array($s+1,$Y):$Y===$X));$I.=" <label><input type='$T'$Ka value='".($s+1)."'".($fb?' checked':'').'>'.h($b->editVal($X,$o)).'</label>';}return$I;}function
|
|||
|
input($o,$Y,$r){global$g,$U,$b,$x;$C=h(bracket_escape($o["field"]));echo"<td class='function'>";if(is_array($Y)&&!$r){$Fa=array($Y);if(version_compare(PHP_VERSION,5.4)>=0)$Fa[]=JSON_PRETTY_PRINT;$Y=call_user_func_array('json_encode',$Fa);$r="json";}$Cg=($x=="mssql"&&$o["auto_increment"]);if($Cg&&!$_POST["save"])$r=null;$jd=(isset($_GET["select"])||$Cg?array("orig"=>lang(8)):array())+$b->editFunctions($o);$Ka=" name='fields[$C]'";if($o["type"]=="enum")echo
|
|||
|
nbsp($jd[""])."<td>".$b->editInput($_GET["edit"],$o,$Ka,$Y);else{$rd=(in_array($r,$jd)||isset($jd[$r]));echo(count($jd)>1?"<select name='function[$C]'>".optionlist($jd,$r===null||$rd?$r:"")."</select>".on_help("getTarget(event).value.replace(/^SQL\$/, '')",1).script("qsl('select').onchange = functionChange;",""):nbsp(reset($jd))).'<td>';$Md=$b->editInput($_GET["edit"],$o,$Ka,$Y);if($Md!="")echo$Md;elseif(preg_match('~bool~',$o["type"]))echo"<input type='hidden'$Ka value='0'>"."<input type='checkbox'".(preg_match('~^(1|t|true|y|yes|on)$~i',$Y)?" checked='checked'":"")."$Ka value='1'>";elseif($o["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$o["length"],$xe);foreach($xe[1]as$s=>$X){$X=stripcslashes(str_replace("''","'",$X));$fb=(is_int($Y)?($Y>>$s)&1:in_array($X,explode(",",$Y),true));echo" <label><input type='checkbox' name='fields[$C][$s]' value='".(1<<$s)."'".($fb?' checked':'').">".h($b->editVal($X,$o)).'</label>';}}elseif(preg_match('~blob|bytea|raw|file~',$o["type"])&&ini_bool("file_uploads"))echo"<input type='file' name='fields-$C'>";elseif(($Qh=preg_match('~text|lob~',$o["type"]))||preg_match("~\n~",$Y)){if($Qh&&$x!="sqlite")$Ka.=" cols='50' rows='12'";else{$K=min(12,substr_count($Y,"\n")+1);$Ka.=" cols='30' rows='$K'".($K==1?" style='height: 1.2em;'":"");}echo"<textarea$Ka>".h($Y).'</textarea>';}elseif($r=="json"||preg_match('~^jsonb?$~',$o["type"]))echo"<textarea$Ka cols='50' rows='12' class='jush-js'>".h($Y).'</textarea>';else{$De=(!preg_match('~int~',$o["type"])&&preg_match('~^(\\d+)(,(\\d+))?$~',$o["length"],$B)?((preg_match("~binary~",$o["type"])?2:1)*$B[1]+($B[3]?1:0)+($B[2]&&!$o["unsigned"]?1:0)):($U[$o["type"]]?$U[$o["type"]]+($o["unsigned"]?0:1):0));if($x=='sql'&&$g->server_info>=5.6&&preg_match('~time~',$o["type"]))$De+=7;echo"<input".((!$rd||$r==="")&&preg_match('~(?<!o)int~',$o["type"])&&!preg_match('~\[\]~',$o["full_type"])?" type='number'":"")." value='".h($Y)."'".($De?" data-maxlength='$De'":"").(preg_match('~char|binary~',$o["type"])&&$De>20?" size='40'":"")."$Ka>";}echo$b->editHint($_GET["edit"],$o,$Y);$Vc=0;foreach($jd
|
|||
|
as$y=>$X){if($y===""||!$X)break;$Vc++;}if($Vc)echo
|
|||
|
script("mixin(qsl('td'), {onchange: partial(skipOriginal, $Vc), oninput: function () { this.onchange(); }});");}}function
|
|||
|
process_input($o){global$b;$u=bracket_escape($o["field"]);$r=$_POST["function"][$u];$Y=$_POST["fields"][$u];if($o["type"]=="enum"){if($Y==-1)return
|
|||
|
false;if($Y=="")return"NULL";return+$Y;}if($o["auto_increment"]&&$Y=="")return
|
|||
|
null;if($r=="orig")return($o["on_update"]=="CURRENT_TIMESTAMP"?idf_escape($o["field"]):false);if($r=="NULL")return"NULL";if($o["type"]=="set")return
|
|||
|
array_sum((array)$Y);if($r=="json"){$r="";$Y=json_decode($Y,true);if(!is_array($Y))return
|
|||
|
false;return$Y;}if(preg_match('~blob|bytea|raw|file~',$o["type"])&&ini_bool("file_uploads")){$Sc=get_file("fields-$u");if(!is_string($Sc))return
|
|||
|
false;return
|
|||
|
q($Sc);}return$b->processInput($o,$Y,$r);}function
|
|||
|
fields_from_edit(){global$dc;$I=array();foreach((array)$_POST["field_keys"]as$y=>$X){if($X!=""){$X=bracket_escape($X);$_POST["function"][$X]=$_POST["field_funs"][$y];$_POST["fields"][$X]=$_POST["field_vals"][$y];}}foreach((array)$_POST["fields"]as$y=>$X){$C=bracket_escape($y,1);$I[$C]=array("field"=>$C,"privileges"=>array("insert"=>1,"update"=>1),"null"=>1,"auto_increment"=>($y==$dc->primary),);}return$I;}function
|
|||
|
search_tables(){global$b,$g;$_GET["where"][0]["val"]=$_POST["query"];$ed=false;foreach(table_status('',true)as$Q=>$R){$C=$b->tableName($R);if(isset($R["Engine"])&&$C!=""&&(!$_POST["tables"]||in_array($Q,$_POST["tables"]))){$H=$g->query("SELECT".limit("1 FROM ".table($Q)," WHERE ".implode(" AND ",$b->selectSearchProcess(fields($Q),array())),1));if(!$H||$H->fetch_row()){if(!$ed){echo"<ul>\n";$ed=true;}echo"<li>".($H?"<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($ed?"</ul>":"<p class='message'>".lang(9))."\n";}function
|
|||
|
dump_headers($zd,$Ne=false){global$b;$I=$b->dumpHeaders($zd,$Ne);$Bf=$_POST["output"];if($Bf!="text")header("Content-Disposition: attachment; filename=".$b->dumpFilename($zd).".$I".($Bf!="file"&&!preg_match('~[^0-9a-z]~',$Bf)?".$Bf":""));session_write_close();ob_flush();flush();return$I;}function
|
|||
|
dump_csv($J){foreach($J
|
|||
|
as$y=>$X){if(preg_match("~[\"\n,;\t]~",$X)||$X==="")$J[$y]='"'.str_replace('"','""',$X).'"';}echo
|
|||
|
implode(($_POST["format"]=="csv"?",":($_POST["format"]=="tsv"?"\t":";")),$J)."\r\n";}function
|
|||
|
apply_sql_function($r,$d){return($r?($r=="unixepoch"?"DATETIME($d, '$r')":($r=="count distinct"?"COUNT(DISTINCT ":strtoupper("$r("))."$d)"):$d);}function
|
|||
|
get_temp_dir(){$I=ini_get("upload_tmp_dir");if(!$I){if(function_exists('sys_get_temp_dir'))$I=sys_get_temp_dir();else{$Tc=@tempnam("","");if(!$Tc)return
|
|||
|
false;$I=dirname($Tc);unlink($Tc);}}return$I;}function
|
|||
|
file_open_lock($Tc){$gd=@fopen($Tc,"r+");if(!$gd){$gd=@fopen($Tc,"w");if(!$gd)return;chmod($Tc,0660);}flock($gd,LOCK_EX);return$gd;}function
|
|||
|
file_write_unlock($gd,$Lb){rewind($gd);fwrite($gd,$Lb);ftruncate($gd,strlen($Lb));flock($gd,LOCK_UN);fclose($gd);}function
|
|||
|
password_file($i){$Tc=get_temp_dir()."/adminer.key";$I=@file_get_contents($Tc);if($I||!$i)return$I;$gd=@fopen($Tc,"w");if($gd){chmod($Tc,0660);$I=rand_string();fwrite($gd,$I);fclose($gd);}return$I;}function
|
|||
|
rand_string(){return
|
|||
|
md5(uniqid(mt_rand(),true));}function
|
|||
|
select_value($X,$_,$o,$Rh){global$b,$ba;if(is_array($X)){$I="";foreach($X
|
|||
|
as$Yd=>$W)$I.="<tr>".($X!=array_values($X)?"<th>".h($Yd):"")."<td>".select_value($W,$_,$o,$Rh);return"<table cellspacing='0'>$I</table>";}if(!$_)$_=$b->selectLink($X,$o);if($_===null){if(is_mail($X))$_="mailto:$X";if($jg=is_url($X))$_=(($jg=="http"&&$ba)||preg_match('~WebKit|Firefox~i',$_SERVER["HTTP_USER_AGENT"])?$X:"https://www.adminer.org/redirect/?url=".urlencode($X));}$I=$b->editVal($X,$o);if($I!==null){if($I==="")$I=" ";elseif(!is_utf8($I))$I="\0";elseif($Rh!=""&&is_shortable($o))$I=shorten_utf8($I,max(0,+$Rh));else$I=h($I);}return$b->selectVal($I,$_,$o,$X);}function
|
|||
|
is_mail($qc){$Ia='[-a-z0-9!#$%&\'*+/=?^_`{|}~]';$cc='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';$Qf="$Ia+(\\.$Ia+)*@($cc?\\.)+$cc";return
|
|||
|
is_string($qc)&&preg_match("(^$Qf(,\\s*$Qf)*\$)i",$qc);}function
|
|||
|
is_url($P){$cc='[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])';return(preg_match("~^(https?)://($cc?\\.)+$cc(:\\d+)?(/.*)?(\\?.*)?(#.*)?\$~i",$P,$B)?strtolower($B[1]):"");}function
|
|||
|
is_shortable($o){return
|
|||
|
preg_match('~char|text|lob|geometry|point|linestring|polygon|string|bytea~',$o["type"]);}function
|
|||
|
count_rows($Q,$Z,$Sd,$md){global$x;$G=" FROM ".table($Q).($Z?" WHERE ".implode(" AND ",$Z):"");return($Sd&&($x=="sql"||count($md)==1)?"SELECT COUNT(DISTINCT ".implode(", ",$md).")$G":"SELECT COUNT(*)".($Sd?" FROM (SELECT 1$G$nd) x":$G));}function
|
|||
|
slow_query($G){global$b,$ci;$m=$b->database();$Th=$b->queryTimeout();if(support("kill")&&is_object($h=connect())&&($m==""||$h->select_db($m))){$de=$h->result(connection_id());echo'<script',nonce(),'>
|
|||
|
var timeout = setTimeout(function () {
|
|||
|
ajax(\'',js_escape(ME),'script=kill\', function () {
|
|||
|
}, \'kill=',$de,'&token=',$ci,'\');
|
|||
|
}, ',1000*$Th,');
|
|||
|
</script>
|
|||
|
';}else$h=null;ob_flush();flush();$I=@get_key_vals($G,$h,$Th,false);if($h){echo
|
|||
|
script("clearTimeout(timeout);");ob_flush();flush();}return$I;}function
|
|||
|
get_token(){$pg=rand(1,1e6);return($pg^$_SESSION["token"]).":$pg";}function
|
|||
|
verify_token(){list($ci,$pg)=explode(":",$_POST["token"]);return($pg^$_SESSION["token"])==$ci;}function
|
|||
|
lzw_decompress($Sa){$Yb=256;$Ta=8;$mb=array();$Eg=0;$Fg=0;for($s=0;$s<strlen($Sa);$s++){$Eg=($Eg<<8)+ord($Sa[$s]);$Fg+=8;if($Fg>=$Ta){$Fg-=$Ta;$mb[]=$Eg>>$Fg;$Eg&=(1<<$Fg)-1;$Yb++;if($Yb>>$Ta)$Ta++;}}$Xb=range("\0","\xFF");$I="";foreach($mb
|
|||
|
as$s=>$lb){$pc=$Xb[$lb];if(!isset($pc))$pc=$Xi.$Xi[0];$I.=$pc;if($s)$Xb[]=$Xi.$pc[0];$Xi=$pc;}return$I;}function
|
|||
|
on_help($tb,$gh=0){return
|
|||
|
script("mixin(qsl('select, input'), {onmouseover: function (event) { helpMouseover.call(this, event, $tb, $gh) }, onmouseout: helpMouseout});","");}function
|
|||
|
edit_form($a,$p,$J,$yi){global$b,$x,$ci,$n;$Dh=$b->tableName(table_status1($a,true));page_header(($yi?lang(10):lang(11)),$n,array("select"=>array($a,$Dh)),$Dh);if($J===false)echo"<p class='error'>".lang(12)."\n";echo'<form action="" method="post" enctype="multipart/form-data" id="form">
|
|||
|
';if(!$p)echo"<p class='error'>".lang(13)."\n";else{echo"<table cellspacing='0'>".script("qsl('table').onkeydown = editingKeydown;");foreach($p
|
|||
|
as$C=>$o){echo"<tr><th>".$b->fieldName($o);$Sb=$_GET["set"][bracket_escape($C)];if($Sb===null){$Sb=$o["default"];if($o["type"]=="bit"&&preg_match("~^b'([01]*)'\$~",$Sb,$zg))$Sb=$zg[1];}$Y=($J!==null?($J[$C]!=""&&$x=="sql"&&preg_match("~enum|set~",$o["type"])?(is_array($J[$C])?array_sum($J[$C]):+$J[$C]):$J[$C]):(!$yi&&$o["auto_increment"]?"":(isset($_GET["select"])?false:$Sb)));if(!$_POST["save"]&&is_string($Y))$Y=$b->editVal($Y,$o);$r=($_POST["save"]?(string)$_POST["function"][$C]:($yi&&$o["on_update"]=="CURRENT_TIMESTAMP"?"now":($Y===false?null:($Y!==null?'':'NULL'))));if(preg_match("~time~",$o["type"])&&$Y=="CURRENT_TIMESTAMP"){$Y="";$r="now";}input($o,$Y,$r);echo"\n";}if(!support("table"))echo"<tr>"."<th><input name='field_keys[]'>".script("qsl('input').oninput = fieldChange;")."<td class='function'>".html_select("field_funs[]",$b->editFunctions(array("null"=>isset($_GET["select"]))))."<td><input name='field_vals[]'>"."\n";echo"</table>\n";}echo"<p>\n";if($p){echo"<input type='submit' value='".lang(14)."'>\n";if(!isset($_GET["select"])){echo"<input type='submit' name='insert' value='".($yi?lang(15):lang(16))."' title='Ctrl+Shift+Enter'>\n",($yi?script("qsl('input').onclick = function () { return !ajaxForm(this.form, '".lang(17)."...', this); };"):"");}}echo($yi?"<input type='submit' name='delete' value='".lang(18)."'>".confirm()."\n":($_POST||!$p?"":script("focus(qsa('td', qs('#form'))[1].firstChild);")));if(isset($_GET["select"]))hidden_fields(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));echo'<input type="hidden" name="referer" value="',h(isset($_POST["referer"])?$_POST["referer"]:$_SERVER["HTTP_REFERER"]),'">
|
|||
|
<input type="hidden" name="save" value="1">
|
|||
|
<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}global$b,$g,$ec,$mc,$wc,$n,$jd,$od,$ba,$Ld,$x,$ca,$ie,$hf,$Rf,$wh,$sd,$ci,$ii,$U,$xi,$ia;if(!$_SERVER["REQUEST_URI"])$_SERVER["REQUEST_URI"]=$_SERVER["ORIG_PATH_INFO"];if(!strpos($_SERVER["REQUEST_URI"],'?')&&$_SERVER["QUERY_STRING"]!="")$_SERVER["REQUEST_URI"].="?$_SERVER[QUERY_STRING]";$ba=$_SERVER["HTTPS"]&&strcasecmp($_SERVER["HTTPS"],"off");@ini_set("session.use_trans_sid",false);if(!defined("SID")){session_cache_limiter("");session_name("adminer_sid");$Ef=array(0,preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]),"",$ba);if(version_compare(PHP_VERSION,'5.2.0')>=0)$Ef[]=true;call_user_func_array('session_set_cookie_params',$Ef);session_start();}remove_slashes(array(&$_GET,&$_POST,&$_COOKIE),$Uc);if(get_magic_quotes_runtime())set_magic_quotes_runtime(false);@set_time_limit(0);@ini_set("zend.ze1_compatibility_mode",false);@ini_set("precision",17);$ie=array('en'=>'English','ar'=>'العربية','bg'=>'Български','bn'=>'বাংলা','bs'=>'Bosanski','ca'=>'Català','cs'=>'Čeština','da'=>'Dansk','de'=>'Deutsch','el'=>'Ελληνικά','es'=>'Español','et'=>'Eesti','fa'=>'فارسی','fi'=>'Suomi','fr'=>'Français','gl'=>'Galego','he'=>'עברית','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($u,$Ye=null){if(is_string($u)){$Uf=array_search($u,get_translations("en"));if($Uf!==false)$u=$Uf;}global$ca,$ii;$hi=($ii[$u]?$ii[$u]:$u);if(is_array($hi)){$Uf=($Ye==1?0:($ca=='cs'||$ca=='sk'?($Ye&&$Ye<5?1:2):($ca=='fr'?(!$Ye?0:1):($ca=='pl'?($Ye%10>1&&$Ye%10<5&&$Ye/10%10!=1?1:2):($ca=='sl'?($Ye%100==1?0:($Ye%100==2?1:($Ye%100==3||$Ye%100==4?2:3))):($ca=='lt'?($Ye%10==1&&$Ye%100!=11?0:($Ye%10>1&&$Ye/10%10!=1?1:2)):($ca=='bs'||$ca=='ru'||$ca=='sr'||$ca=='uk'?($Ye%10==1&&$Ye%100!=11?0:($Ye%10>1&&$Ye%10<5&&$Ye/10%10!=1?1:2)):1)))))));$hi=$hi[$Uf];}$Fa=func_get_args();array_shift($Fa);$dd=str_replace("%d","%s",$hi);if($dd!=$hi)$Fa[0]=format_number($Ye);return
|
|||
|
vsprintf($dd,$Fa);}function
|
|||
|
switch_lang(){global$ca,$ie;echo"<form action='' method='post'>\n<div id='lang'>",lang(19).": ".html_select("lang",$ie,$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($ie[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ca=$_COOKIE["adminer_lang"];}elseif(isset($ie[$_SESSION["lang"]]))$ca=$_SESSION["lang"];else{$va=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$xe,PREG_SET_ORDER);foreach($xe
|
|||
|
as$B)$va[$B[1]]=(isset($B[3])?$B[3]:1);arsort($va);foreach($va
|
|||
|
as$y=>$lg){if(isset($ie[$y])){$ca=$y;break;}$y=preg_replace('~-.*~','',$y);if(!isset($va[$y])&&isset($ie[$y])){$ca=$y;break;}}}$ii=$_SESSION["translations"];if($_SESSION["translations_version"]!=2769047022){$ii=array();$_SESSION["translations_version"]=2769047022;}function
|
|||
|
get_translations($he){switch($he){case"en":$f="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>mw<6D><77><EFBFBD><EFBFBD>O<EFBFBD><4F>mfpQ<10><><CE82>q<><71>a<EFBFBD>į<EFBFBD><C4AF><EFBFBD>\\<EFBFBD>}<7D><>5<EFBFBD>#|@<40>h<EFBFBD>3<><33>N<EFBFBD>}@<40><>i<EFBFBD><03><18>t<EFBFBD>sN}+<2B>\\<EFBFBD>p<EFBFBD>ۥ<EFBFBD>+<2B>̈<EFBFBD> NbB؍<42>8<EFBFBD><38><EFBFBD>#<23><>'<0C><>`P<>2<EFBFBD><32>+ಉ<><E0B289><EFBFBD><EFBFBD>*<2A><><EFBFBD>/<2F>h<EFBFBD><68>H<>\n<EFBFBD>:<3A><>9<0C>+8<><38><EFBFBD>8<EFBFBD>7<EFBFBD>Cs<43><73>\r<EFBFBD>`<60><><08>j<07>Ѐ<><D080><EFBFBD>D4<0E><><EFBFBD>9<EFBFBD>Ax^;<3B>r@6<>k<EFBFBD>\\<EFBFBD><EFBFBD><EFBFBD>|w-<Q<><51><EFBFBD><EFBFBD><EFBFBD>xD<78><07>Jċ<4A><C48B><EFBFBD>x<17>!<21>~<7E>B<EFBFBD>@<40><01>C<EFBFBD><43>)<29>0<EFBFBD>:<3A>8<EFBFBD>(Ʀ<>k<EFBFBD>Q9<0E>;<3B>:<3A><>KN <20><><EFBFBD><EFBFBD>2c(<28>Q<>sB<73>4<EFBFBD>e\n<EFBFBD>C<EFBFBD>*B1,<2C>O:<3A><>cxؗ<78>£<EFBFBD><C2A3><EFBFBD>#lҼ<6C>#<23>0<EFBFBD><30>h\rf⌣0<EFBFBD>:Ѵ<><D1B4>U<EFBFBD><55><EFBFBD><EFBFBD>?<3F>B0<42>7O<37><03> <20><>:3<><33>A<04>c@<14>#<23><><EFBFBD><EFBFBD>:<3A>2)#v<><76><EFBFBD>RZ<52>\n<EFBFBD>{<1D><><EFBFBD>)f<><66>M<EFBFBD>6R<36><52><EFBFBD>1<EFBFBD><31>D<EFBFBD>5Ք<04>?<11><><EFBFBD>R<EFBFBD>k<EFBFBD>@<40><0E>*<2A><>orh\0<EFBFBD><EFBFBD>+<08>.#c<>bXؠ<58>2<EFBFBD><32><EFBFBD>8\\@P<><e<0B>)<29>3<EFBFBD><33>O<EFBFBD>cΘ<63><CE98><EFBFBD>k<EFBFBD>/dQ<64><10>A.<2E><>3\r<EFBFBD><EFBFBD>Q<19><>*<2A>*\r<EFBFBD><EFBFBD>r7(<28><>D\\Ø<EFBFBD>3X<11>h݅<68><DD85><14>Z<EFBFBD>XA<58>T<EFBFBD><54><EFBFBD>[4`N<><4E>[<5B><>1꺾<31>k<><6B><EFBFBD><EFBFBD>;Ȑ<><C890>C<0C><><EFBFBD>Ґ<>b<EFBFBD><62>#2<>x<EFBFBD><1D><><05><>2<EFBFBD>H<><48><1B>ףƚR<0F>);<3B>ؔ\n<EFBFBD>X<EFBFBD>5<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>a\0<EFBFBD>2l<EFBFBD><EFBFBD><EFBFBD><EFBFBD><<3C>% <20>R\$<EFBFBD><EFBFBD>A<><41><EFBFBD>6.l<>6Ϛ<36><CF9A><EFBFBD><EFBFBD>J2k<32><6B>ˏ<EFBFBD><CB8F>v<EFBFBD><76><EFBFBD><EFBFBD>BUQ<><51>S<15>*<><7F>^<5E><>D<EFBFBD>&IҀ<49>)u<><75><EFBFBD>+<2B>R̶<52>K<EFBFBD><04>2d<32>Dv:w<>r<EFBFBD>N3<4E><12><0B>le4<65>&<26><><EFBFBD>\n_5<EFBFBD>l82ҚK<EFBFBD><EFBFBD><EFBFBD>6<EFBFBD>QLBP`_<><5F>^<5E><>߂<03><>H<08><><EFBFBD><EFBFBD><EFBFBD>\0<EFBFBD><02><><p(<28>\0PPI\" \$<EFBFBD><EFBFBD><EFBFBD>cDJHn7<6E>4<EFBFBD><34><EFBFBD>\"L<>2<><32><13>@R<>j<EFBFBD>&dԔ8k^;<3B>\r+<0C><12>XK<58><4B>g\r<EFBFBD><EFBFBD>G<EFBFBD><EFBFBD><EFBFBD>a!)%8ᐟ<14><>Mbd&:<3A>`<60><><EFBFBD><EFBFBD>vAz\"<10>rC:<3A>r&<26><><EFBFBD>gC1<43>&<0E>֨<EFBFBD><D6A8><EFBFBD><EFBFBD>;|<7C>=c*<2A>j<>-0<>'<27>0<EFBFBD>c<>\nD<EFBFBD>D⌋<>ZE<5A>'<27><> )<29>KV<05>r<02>Li(g<>\0<EFBFBD><19><H <14><0C>9<39>rd<>F\n<EFBFBD><EFBFBD>62ĸ<32>\$<EFBFBD>Q<EFBFBD>9\"\"<EFBFBD>Y<EFBFBD>)iy<69>-<0E><>\\L<EFBFBD>b6 <09>8P<>T<08>*m<>\0<EFBFBD>B`E<>LQU*<2A>|Q8PA3<41><06>TL<54><4C><EFBFBD><EFBFBD> <09><>g)@<40><1D>)\r樎P#TQú6<C3BA>a<EFBFBD><61><EFBFBD>x<EFBFBD><78>I4F\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD>bO<EFBFBD>Y<EFBFBD>?<3F> 28;P<08><><EFBFBD>a'<27><><EFBFBD>da<64><61><EFBFBD><EFBFBD>4<02><> <09>j`<60><><EFBFBD>8<EFBFBD><38>a>DP<44>&<26>\"`èg\r<10>B<><42><02><01>F<EFBFBD><0C>\$<EFBFBD><EFBFBD><02>܁)+iT̓b<CD83>B<EFBFBD><42><EFBFBD><EFBFBD><EFBFBD>X!P<><50>)\n~3<><33>\"Q<EFBFBD><EFBFBD><1B>\rdi<> <02><><EFBFBD><EFBFBD>!R*L+<06>\$<02>ʘ<EFBFBD><CA98><EFBFBD><<1F>(<28>aO?!L<><4C>%<25>^I<>V<EFBFBD>)<11><>m4&<26> <20><><EFBFBD><EFBFBD>-<13>?<3F><1D>2<EFBFBD><32>(#<23>t<EFBFBD>+<2B><><EFBFBD>گ<EFBFBD><DAAF><EFBFBD><EFBFBD><0C>PiIT<49><54>Sl<0F>/e<>-<2D><>b<EFBFBD><62><02>T!\$<08>_<EFBFBD><5F>>h&<26><>@<40>H(r0v<02>4C /@<40>EFHL<19>AF<41>5<18>A! <09>-<2D><>K<EFBFBD>H<EFBFBD>b<><62>&<26><17><>_oc<17><>݃ p<>J<4A><05><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>h%\n<EFBFBD>ߵ<EFBFBD>|<7C>.<2E><>6<EFBFBD>l pK*<2A><15><0C>B<EFBFBD>vO<76>D'r[<5B><>4@<40><><1F><><0C><>x*P<>Y<EFBFBD>D@(+<2B>PŊ<50><C58A><EFBFBD><EFBFBD><EFBFBD>Ie<49>B<EFBFBD>j<08>p<EFBFBD><70>8<EFBFBD>\\<EFBFBD>a1<61>l<EFBFBD><6C>(<28><>0<EFBFBD><30><EFBFBD>9egY<11>b<EFBFBD>LKhI3<49><33>œ<EFBFBD>6<EFBFBD><36>!ȤH<><48><EFBFBD><EFBFBD><04>AP9o)<29><><EFBFBD><EFBFBD>q<>/Ս<>,<2C><><EFBFBD>-<1C><><EFBFBD>X<>1<EFBFBD><31>A1QԂ<51><D482><EFBFBD>ϕ<EFBFBD>'ι<><CEB9>OB<4F>sR<73><52>W<EFBFBD>\0<EFBFBD>֘<EFBFBD>qh<EFBFBD>o!sȿ<73><C8BF><EFBFBD><EFBFBD>F<><46><EFBFBD><EFBFBD>L<EFBFBD>7;<3B>=1X<31>̽<EFBFBD><CCBD>-FH<16>Xy<58>:<3A>R<EFBFBD>q<><71><EFBFBD><EFBFBD>6<EFBFBD><36>PE<50>i<EFBFBD>%<25>CQV@<40><>q<EFBFBD>ΐk<CE90>K<EFBFBD>4<01><><EFBFBD>c1<63><31>\"#r\0ٔ<EFBFBD>ge<EFBFBD>Uc)7d;#aI<61><49><EFBFBD>v<EFBFBD>ۛCAFp<46><70><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD><65>8<>j<EFBFBD><6A>U<EFBFBD>o9~\"k}n<><6E>7<>6\0<EFBFBD><EFBFBD>j<EFBFBD><EFBFBD><EFBFBD>ޑ+{<EFBFBD><EFBFBD><EFBFBD>ao@f<>Y<EFBFBD>Ӑ#57<35><37>\r<EFBFBD><EFBFBD>Y\0<EFBFBD>4<EFBFBD>+Q<>Y<EFBFBD>vq^<1D><><EFBFBD><19>;G6.<12><>ɡ}<7D>5<EFBFBD>N<EFBFBD>j<EFBFBD><13>M<EFBFBD><10><><EFBFBD>I1(!<21>k<EFBFBD><19><02>\r[c<>!<21><1D>B<EFBFBD><42><EFBFBD>l<EFBFBD>U<EFBFBD> <09>\$Mس!+<><7F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>=!<21>1GDtlw-ֈں<D688>.#<23><><EFBFBD>0<EFBFBD><30><17><><EFBFBD>'<27> Ge훧r[M<>IԇkeV<65><56>wM<77><4D><EFBFBD>G|<7C><>c:<3A><><EFBFBD><EFBFBD><EFBFBD>+ R<><52><EFBFBD>[6/<2F><1F>8A%<25>\"<EFBFBD><EFBFBD><EFBFBD>{<EFBFBD>&<26><><EFBFBD>!<21><><12><>M><3E><><<07>q.(J=<13><><1E><>RS<><53><EFBFBD>\$<EFBFBD><15><>,<2C>荽<EFBFBD><E88DBD><EFBFBD><EFBFBD>qp1^<5E><>Vf<56><66><EFBFBD><EFBFBD><EFBFBD>.`Ȣ<><C8A2>\r!/;<3B><>P<EFBFBD>o<EFBFBD><6F><11>ޝ}Q<>|J<><4A>ޯ8H<38>[<5B>}<7D>}<7D><10><>g<EFBFBD>+¯<>[}<7D>~<7E><>ݿ<05>><3E><><EFBFBD>1<31>eM<><4D>~A٣<41><D9A3>o<EFBFBD>t<0F>Q<EFBFBD><51><EFBFBD>BP<42><50><EFBFBD><EFBFBD>+n<><6E>c+,D`<60>%<25>N<EFBFBD><4E>`D<><44><EFBFBD><EFBFBD><EFBFBD>7<EFBFBD>ՂQ/<2F><><EFBFBD>dΠ<64>:<3A><>E<EFBFBD>^7<>\$<EFBFBD>p*<2A>`<60>qCNT<4E><54>s<EFBFBD>\"\rbL\"<EFBFBD>,<2C>pbj<62>N7\r<06><>ά<EFBFBD>;k<>lB2.\"<EFBFBD> pkl<><6C><EFBFBD><EFBFBD><EFBFBD>eHS<48>ڣx<>P<EFBFBD><03>\r<EFBFBD>Vf<>`<60><><EFBFBD>F<EFBFBD><46>0i<30><69>\r <20>j\"<EFBFBD>=\"p<EFBFBD><EFBFBD>\$<EFBFBD>I<EFBFBD>\n<EFBFBD><EFBFBD><05>p)řc<><63>n<0E>\"Z<EFBFBD><EFBFBD>n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4۰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\"l<EFBFBD>3t<>N<EFBFBD>4J.<2E><><EFBFBD> ؛#<23>6<EFBFBD><36>.⚴0<E29AB4>3\n<11><><EFBFBD><EFBFBD>tXcf% <09>:1**<2A><>\n<18>f<14><>8<EFBFBD><38>UB \"Q<><51>.p<><70>-<2D>P<EFBFBD><50>\0<EFBFBD>kp<><70>\n1<><06>Qn<51>#\\x<EFBFBD><EFBFBD><18>f<EFBFBD><0F><>{\nQ~y<>&@<40><>jh<6A>*榧<><E6A6A7>ʆ<EFBFBD>P<EFBFBD><50>FT<46>P<><50>@ <09><>[M\\<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%<25><1C><> /B<><42>`+<2B>%<25>ȟ<EFBFBD><C89F>'e(-<2D><>@<40><<10><>'<27>x<EFBFBD>(<28><>\0<EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><EFBFBD>R4<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><02><>O<EFBFBD>j<EFBFBD>Pc/<2F>\"<EFBFBD>()<29>Ե<EFBFBD>/K<><0C>ZG\"L<EFBFBD>\"<EFBFBD>6T<>E\$<EFBFBD><EFBFBD>p<>N*@";break;case"ar":$f="<EFBFBD>C<EFBFBD>P<EFBFBD><><C28D>l*<2A>\r<EFBFBD>,&\n<EFBFBD>A<EFBFBD><15><><EFBFBD>(J.<19><>0Se\\<EFBFBD>\r<EFBFBD><EFBFBD>b<>@<40>0<>,\nQ,l)<29><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>A<14><>j_1<5F>C<EFBFBD>M<EFBFBD><4D>e<0B><>S<>\ng@<40>Og<4F><67><EFBFBD><EFBFBD>X<EFBFBD>DM<44>)<29><>0<18><>cA<63><41>n8<1C>e*y#au4<75><34> <20>Ir*;rS<72>U<>dJ }<7D><><EFBFBD>*z<>U<12>@<40><>X;ai1l(n<><1B><><EFBFBD><EFBFBD><EFBFBD>[<14>y<EFBFBD>d<EFBFBD>u'c(<28><>oF<><46><EFBFBD><EFBFBD>e3<65>Nb<03><><EFBFBD>p2N<>S<EFBFBD><53>ӳ:LZ<4C>z<EFBFBD>P<EFBFBD>\\b<EFBFBD><EFBFBD>u<EFBFBD>.<2E>[<5B>Q`u !<15><>Jy<4A><79>&2<11><>(gT<1C><>SњM<D19A>x<EFBFBD>5g5<67>K<EFBFBD>K<EFBFBD>¦<EFBFBD><C2A6><EFBFBD><EFBFBD><EFBFBD>0ʇƢ<CA87><C6A2>\nS <20><>r\$<EFBFBD><10><>j<EFBFBD>(<28><>v<EFBFBD><76><EFBFBD><0E>!Jb<4A><62><EFBFBD><EFBFBD>q<02><>0\n<EFBFBD><EFBFBD>j\n<EFBFBD><10><><EFBFBD><0C><>j<EFBFBD><6A>@<40>z<18>l<\$W<EFBFBD><EFBFBD>rؓ<EFBFBD><EFBFBD>s<EFBFBD><EFBFBD><EFBFBD><EFBFBD><1A>U&<26>[<1A>*<2A><>l<08>ꎠ(B&<26><><EFBFBD><EFBFBD><04>4_!<05><1A><>d\\B<EFBFBD><EFBFBD>=<3D>t[<17> <09><>?<3F>:<3A>X<EFBFBD><58>ؐ<>eJ \$<EFBFBD><EFBFBD><EFBFBD>\n&<26>3ޜ:<3A><><EFBFBD><03><>ñ?+T\n<08>Ь<1B> J<>\0x0<EFBFBD>#<23><>3<07><10>:<0E><><EFBFBD><05>x<EFBFBD>Q<EFBFBD><51><08>6<EFBFBD>C(<28>\r<EFBFBD><EFBFBD><EFBFBD><17><>u`<7cp<63>4<EFBFBD><34><EFBFBD>D<EFBFBD><07>H<EFBFBD>85<38>mb:<07>x<EFBFBD>)m<><6D>ލ<EFBFBD>#h<>m(<28>(<28><>Kv<4B><76>%<25><>[G<>B<EFBFBD>=2m[<5B><><0C><>j<EFBFBD>Q%<25><>uq<>s<EFBFBD>d<EFBFBD><64>JCD<43>SZ<>ɻ<EFBFBD><C9BB>\"<EFBFBD>t<EFBFBD><EFBFBD>#<23><13><><EFBFBD>1<EFBFBD><31>^O<>|<7C><>W<EFBFBD>e<EFBFBD>/<2F>J]9J<39><4A>\"R<EFBFBD><08>6<0E>\0<EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F<EFBFBD>r<EFBFBD><EFBFBD><EFBFBD>I<EFBFBD>Z<EFBFBD><EFBFBD>)<29>֛kR<<3C><>J<EFBFBD>#=^V<>U\$O<EFBFBD><19>Y<<3C>^[<5B>bZƥ-<2D>m< P<><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ףc<18>7L)D<><44>bbԇ<15><><EFBFBD><EFBFBD>a<EFBFBD><61><04><><13><><EFBFBD>O\n<04><><EFBFBD><EFBFBD>v<EFBFBD>2@<40><>o<EFBFBD>1lk<6C>Ȧ6<>[<5B><><EFBFBD><0E><>q<EFBFBD><71>A<EFBFBD><41><04><>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>;<0E><>`u<>we<77>ý#<23>+<2B>GN,<2C><>;[<5B>qCo\r<EFBFBD>m<17>h9<0E>`<14>4\r,\r<EFBFBD>0<EFBFBD>6U,+<2B>D<EFBFBD>t\r7&<26>P<EFBFBD>7<EFBFBD>n<><<3C><03>l:<3A>cd9<64><39><EFBFBD>@6\r<EFBFBD>;<3B>9<EFBFBD><39><EFBFBD><EFBFBD><EFBFBD>#8<><38>`KgUp<>݅<03>R<EFBFBD><52><EFBFBD>idb<><62><11>!T#䔢AZ<0B>a\r[H-<2D><>\\V<EFBFBD>#b<>5<1B><><EFBFBD><EFBFBD>ы<EFBFBD>(<28><14><><EFBFBD><EFBFBD><EFBFBD><16>C<><43>Ɨ<EFBFBD><C697><01>q<EFBFBD>\r<EFBFBD><EFBFBD>نeZ<EFBFBD>U<EFBFBD><EFBFBD>S<><53><EFBFBD><EFBFBD>C<1A>V<EFBFBD><56>U&<26>T<EFBFBD><54>)<29><>Ern<72>PgX<67><1C><>2<EFBFBD>!<21>J<EFBFBD>'<05>(\r<EFBFBD>U<>3<EFBFBD>[d<>A<EFBFBD>Db<44><0B><>P\$<EFBFBD><EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>haf<>9<1A><>ú<>Y<EFBFBD><59><\0ҥ<EFBFBD>\$<08><><EFBFBD>K)<29>4<EFBFBD>
|
|||
|
Min_PDO
|
|||
|
extends
|
|||
|
PDO{var$_result,$server_info,$affected_rows,$errno,$error;function
|
|||
|
__construct(){global$b;$Uf=array_search("SQL",$b->operators);if($Uf!==false)unset($b->operators[$Uf]);}function
|
|||
|
dsn($jc,$V,$F){try{parent::__construct($jc,$V,$F);}catch(Exception$Ac){auth_error(h($Ac->getMessage()));}$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=@$this->getAttribute(4);}function
|
|||
|
query($G,$ri=false){$H=parent::query($G);$this->error="";if(!$H){list(,$this->errno,$this->error)=$this->errorInfo();return
|
|||
|
false;}$this->store_result($H);return$H;}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result($H=null){if(!$H){$H=$this->_result;if(!$H)return
|
|||
|
false;}if($H->columnCount()){$H->num_rows=$H->rowCount();return$H;}$this->affected_rows=$H->rowCount();return
|
|||
|
true;}function
|
|||
|
next_result(){if(!$this->_result)return
|
|||
|
false;$this->_result->_offset=0;return@$this->_result->nextRowset();}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H)return
|
|||
|
false;$J=$H->fetch();return$J[$o];}}class
|
|||
|
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(){$J=(object)$this->getColumnMeta($this->_offset++);$J->orgtable=$J->table;$J->orgname=$J->name;$J->charsetnr=(in_array("blob",(array)$J->flags)?63:0);return$J;}}}$ec=array();class
|
|||
|
Min_SQL{var$_conn;function
|
|||
|
__construct($g){$this->_conn=$g;}function
|
|||
|
select($Q,$L,$Z,$md,$rf=array(),$z=1,$E=0,$cg=false){global$b,$x;$Sd=(count($md)<count($L));$G=$b->selectQueryBuild($L,$Z,$md,$rf,$z,$E);if(!$G)$G="SELECT".limit(($_GET["page"]!="last"&&$z!=""&&$md&&$Sd&&$x=="sql"?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$L)."\nFROM ".table($Q),($Z?"\nWHERE ".implode(" AND ",$Z):"").($md&&$Sd?"\nGROUP BY ".implode(", ",$md):"").($rf?"\nORDER BY ".implode(", ",$rf):""),($z!=""?+$z:null),($E?$z*$E:0),"\n");$sh=microtime(true);$I=$this->_conn->query($G);if($cg)echo$b->selectQuery($G,format_time($sh));return$I;}function
|
|||
|
delete($Q,$ng,$z=0){$G="FROM ".table($Q);return
|
|||
|
queries("DELETE".($z?limit1($G,$ng):" $G$ng"));}function
|
|||
|
update($Q,$N,$ng,$z=0,$Zg="\n"){$Ii=array();foreach($N
|
|||
|
as$y=>$X)$Ii[]="$y = $X";$G=table($Q)." SET$Zg".implode(",$Zg",$Ii);return
|
|||
|
queries("UPDATE".($z?limit1($G,$ng):" $G$ng"));}function
|
|||
|
insert($Q,$N){return
|
|||
|
queries("INSERT INTO ".table($Q).($N?" (".implode(", ",array_keys($N)).")\nVALUES (".implode(", ",$N).")":" DEFAULT VALUES"));}function
|
|||
|
insertUpdate($Q,$K,$ag){return
|
|||
|
false;}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN");}function
|
|||
|
commit(){return
|
|||
|
queries("COMMIT");}function
|
|||
|
rollback(){return
|
|||
|
queries("ROLLBACK");}}$ec["sqlite"]="SQLite 3";$ec["sqlite2"]="SQLite 2";if(isset($_GET["sqlite"])||isset($_GET["sqlite2"])){$Xf=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
|
|||
|
__construct($Tc){$this->_link=new
|
|||
|
SQLite3($Tc);$Li=$this->_link->version();$this->server_info=$Li["versionString"];}function
|
|||
|
query($G){$H=@$this->_link->query($G);$this->error="";if(!$H){$this->errno=$this->_link->lastErrorCode();$this->error=$this->_link->lastErrorMsg();return
|
|||
|
false;}elseif($H->numColumns())return
|
|||
|
new
|
|||
|
Min_Result($H);$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($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;$J=$H->_result->fetchArray();return$J[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;}function
|
|||
|
fetch_assoc(){return$this->_result->fetchArray(SQLITE3_ASSOC);}function
|
|||
|
fetch_row(){return$this->_result->fetchArray(SQLITE3_NUM);}function
|
|||
|
fetch_field(){$d=$this->_offset++;$T=$this->_result->columnType($d);return(object)array("name"=>$this->_result->columnName($d),"type"=>$T,"charsetnr"=>($T==SQLITE3_BLOB?63:0),);}function
|
|||
|
__desctruct(){return$this->_result->finalize();}}}else{class
|
|||
|
Min_SQLite{var$extension="SQLite",$server_info,$affected_rows,$error,$_link;function
|
|||
|
__construct($Tc){$this->server_info=sqlite_libversion();$this->_link=new
|
|||
|
SQLiteDatabase($Tc);}function
|
|||
|
query($G,$ri=false){$Ke=($ri?"unbufferedQuery":"query");$H=@$this->_link->$Ke($G,SQLITE_BOTH,$n);$this->error="";if(!$H){$this->error=$n;return
|
|||
|
false;}elseif($H===true){$this->affected_rows=$this->changes();return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
quote($P){return"'".sqlite_escape_string($P)."'";}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;$J=$H->_result->fetch();return$J[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;if(method_exists($H,'numRows'))$this->num_rows=$H->numRows();}function
|
|||
|
fetch_assoc(){$J=$this->_result->fetch(SQLITE_ASSOC);if(!$J)return
|
|||
|
false;$I=array();foreach($J
|
|||
|
as$y=>$X)$I[($y[0]=='"'?idf_unescape($y):$y)]=$X;return$I;}function
|
|||
|
fetch_row(){return$this->_result->fetch(SQLITE_NUM);}function
|
|||
|
fetch_field(){$C=$this->_result->fieldName($this->_offset++);$Qf='(\\[.*]|"(?:[^"]|"")*"|(.+))';if(preg_match("~^($Qf\\.)?$Qf\$~",$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
|
|||
|
__construct($Tc){$this->dsn(DRIVER.":$Tc","","");}}}if(class_exists("Min_SQLite")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_SQLite{function
|
|||
|
__construct(){parent::__construct(":memory:");$this->query("PRAGMA foreign_keys = 1");}function
|
|||
|
select_db($Tc){if(is_readable($Tc)&&$this->query("ATTACH ".$this->quote(preg_match("~(^[/\\\\]|:)~",$Tc)?$Tc:dirname($_SERVER["SCRIPT_FILENAME"])."/$Tc")." AS a")){parent::__construct($Tc);$this->query("PRAGMA foreign_keys = 1");return
|
|||
|
true;}return
|
|||
|
false;}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
next_result(){return
|
|||
|
false;}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$K,$ag){$Ii=array();foreach($K
|
|||
|
as$N)$Ii[]="(".implode(", ",$N).")";return
|
|||
|
queries("REPLACE INTO ".table($Q)." (".implode(", ",array_keys(reset($K))).") VALUES\n".implode(",\n",$Ii));}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){return
|
|||
|
new
|
|||
|
Min_DB;}function
|
|||
|
get_databases(){return
|
|||
|
array();}function
|
|||
|
limit($G,$Z,$z,$D=0,$Zg=" "){return" $G$Z".($z!==null?$Zg."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($G,$Z){global$g;return($g->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')")?limit($G,$Z,1):" $G$Z");}function
|
|||
|
db_collation($m,$qb){global$g;return$g->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($l){return
|
|||
|
array();}function
|
|||
|
table_status($C=""){global$g;$I=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$J){$J["Oid"]=1;$J["Auto_increment"]="";$J["Rows"]=$g->result("SELECT COUNT(*) FROM ".idf_escape($J["Name"]));$I[$J["Name"]]=$J;}foreach(get_rows("SELECT * FROM sqlite_sequence",null,"")as$J)$I[$J["name"]]["Auto_increment"]=$J["seq"];return($C!=""?$I[$C]:$I);}function
|
|||
|
is_view($R){return$R["Engine"]=="view";}function
|
|||
|
fk_support($R){global$g;return!$g->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");}function
|
|||
|
fields($Q){global$g;$I=array();$ag="";foreach(get_rows("PRAGMA table_info(".table($Q).")")as$J){$C=$J["name"];$T=strtolower($J["type"]);$Sb=$J["dflt_value"];$I[$C]=array("field"=>$C,"type"=>(preg_match('~int~i',$T)?"integer":(preg_match('~char|clob|text~i',$T)?"text":(preg_match('~blob~i',$T)?"blob":(preg_match('~real|floa|doub~i',$T)?"real":"numeric")))),"full_type"=>$T,"default"=>(preg_match("~'(.*)'~",$Sb,$B)?str_replace("''","'",$B[1]):($Sb=="NULL"?null:$Sb)),"null"=>!$J["notnull"],"privileges"=>array("select"=>1,"insert"=>1,"update"=>1),"primary"=>$J["pk"],);if($J["pk"]){if($ag!="")$I[$ag]["auto_increment"]=false;elseif(preg_match('~^integer$~i',$T))$I[$C]["auto_increment"]=true;$ag=$C;}}$ph=$g->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',$ph,$xe,PREG_SET_ORDER);foreach($xe
|
|||
|
as$B){$C=str_replace('""','"',preg_replace('~^"|"$~','',$B[1]));if($I[$C])$I[$C]["collation"]=trim($B[3],"'");}return$I;}function
|
|||
|
indexes($Q,$h=null){global$g;if(!is_object($h))$h=$g;$I=array();$ph=$h->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ".q($Q));if(preg_match('~\bPRIMARY\s+KEY\s*\((([^)"]+|"[^"]*")++)~i',$ph,$B)){$I[""]=array("type"=>"PRIMARY","columns"=>array(),"lengths"=>array(),"descs"=>array());preg_match_all('~((("[^"]*+")+)|(\S+))(\s+(ASC|DESC))?(,\s*|$)~i',$B[1],$xe,PREG_SET_ORDER);foreach($xe
|
|||
|
as$B){$I[""]["columns"][]=idf_unescape($B[2]).$B[4];$I[""]["descs"][]=(preg_match('~DESC~i',$B[5])?'1':null);}}if(!$I){foreach(fields($Q)as$C=>$o){if($o["primary"])$I[""]=array("type"=>"PRIMARY","columns"=>array($C),"lengths"=>array(),"descs"=>array(null));}}$rh=get_key_vals("SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ".q($Q),$h);foreach(get_rows("PRAGMA index_list(".table($Q).")",$h)as$J){$C=$J["name"];$v=array("type"=>($J["unique"]?"UNIQUE":"INDEX"));$v["lengths"]=array();$v["descs"]=array();foreach(get_rows("PRAGMA index_info(".idf_escape($C).")",$h)as$Og){$v["columns"][]=$Og["name"];$v["descs"][]=null;}if(preg_match('~^CREATE( UNIQUE)? INDEX '.preg_quote(idf_escape($C).' ON '.idf_escape($Q),'~').' \((.*)\)$~i',$rh[$C],$zg)){preg_match_all('/("[^"]*+")+( DESC)?/',$zg[2],$xe);foreach($xe[2]as$y=>$X){if($X)$v["descs"][$y]='1';}}if(!$I[""]||$v["type"]!="UNIQUE"||$v["columns"]!=$I[""]["columns"]||$v["descs"]!=$I[""]["descs"]||!preg_match("~^sqlite_~",$C))$I[$C]=$v;}return$I;}function
|
|||
|
foreign_keys($Q){$I=array();foreach(get_rows("PRAGMA foreign_key_list(".table($Q).")")as$J){$q=&$I[$J["id"]];if(!$q)$q=$J;$q["source"][]=$J["from"];$q["target"][]=$J["to"];}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\\s+~iU','',$g->result("SELECT sql FROM sqlite_master WHERE name = ".q($C))));}function
|
|||
|
collations(){return(isset($_GET["create"])?get_vals("PRAGMA collation_list",1):array());}function
|
|||
|
information_schema($m){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
check_sqlite_name($C){global$g;$Kc="db|sdb|sqlite";if(!preg_match("~^[^\\0]*\\.($Kc)\$~",$C)){$g->error=lang(21,str_replace("|",", ",$Kc));return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
create_database($m,$pb){global$g;if(file_exists($m)){$g->error=lang(22);return
|
|||
|
false;}if(!check_sqlite_name($m))return
|
|||
|
false;try{$_=new
|
|||
|
Min_SQLite($m);}catch(Exception$Ac){$g->error=$Ac->getMessage();return
|
|||
|
false;}$_->query('PRAGMA encoding = "UTF-8"');$_->query('CREATE TABLE adminer (i)');$_->query('DROP TABLE adminer');return
|
|||
|
true;}function
|
|||
|
drop_databases($l){global$g;$g->__construct(":memory:");foreach($l
|
|||
|
as$m){if(!@unlink($m)){$g->error=lang(22);return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
rename_database($C,$pb){global$g;if(!check_sqlite_name($C))return
|
|||
|
false;$g->__construct(":memory:");$g->error=lang(22);return@rename(DB,$C);}function
|
|||
|
auto_increment(){return" PRIMARY KEY".(DRIVER=="sqlite"?" AUTOINCREMENT":"");}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$Kf){$Ci=($Q==""||$ad);foreach($p
|
|||
|
as$o){if($o[0]!=""||!$o[1]||$o[2]){$Ci=true;break;}}$c=array();$_f=array();foreach($p
|
|||
|
as$o){if($o[1]){$c[]=($Ci?$o[1]:"ADD ".implode($o[1]));if($o[0]!="")$_f[$o[0]]=$o[1][0];}}if(!$Ci){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,$_f,$ad))return
|
|||
|
false;if($Ma)queries("UPDATE sqlite_sequence SET seq = $Ma WHERE name = ".q($C));return
|
|||
|
true;}function
|
|||
|
recreate_table($Q,$C,$p,$_f,$ad,$w=array()){if($Q!=""){if(!$p){foreach(fields($Q)as$y=>$o){$p[]=process_field($o,$o);$_f[$y]=idf_escape($y);}}$bg=false;foreach($p
|
|||
|
as$o){if($o[6])$bg=true;}$hc=array();foreach($w
|
|||
|
as$y=>$X){if($X[2]=="DROP"){$hc[$X[1]]=true;unset($w[$y]);}}foreach(indexes($Q)as$be=>$v){$e=array();foreach($v["columns"]as$y=>$d){if(!$_f[$d])continue
|
|||
|
2;$e[]=$_f[$d].($v["descs"][$y]?" DESC":"");}if(!$hc[$be]){if($v["type"]!="PRIMARY"||!$bg)$w[]=array($v["type"],$be,$e);}}foreach($w
|
|||
|
as$y=>$X){if($X[0]=="PRIMARY"){unset($w[$y]);$ad[]=" PRIMARY KEY (".implode(", ",$X[2]).")";}}foreach(foreign_keys($Q)as$be=>$q){foreach($q["source"]as$y=>$d){if(!$_f[$d])continue
|
|||
|
2;$q["source"][$y]=idf_unescape($_f[$d]);}if(!isset($ad[" $be"]))$ad[]=" ".format_foreign_key($q);}queries("BEGIN");}foreach($p
|
|||
|
as$y=>$o)$p[$y]=" ".implode($o);$p=array_merge($p,array_filter($ad));if(!queries("CREATE TABLE ".table($Q!=""?"adminer_$C":$C)." (\n".implode(",\n",$p)."\n)"))return
|
|||
|
false;if($Q!=""){if($_f&&!queries("INSERT INTO ".table("adminer_$C")." (".implode(", ",$_f).") SELECT ".implode(", ",array_map('idf_escape',array_keys($_f)))." FROM ".table($Q)))return
|
|||
|
false;$oi=array();foreach(triggers($Q)as$mi=>$Uh){$li=trigger($mi);$oi[]="CREATE TRIGGER ".idf_escape($mi)." ".implode(" ",$Uh)." ON ".table($C)."\n$li[Statement]";}if(!queries("DROP TABLE ".table($Q)))return
|
|||
|
false;queries("ALTER TABLE ".table("adminer_$C")." RENAME TO ".table($C));if(!alter_indexes($C,$w))return
|
|||
|
false;foreach($oi
|
|||
|
as$li){if(!queries($li))return
|
|||
|
false;}queries("COMMIT");}return
|
|||
|
true;}function
|
|||
|
index_sql($Q,$T,$C,$e){return"CREATE $T ".($T!="INDEX"?"INDEX ":"").idf_escape($C!=""?$C:uniqid($Q."_"))." ON ".table($Q)." $e";}function
|
|||
|
alter_indexes($Q,$c){foreach($c
|
|||
|
as$ag){if($ag[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($Ni){return
|
|||
|
apply_queries("DROP VIEW",$Ni);}function
|
|||
|
drop_tables($S){return
|
|||
|
apply_queries("DROP TABLE",$S);}function
|
|||
|
move_tables($S,$Ni,$Lh){return
|
|||
|
false;}function
|
|||
|
trigger($C){global$g;if($C=="")return
|
|||
|
array("Statement"=>"BEGIN\n\t;\nEND");$u='(?:[^`"\\s]+|`[^`]*`|"[^"]*")+';$ni=trigger_options();preg_match("~^CREATE\\s+TRIGGER\\s*$u\\s*(".implode("|",$ni["Timing"]).")\\s+([a-z]+)(?:\\s+OF\\s+($u))?\\s+ON\\s*$u\\s*(?:FOR\\s+EACH\\s+ROW\\s)?(.*)~is",$g->result("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ".q($C)),$B);$af=$B[3];return
|
|||
|
array("Timing"=>strtoupper($B[1]),"Event"=>strtoupper($B[2]).($af?" OF":""),"Of"=>($af[0]=='`'||$af[0]=='"'?idf_unescape($af):$af),"Trigger"=>$C,"Statement"=>$B[4],);}function
|
|||
|
triggers($Q){$I=array();$ni=trigger_options();foreach(get_rows("SELECT * FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q))as$J){preg_match('~^CREATE\\s+TRIGGER\\s*(?:[^`"\\s]+|`[^`]*`|"[^"]*")+\\s*('.implode("|",$ni["Timing"]).')\\s*(.*)\\s+ON\\b~iU',$J["sql"],$B);$I[$J["name"]]=array($B[1],$B[2]);}return$I;}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,$T){}function
|
|||
|
routines(){}function
|
|||
|
routine_languages(){}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN");}function
|
|||
|
last_id(){global$g;return$g->result("SELECT LAST_INSERT_ROWID()");}function
|
|||
|
explain($g,$G){return$g->query("EXPLAIN QUERY PLAN $G");}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($Sg){return
|
|||
|
true;}function
|
|||
|
create_sql($Q,$Ma,$xh){global$g;$I=$g->result("SELECT sql FROM sqlite_master WHERE type IN ('table', 'view') AND name = ".q($Q));foreach(indexes($Q)as$C=>$v){if($C=='')continue;$I.=";\n\n".index_sql($Q,$v['type'],$C,"(".implode(", ",array_map('idf_escape',$v['columns'])).")");}return$I;}function
|
|||
|
truncate_sql($Q){return"DELETE FROM ".table($Q);}function
|
|||
|
use_sql($k){}function
|
|||
|
trigger_sql($Q){return
|
|||
|
implode(get_vals("SELECT sql || ';;\n' FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ".q($Q)));}function
|
|||
|
show_variables(){global$g;$I=array();foreach(array("auto_vacuum","cache_size","count_changes","default_cache_size","empty_result_callbacks","encoding","foreign_keys","full_column_names","fullfsync","journal_mode","journal_size_limit","legacy_file_format","locking_mode","page_size","max_page_count","read_uncommitted","recursive_triggers","reverse_unordered_selects","secure_delete","short_column_names","synchronous","temp_store","temp_store_directory","schema_version","integrity_check","quick_check")as$y)$I[$y]=$g->result("PRAGMA $y");return$I;}function
|
|||
|
show_status(){$I=array();foreach(get_vals("PRAGMA compile_options")as$of){list($y,$X)=explode("=",$of,2);$I[$y]=$X;}return$I;}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
support($Oc){return
|
|||
|
preg_match('~^(columns|database|drop_col|dump|indexes|move_col|sql|status|table|trigger|variables|view|view_trigger)$~',$Oc);}$x="sqlite";$U=array("integer"=>0,"real"=>0,"numeric"=>0,"text"=>0,"blob"=>0);$wh=array_keys($U);$xi=array();$mf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL","SQL");$jd=array("hex","length","lower","round","unixepoch","upper");$od=array("avg","count","count distinct","group_concat","max","min","sum");$mc=array(array(),array("integer|real|numeric"=>"+/-","text"=>"||",));}$ec["pgsql"]="PostgreSQL";if(isset($_GET["pgsql"])){$Xf=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($xc,$n){if(ini_bool("html_errors"))$n=html_entity_decode(strip_tags($n));$n=preg_replace('~^[^:]*: ~','',$n);$this->error=$n;}function
|
|||
|
connect($M,$V,$F){global$b;$m=$b->database();set_error_handler(array($this,'_error'));$this->_string="host='".str_replace(":","' port='",addcslashes($M,"'\\"))."' user='".addcslashes($V,"'\\")."' password='".addcslashes($F,"'\\")."'";$this->_link=@pg_connect("$this->_string dbname='".($m!=""?addcslashes($m,"'\\"):"postgres")."'",PGSQL_CONNECT_FORCE_NEW);if(!$this->_link&&$m!=""){$this->_database=false;$this->_link=@pg_connect("$this->_string dbname='postgres'",PGSQL_CONNECT_FORCE_NEW);}restore_error_handler();if($this->_link){$Li=pg_version($this->_link);$this->server_info=$Li["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($k){global$b;if($k==$b->database())return$this->_database;$I=@pg_connect("$this->_string dbname='".addcslashes($k,"'\\")."'",PGSQL_CONNECT_FORCE_NEW);if($I)$this->_link=$I;return$I;}function
|
|||
|
close(){$this->_link=@pg_connect("$this->_string dbname='postgres'");}function
|
|||
|
query($G,$ri=false){$H=@pg_query($this->_link,$G);$this->error="";if(!$H){$this->error=pg_last_error($this->_link);return
|
|||
|
false;}elseif(!pg_num_fields($H)){$this->affected_rows=pg_affected_rows($H);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H||!$H->num_rows)return
|
|||
|
false;return
|
|||
|
pg_fetch_result($H->_result,0,$o);}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;$this->num_rows=pg_num_rows($H);}function
|
|||
|
fetch_assoc(){return
|
|||
|
pg_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
pg_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$d=$this->_offset++;$I=new
|
|||
|
stdClass;if(function_exists('pg_field_table'))$I->orgtable=pg_field_table($this->_result,$d);$I->name=pg_field_name($this->_result,$d);$I->orgname=$I->name;$I->type=pg_field_type($this->_result,$d);$I->charsetnr=($I->type=="bytea"?63:0);return$I;}function
|
|||
|
__destruct(){pg_free_result($this->_result);}}}elseif(extension_loaded("pdo_pgsql")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_PgSQL";function
|
|||
|
connect($M,$V,$F){global$b;$m=$b->database();$P="pgsql:host='".str_replace(":","' port='",addcslashes($M,"'\\"))."' options='-c client_encoding=utf8'";$this->dsn("$P dbname='".($m!=""?addcslashes($m,"'\\"):"postgres")."'",$V,$F);return
|
|||
|
true;}function
|
|||
|
select_db($k){global$b;return($b->database()==$k);}function
|
|||
|
close(){}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$K,$ag){global$g;foreach($K
|
|||
|
as$N){$yi=array();$Z=array();foreach($N
|
|||
|
as$y=>$X){$yi[]="$y = $X";if(isset($ag[idf_unescape($y)]))$Z[]="$y = $X";}if(!(($Z&&queries("UPDATE ".table($Q)." SET ".implode(", ",$yi)." WHERE ".implode(" AND ",$Z))&&$g->affected_rows)||queries("INSERT INTO ".table($Q)." (".implode(", ",array_keys($N)).") VALUES (".implode(", ",$N).")")))return
|
|||
|
false;}return
|
|||
|
true;}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b,$U,$wh;$g=new
|
|||
|
Min_DB;$j=$b->credentials();if($g->connect($j[0],$j[1],$j[2])){if($g->server_info>=9){$g->query("SET application_name = 'Adminer'");if($g->server_info>=9.2){$wh[lang(23)][]="json";$U["json"]=4294967295;if($g->server_info>=9.4){$wh[lang(23)][]="jsonb";$U["jsonb"]=4294967295;}}}return$g;}return$g->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT datname FROM pg_database WHERE has_database_privilege(datname, 'CONNECT') ORDER BY datname");}function
|
|||
|
limit($G,$Z,$z,$D=0,$Zg=" "){return" $G$Z".($z!==null?$Zg."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($G,$Z){return" $G$Z";}function
|
|||
|
db_collation($m,$qb){global$g;return$g->result("SHOW LC_COLLATE");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$g;return$g->result("SELECT user");}function
|
|||
|
tables_list(){$G="SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema()";if(support('materializedview'))$G.="
|
|||
|
UNION ALL
|
|||
|
SELECT matviewname, 'MATERIALIZED VIEW'
|
|||
|
FROM pg_matviews
|
|||
|
WHERE schemaname = current_schema()";$G.="
|
|||
|
ORDER BY 1";return
|
|||
|
get_key_vals($G);}function
|
|||
|
count_tables($l){return
|
|||
|
array();}function
|
|||
|
table_status($C=""){$I=array();foreach(get_rows("SELECT c.relname AS \"Name\", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS \"Engine\", pg_relation_size(c.oid) AS \"Data_length\", pg_total_relation_size(c.oid) - pg_relation_size(c.oid) AS \"Index_length\", obj_description(c.oid, 'pg_class') AS \"Comment\", c.relhasoids::int AS \"Oid\", c.reltuples as \"Rows\", n.nspname
|
|||
|
FROM pg_class c
|
|||
|
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace)
|
|||
|
WHERE relkind IN ('r', 'm', 'v', 'f')
|
|||
|
".($C!=""?"AND relname = ".q($C):"ORDER BY relname"))as$J)$I[$J["Name"]]=$J;return($C!=""?$I[$C]:$I);}function
|
|||
|
is_view($R){return
|
|||
|
in_array($R["Engine"],array("view","materialized view"));}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$I=array();$Da=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$J){preg_match('~([^([]+)(\((.*)\))?([a-z ]+)?((\[[0-9]*])*)$~',$J["full_type"],$B);list(,$T,$pe,$J["length"],$xa,$Ga)=$B;$J["length"].=$Ga;$eb=$T.$xa;if(isset($Da[$eb])){$J["type"]=$Da[$eb];$J["full_type"]=$J["type"].$pe.$Ga;}else{$J["type"]=$T;$J["full_type"]=$J["type"].$pe.$xa.$Ga;}$J["null"]=!$J["attnotnull"];$J["auto_increment"]=preg_match('~^nextval\\(~i',$J["default"]);$J["privileges"]=array("insert"=>1,"select"=>1,"update"=>1);if(preg_match('~(.+)::[^)]+(.*)~',$J["default"],$B))$J["default"]=($B[1]=="NULL"?null:(($B[1][0]=="'"?idf_unescape($B[1]):$B[1]).$B[2]));$I[$J["field"]]=$J;}return$I;}function
|
|||
|
indexes($Q,$h=null){global$g;if(!is_object($h))$h=$g;$I=array();$Eh=$h->result("SELECT oid FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema()) AND relname = ".q($Q));$e=get_key_vals("SELECT attnum, attname FROM pg_attribute WHERE attrelid = $Eh AND attnum > 0",$h);foreach(get_rows("SELECT relname, indisunique::int, indisprimary::int, indkey, indoption , (indpred IS NOT NULL)::int as indispartial FROM pg_index i, pg_class ci WHERE i.indrelid = $Eh AND ci.oid = i.indexrelid",$h)as$J){$_g=$J["relname"];$I[$_g]["type"]=($J["indispartial"]?"INDEX":($J["indisprimary"]?"PRIMARY":($J["indisunique"]?"UNIQUE":"INDEX")));$I[$_g]["columns"]=array();foreach(explode(" ",$J["indkey"])as$Hd)$I[$_g]["columns"][]=$e[$Hd];$I[$_g]["descs"]=array();foreach(explode(" ",$J["indoption"])as$Id)$I[$_g]["descs"][]=($Id&1?'1':null);$I[$_g]["lengths"]=array();}return$I;}function
|
|||
|
foreign_keys($Q){global$hf;$I=array();foreach(get_rows("SELECT conname, condeferrable::int AS deferrable, 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$J){if(preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA',$J['definition'],$B)){$J['source']=array_map('trim',explode(',',$B[1]));if(preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~',$B[2],$we)){$J['ns']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$we[2]));$J['table']=str_replace('""','"',preg_replace('~^"(.+)"$~','\1',$we[4]));}$J['target']=array_map('trim',explode(',',$B[3]));$J['on_delete']=(preg_match("~ON DELETE ($hf)~",$B[4],$we)?$we[1]:'NO ACTION');$J['on_update']=(preg_match("~ON UPDATE ($hf)~",$B[4],$we)?$we[1]:'NO ACTION');$I[$J['conname']]=$J;}}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>trim($g->result("SELECT pg_get_viewdef(".q($C).")")));}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($m){return($m=="information_schema");}function
|
|||
|
error(){global$g;$I=h($g->error);if(preg_match('~^(.*\\n)?([^\\n]*)\\n( *)\\^(\\n.*)?$~s',$I,$B))$I=$B[1].preg_replace('~((?:[^&]|&[^;]*;){'.strlen($B[3]).'})(.*)~','\\1<b>\\2</b>',$B[2]).$B[4];return
|
|||
|
nl_br($I);}function
|
|||
|
create_database($m,$pb){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($m).($pb?" ENCODING ".idf_escape($pb):""));}function
|
|||
|
drop_databases($l){global$g;$g->close();return
|
|||
|
apply_queries("DROP DATABASE",$l,'idf_escape');}function
|
|||
|
rename_database($C,$pb){return
|
|||
|
queries("ALTER DATABASE ".idf_escape(DB)." RENAME TO ".idf_escape($C));}function
|
|||
|
auto_increment(){return"";}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$Kf){$c=array();$mg=array();foreach($p
|
|||
|
as$o){$d=idf_escape($o[0]);$X=$o[1];if(!$X)$c[]="DROP $d";else{$Hi=$X[5];unset($X[5]);if(isset($X[6])&&$o[0]=="")$X[1]=($X[1]=="bigint"?" big":" ")."serial";if($o[0]=="")$c[]=($Q!=""?"ADD ":" ").implode($X);else{if($d!=$X[0])$mg[]="ALTER TABLE ".table($Q)." RENAME $d TO $X[0]";$c[]="ALTER $d TYPE$X[1]";if(!$X[6]){$c[]="ALTER $d ".($X[3]?"SET$X[3]":"DROP DEFAULT");$c[]="ALTER $d ".($X[2]==" NULL"?"DROP NOT":"SET").$X[2];}}if($o[0]!=""||$Hi!="")$mg[]="COMMENT ON COLUMN ".table($Q).".$X[0] IS ".($Hi!=""?substr($Hi,9):"''");}}$c=array_merge($c,$ad);if($Q=="")array_unshift($mg,"CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");elseif($c)array_unshift($mg,"ALTER TABLE ".table($Q)."\n".implode(",\n",$c));if($Q!=""&&$Q!=$C)$mg[]="ALTER TABLE ".table($Q)." RENAME TO ".table($C);if($Q!=""||$vb!="")$mg[]="COMMENT ON TABLE ".table($C)." IS ".q($vb);if($Ma!=""){}foreach($mg
|
|||
|
as$G){if(!queries($G))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($Q,$c){$i=array();$fc=array();$mg=array();foreach($c
|
|||
|
as$X){if($X[0]!="INDEX")$i[]=($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")$fc[]=idf_escape($X[1]);else$mg[]="CREATE INDEX ".idf_escape($X[1]!=""?$X[1]:uniqid($Q."_"))." ON ".table($Q)." (".implode(", ",$X[2]).")";}if($i)array_unshift($mg,"ALTER TABLE ".table($Q).implode(",",$i));if($fc)array_unshift($mg,"DROP INDEX ".implode(", ",$fc));foreach($mg
|
|||
|
as$G){if(!queries($G))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){return
|
|||
|
queries("TRUNCATE ".implode(", ",array_map('table',$S)));return
|
|||
|
true;}function
|
|||
|
drop_views($Ni){return
|
|||
|
drop_tables($Ni);}function
|
|||
|
drop_tables($S){foreach($S
|
|||
|
as$Q){$O=table_status($Q);if(!queries("DROP ".strtoupper($O["Engine"])." ".table($Q)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
move_tables($S,$Ni,$Lh){foreach(array_merge($S,$Ni)as$Q){$O=table_status($Q);if(!queries("ALTER ".strtoupper($O["Engine"])." ".table($Q)." SET SCHEMA ".idf_escape($Lh)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($C,$Q=null){if($C=="")return
|
|||
|
array("Statement"=>"EXECUTE PROCEDURE ()");if($Q===null)$Q=$_GET['trigger'];$K=get_rows('SELECT t.trigger_name AS "Trigger", t.action_timing AS "Timing", (SELECT STRING_AGG(event_manipulation, \' OR \') FROM information_schema.triggers WHERE event_object_table = t.event_object_table AND trigger_name = t.trigger_name ) AS "Events", t.event_manipulation AS "Event", \'FOR EACH \' || t.action_orientation AS "Type", t.action_statement AS "Statement" FROM information_schema.triggers t WHERE t.event_object_table = '.q($Q).' AND t.trigger_name = '.q($C));return
|
|||
|
reset($K);}function
|
|||
|
triggers($Q){$I=array();foreach(get_rows("SELECT * FROM information_schema.triggers WHERE event_object_table = ".q($Q))as$J)$I[$J["trigger_name"]]=array($J["action_timing"],$J["event_manipulation"]);return$I;}function
|
|||
|
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($g,$G){return$g->query("EXPLAIN $G");}function
|
|||
|
found_rows($R,$Z){global$g;if(preg_match("~ rows=([0-9]+)~",$g->result("EXPLAIN SELECT * FROM ".idf_escape($R["Name"]).($Z?" WHERE ".implode(" AND ",$Z):"")),$zg))return$zg[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$g;return$g->result("SELECT current_schema()");}function
|
|||
|
set_schema($Rg){global$g,$U,$wh;$I=$g->query("SET search_path TO ".idf_escape($Rg));foreach(types()as$T){if(!isset($U[$T])){$U[$T]=0;$wh[lang(24)][]=$T;}}return$I;}function
|
|||
|
create_sql($Q,$Ma,$xh){global$g;$I='';$Hg=array();$bh=array();$O=table_status($Q);$p=fields($Q);$w=indexes($Q);ksort($w);$Yc=foreign_keys($Q);ksort($Yc);if(!$O||empty($p))return
|
|||
|
false;$I="CREATE TABLE ".idf_escape($O['nspname']).".".idf_escape($O['Name'])." (\n ";foreach($p
|
|||
|
as$Qc=>$o){$Hf=idf_escape($o['field']).' '.$o['full_type'].(is_null($o['default'])?"":" DEFAULT $o[default]").($o['attnotnull']?" NOT NULL":"");$Hg[]=$Hf;if(preg_match('~nextval\(\'([^\']+)\'\)~',$o['default'],$xe)){$ah=$xe[1];$oh=reset(get_rows("SELECT * FROM $ah"));$bh[]=($xh=="DROP+CREATE"?"DROP SEQUENCE $ah;\n":"")."CREATE SEQUENCE $ah INCREMENT $oh[increment_by] MINVALUE $oh[min_value] MAXVALUE $oh[max_value] START ".($Ma?$oh['last_value']:1)." CACHE $oh[cache_value];";}}if(!empty($bh))$I=implode("\n\n",$bh)."\n\n$I";foreach($w
|
|||
|
as$Cd=>$v){switch($v['type']){case'UNIQUE':$Hg[]="CONSTRAINT ".idf_escape($Cd)." UNIQUE (".implode(', ',array_map('idf_escape',$v['columns'])).")";break;case'PRIMARY':$Hg[]="CONSTRAINT ".idf_escape($Cd)." PRIMARY KEY (".implode(', ',array_map('idf_escape',$v['columns'])).")";break;}}foreach($Yc
|
|||
|
as$Xc=>$Wc)$Hg[]="CONSTRAINT ".idf_escape($Xc)." $Wc[definition] ".($Wc['deferrable']?'DEFERRABLE':'NOT DEFERRABLE');$I.=implode(",\n ",$Hg)."\n) WITH (oids = ".($O['Oid']?'true':'false').");";foreach($w
|
|||
|
as$Cd=>$v){if($v['type']=='INDEX')$I.="\n\nCREATE INDEX ".idf_escape($Cd)." ON ".idf_escape($O['nspname']).".".idf_escape($O['Name'])." USING btree (".implode(', ',array_map('idf_escape',$v['columns'])).");";}if($O['Comment'])$I.="\n\nCOMMENT ON TABLE ".idf_escape($O['nspname']).".".idf_escape($O['Name'])." IS ".q($O['Comment']).";";foreach($p
|
|||
|
as$Qc=>$o){if($o['comment'])$I.="\n\nCOMMENT ON COLUMN ".idf_escape($O['nspname']).".".idf_escape($O['Name']).".".idf_escape($Qc)." IS ".q($o['comment']).";";}return
|
|||
|
rtrim($I,';');}function
|
|||
|
trigger_sql($Q){$O=table_status($Q);$I="";foreach(triggers($Q)as$ki=>$ji){$li=trigger($ki,$O['Name']);$I.="\nCREATE TRIGGER ".idf_escape($li['Trigger'])." $li[Timing] $li[Events] ON ".idf_escape($O["nspname"]).".".idf_escape($O['Name'])." $li[Type] $li[Statement];;\n";}return$I;}function
|
|||
|
use_sql($k){return"\connect ".idf_escape($k);}function
|
|||
|
show_variables(){return
|
|||
|
get_key_vals("SHOW ALL");}function
|
|||
|
process_list(){global$g;return
|
|||
|
get_rows("SELECT * FROM pg_stat_activity ORDER BY ".($g->server_info<9.2?"procpid":"pid"));}function
|
|||
|
show_status(){}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
support($Oc){global$g;return
|
|||
|
preg_match('~^(database|table|columns|sql|indexes|comment|view|'.($g->server_info>=9.3?'materializedview|':'').'scheme|processlist|sequence|trigger|type|variables|drop_col|kill|dump)$~',$Oc);}function
|
|||
|
kill_process($X){return
|
|||
|
queries("SELECT pg_terminate_backend(".number($X).")");}function
|
|||
|
connection_id(){return"SELECT pg_backend_pid()";}function
|
|||
|
max_connections(){global$g;return$g->result("SHOW max_connections");}$x="pgsql";$U=array();$wh=array();foreach(array(lang(25)=>array("smallint"=>5,"integer"=>10,"bigint"=>19,"boolean"=>1,"numeric"=>0,"real"=>7,"double precision"=>16,"money"=>20),lang(26)=>array("date"=>13,"time"=>17,"timestamp"=>20,"timestamptz"=>21,"interval"=>0),lang(23)=>array("character"=>0,"character varying"=>0,"text"=>0,"tsquery"=>0,"tsvector"=>0,"uuid"=>0,"xml"=>0),lang(27)=>array("bit"=>0,"bit varying"=>0,"bytea"=>0),lang(28)=>array("cidr"=>43,"inet"=>43,"macaddr"=>17,"txid_snapshot"=>0),lang(29)=>array("box"=>0,"circle"=>0,"line"=>0,"lseg"=>0,"path"=>0,"point"=>0,"polygon"=>0),)as$y=>$X){$U+=$X;$wh[$y]=array_keys($X);}$xi=array();$mf=array("=","<",">","<=",">=","!=","~","!~","LIKE","LIKE %%","ILIKE","ILIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$jd=array("char_length","lower","round","to_hex","to_timestamp","upper");$od=array("avg","count","count distinct","max","min","sum");$mc=array(array("char"=>"md5","date|time"=>"now",),array("int|numeric|real|money"=>"+/-","date|time"=>"+ interval/- interval","char|text"=>"||",));}$ec["oracle"]="Oracle";if(isset($_GET["oracle"])){$Xf=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($xc,$n){if(ini_bool("html_errors"))$n=html_entity_decode(strip_tags($n));$n=preg_replace('~^[^:]*: ~','',$n);$this->error=$n;}function
|
|||
|
connect($M,$V,$F){$this->_link=@oci_new_connect($V,$F,$M,"AL32UTF8");if($this->_link){$this->server_info=oci_server_version($this->_link);return
|
|||
|
true;}$n=oci_error();$this->error=$n["message"];return
|
|||
|
false;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($k){return
|
|||
|
true;}function
|
|||
|
query($G,$ri=false){$H=oci_parse($this->_link,$G);$this->error="";if(!$H){$n=oci_error($this->_link);$this->errno=$n["code"];$this->error=$n["message"];return
|
|||
|
false;}set_error_handler(array($this,'_error'));$I=@oci_execute($H);restore_error_handler();if($I){if(oci_num_fields($H))return
|
|||
|
new
|
|||
|
Min_Result($H);$this->affected_rows=oci_num_rows($H);}return$I;}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=1){$H=$this->query($G);if(!is_object($H)||!oci_fetch($H->_result))return
|
|||
|
false;return
|
|||
|
oci_result($H->_result,$o);}}class
|
|||
|
Min_Result{var$_result,$_offset=1,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;}function
|
|||
|
_convert($J){foreach((array)$J
|
|||
|
as$y=>$X){if(is_a($X,'OCI-Lob'))$J[$y]=$X->load();}return$J;}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(){$d=$this->_offset++;$I=new
|
|||
|
stdClass;$I->name=oci_field_name($this->_result,$d);$I->orgname=$I->name;$I->type=oci_field_type($this->_result,$d);$I->charsetnr=(preg_match("~raw|blob|bfile~",$I->type)?63:0);return$I;}function
|
|||
|
__destruct(){oci_free_statement($this->_result);}}}elseif(extension_loaded("pdo_oci")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_OCI";function
|
|||
|
connect($M,$V,$F){$this->dsn("oci:dbname=//$M;charset=AL32UTF8",$V,$F);return
|
|||
|
true;}function
|
|||
|
select_db($k){return
|
|||
|
true;}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
begin(){return
|
|||
|
true;}}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b;$g=new
|
|||
|
Min_DB;$j=$b->credentials();if($g->connect($j[0],$j[1],$j[2]))return$g;return$g->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT tablespace_name FROM user_tablespaces");}function
|
|||
|
limit($G,$Z,$z,$D=0,$Zg=" "){return($D?" * FROM (SELECT t.*, rownum AS rnum FROM (SELECT $G$Z) t WHERE rownum <= ".($z+$D).") WHERE rnum > $D":($z!==null?" * FROM (SELECT $G$Z) WHERE rownum <= ".($z+$D):" $G$Z"));}function
|
|||
|
limit1($G,$Z){return" $G$Z";}function
|
|||
|
db_collation($m,$qb){global$g;return$g->result("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'");}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$g;return$g->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($l){return
|
|||
|
array();}function
|
|||
|
table_status($C=""){$I=array();$Tg=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 = $Tg":"")."
|
|||
|
UNION SELECT view_name, 'view', 0, 0 FROM user_views".($C!=""?" WHERE view_name = $Tg":"")."
|
|||
|
ORDER BY 1")as$J){if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
|
|||
|
is_view($R){return$R["Engine"]=="view";}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$I=array();foreach(get_rows("SELECT * FROM all_tab_columns WHERE table_name = ".q($Q)." ORDER BY column_id")as$J){$T=$J["DATA_TYPE"];$pe="$J[DATA_PRECISION],$J[DATA_SCALE]";if($pe==",")$pe=$J["DATA_LENGTH"];$I[$J["COLUMN_NAME"]]=array("field"=>$J["COLUMN_NAME"],"full_type"=>$T.($pe?"($pe)":""),"type"=>strtolower($T),"length"=>$pe,"default"=>$J["DATA_DEFAULT"],"null"=>($J["NULLABLE"]=="Y"),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);}return$I;}function
|
|||
|
indexes($Q,$h=null){$I=array();foreach(get_rows("SELECT uic.*, uc.constraint_type
|
|||
|
FROM user_ind_columns uic
|
|||
|
LEFT JOIN user_constraints uc ON uic.index_name = uc.constraint_name AND uic.table_name = uc.table_name
|
|||
|
WHERE uic.table_name = ".q($Q)."
|
|||
|
ORDER BY uc.constraint_type, uic.column_position",$h)as$J){$Cd=$J["INDEX_NAME"];$I[$Cd]["type"]=($J["CONSTRAINT_TYPE"]=="P"?"PRIMARY":($J["CONSTRAINT_TYPE"]=="U"?"UNIQUE":"INDEX"));$I[$Cd]["columns"][]=$J["COLUMN_NAME"];$I[$Cd]["lengths"][]=($J["CHAR_LENGTH"]&&$J["CHAR_LENGTH"]!=$J["COLUMN_LENGTH"]?$J["CHAR_LENGTH"]:null);$I[$Cd]["descs"][]=($J["DESCEND"]?'1':null);}return$I;}function
|
|||
|
view($C){$K=get_rows('SELECT text "select" FROM user_views WHERE view_name = '.q($C));return
|
|||
|
reset($K);}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($m){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
explain($g,$G){$g->query("EXPLAIN PLAN FOR $G");return$g->query("SELECT * FROM plan_table");}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$Kf){$c=$fc=array();foreach($p
|
|||
|
as$o){$X=$o[1];if($X&&$o[0]!=""&&idf_escape($o[0])!=$X[0])queries("ALTER TABLE ".table($Q)." RENAME COLUMN ".idf_escape($o[0])." TO $X[0]");if($X)$c[]=($Q!=""?($o[0]!=""?"MODIFY (":"ADD ("):" ").implode($X).($Q!=""?")":"");else$fc[]=idf_escape($o[0]);}if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)");return(!$c||queries("ALTER TABLE ".table($Q)."\n".implode("\n",$c)))&&(!$fc||queries("ALTER TABLE ".table($Q)." DROP (".implode(", ",$fc).")"))&&($Q==$C||queries("ALTER TABLE ".table($Q)." RENAME TO ".table($C)));}function
|
|||
|
foreign_keys($Q){$I=array();$G="SELECT c_list.CONSTRAINT_NAME as NAME,
|
|||
|
c_src.COLUMN_NAME as SRC_COLUMN,
|
|||
|
c_dest.OWNER as DEST_DB,
|
|||
|
c_dest.TABLE_NAME as DEST_TABLE,
|
|||
|
c_dest.COLUMN_NAME as DEST_COLUMN,
|
|||
|
c_list.DELETE_RULE as ON_DELETE
|
|||
|
FROM ALL_CONSTRAINTS c_list, ALL_CONS_COLUMNS c_src, ALL_CONS_COLUMNS c_dest
|
|||
|
WHERE c_list.CONSTRAINT_NAME = c_src.CONSTRAINT_NAME
|
|||
|
AND c_list.R_CONSTRAINT_NAME = c_dest.CONSTRAINT_NAME
|
|||
|
AND c_list.CONSTRAINT_TYPE = 'R'
|
|||
|
AND c_src.TABLE_NAME = ".q($Q);foreach(get_rows($G)as$J)$I[$J['NAME']]=array("db"=>$J['DEST_DB'],"table"=>$J['DEST_TABLE'],"source"=>array($J['SRC_COLUMN']),"target"=>array($J['DEST_COLUMN']),"on_delete"=>$J['ON_DELETE'],"on_update"=>null,);return$I;}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($Ni){return
|
|||
|
apply_queries("DROP VIEW",$Ni);}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$g;return$g->result("SELECT sys_context('USERENV', 'SESSION_USER') FROM dual");}function
|
|||
|
set_schema($Sg){global$g;return$g->query("ALTER SESSION SET CURRENT_SCHEMA = ".idf_escape($Sg));}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(){$K=get_rows('SELECT * FROM v$instance');return
|
|||
|
reset($K);}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
support($Oc){return
|
|||
|
preg_match('~^(columns|database|drop_col|indexes|processlist|scheme|sql|status|table|variables|view|view_trigger)$~',$Oc);}$x="oracle";$U=array();$wh=array();foreach(array(lang(25)=>array("number"=>38,"binary_float"=>12,"binary_double"=>21),lang(26)=>array("date"=>10,"timestamp"=>29,"interval year"=>12,"interval day"=>28),lang(23)=>array("char"=>2000,"varchar2"=>4000,"nchar"=>2000,"nvarchar2"=>4000,"clob"=>4294967295,"nclob"=>4294967295),lang(27)=>array("raw"=>2000,"long raw"=>2147483648,"blob"=>4294967295,"bfile"=>4294967296),)as$y=>$X){$U+=$X;$wh[$y]=array_keys($X);}$xi=array();$mf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$jd=array("length","lower","round","upper");$od=array("avg","count","count distinct","max","min","sum");$mc=array(array("date"=>"current_date","timestamp"=>"current_timestamp",),array("number|float|double"=>"+/-","date|timestamp"=>"+ interval/- interval","char|clob"=>"||",));}$ec["mssql"]="MS SQL";if(isset($_GET["mssql"])){$Xf=array("SQLSRV","MSSQL","PDO_DBLIB");define("DRIVER","mssql");if(extension_loaded("sqlsrv")){class
|
|||
|
Min_DB{var$extension="sqlsrv",$_link,$_result,$server_info,$affected_rows,$errno,$error;function
|
|||
|
_get_error(){$this->error="";foreach(sqlsrv_errors()as$n){$this->errno=$n["code"];$this->error.="$n[message]\n";}$this->error=rtrim($this->error);}function
|
|||
|
connect($M,$V,$F){$this->_link=@sqlsrv_connect($M,array("UID"=>$V,"PWD"=>$F,"CharacterSet"=>"UTF-8"));if($this->_link){$Jd=sqlsrv_server_info($this->_link);$this->server_info=$Jd['SQLServerVersion'];}else$this->_get_error();return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($k){return$this->query("USE ".idf_escape($k));}function
|
|||
|
query($G,$ri=false){$H=sqlsrv_query($this->_link,$G);$this->error="";if(!$H){$this->_get_error();return
|
|||
|
false;}return$this->store_result($H);}function
|
|||
|
multi_query($G){$this->_result=sqlsrv_query($this->_link,$G);$this->error="";if(!$this->_result){$this->_get_error();return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
store_result($H=null){if(!$H)$H=$this->_result;if(!$H)return
|
|||
|
false;if(sqlsrv_field_metadata($H))return
|
|||
|
new
|
|||
|
Min_Result($H);$this->affected_rows=sqlsrv_rows_affected($H);return
|
|||
|
true;}function
|
|||
|
next_result(){return$this->_result?sqlsrv_next_result($this->_result):null;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;$J=$H->fetch_row();return$J[$o];}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;}function
|
|||
|
_convert($J){foreach((array)$J
|
|||
|
as$y=>$X){if(is_a($X,'DateTime'))$J[$y]=$X->format("Y-m-d H:i:s");}return$J;}function
|
|||
|
fetch_assoc(){return$this->_convert(sqlsrv_fetch_array($this->_result,SQLSRV_FETCH_ASSOC));}function
|
|||
|
fetch_row(){return$this->_convert(sqlsrv_fetch_array($this->_result,SQLSRV_FETCH_NUMERIC));}function
|
|||
|
fetch_field(){if(!$this->_fields)$this->_fields=sqlsrv_field_metadata($this->_result);$o=$this->_fields[$this->_offset++];$I=new
|
|||
|
stdClass;$I->name=$o["Name"];$I->orgname=$o["Name"];$I->type=($o["Type"]==1?254:0);return$I;}function
|
|||
|
seek($D){for($s=0;$s<$D;$s++)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($M,$V,$F){$this->_link=@mssql_connect($M,$V,$F);if($this->_link){$H=$this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");$J=$H->fetch_row();$this->server_info=$this->result("sp_server_info 2",2)." [$J[0]] $J[1]";}else$this->error=mssql_get_last_message();return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($k){return
|
|||
|
mssql_select_db($k);}function
|
|||
|
query($G,$ri=false){$H=@mssql_query($G,$this->_link);$this->error="";if(!$H){$this->error=mssql_get_last_message();return
|
|||
|
false;}if($H===true){$this->affected_rows=mssql_rows_affected($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
mssql_next_result($this->_result->_result);}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!is_object($H))return
|
|||
|
false;return
|
|||
|
mssql_result($H->_result,0,$o);}}class
|
|||
|
Min_Result{var$_result,$_offset=0,$_fields,$num_rows;function
|
|||
|
__construct($H){$this->_result=$H;$this->num_rows=mssql_num_rows($H);}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(){$I=mssql_fetch_field($this->_result);$I->orgtable=$I->table;$I->orgname=$I->name;return$I;}function
|
|||
|
seek($D){mssql_data_seek($this->_result,$D);}function
|
|||
|
__destruct(){mssql_free_result($this->_result);}}}elseif(extension_loaded("pdo_dblib")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_DBLIB";function
|
|||
|
connect($M,$V,$F){$this->dsn("dblib:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\\d)~',';port=\\1',$M)),$V,$F);return
|
|||
|
true;}function
|
|||
|
select_db($k){return$this->query("USE ".idf_escape($k));}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insertUpdate($Q,$K,$ag){foreach($K
|
|||
|
as$N){$yi=array();$Z=array();foreach($N
|
|||
|
as$y=>$X){$yi[]="$y = $X";if(isset($ag[idf_unescape($y)]))$Z[]="$y = $X";}if(!queries("MERGE ".table($Q)." USING (VALUES(".implode(", ",$N).")) AS source (c".implode(", c",range(1,count($N))).") ON ".implode(" AND ",$Z)." WHEN MATCHED THEN UPDATE SET ".implode(", ",$yi)." WHEN NOT MATCHED THEN INSERT (".implode(", ",array_keys($N)).") VALUES (".implode(", ",$N).");"))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
begin(){return
|
|||
|
queries("BEGIN TRANSACTION");}}function
|
|||
|
idf_escape($u){return"[".str_replace("]","]]",$u)."]";}function
|
|||
|
table($u){return($_GET["ns"]!=""?idf_escape($_GET["ns"]).".":"").idf_escape($u);}function
|
|||
|
connect(){global$b;$g=new
|
|||
|
Min_DB;$j=$b->credentials();if($g->connect($j[0],$j[1],$j[2]))return$g;return$g->error;}function
|
|||
|
get_databases(){return
|
|||
|
get_vals("SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')");}function
|
|||
|
limit($G,$Z,$z,$D=0,$Zg=" "){return($z!==null?" TOP (".($z+$D).")":"")." $G$Z";}function
|
|||
|
limit1($G,$Z){return
|
|||
|
limit($G,$Z,1);}function
|
|||
|
db_collation($m,$qb){global$g;return$g->result("SELECT collation_name FROM sys.databases WHERE name = ".q($m));}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$g;return$g->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($l){global$g;$I=array();foreach($l
|
|||
|
as$m){$g->select_db($m);$I[$m]=$g->result("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES");}return$I;}function
|
|||
|
table_status($C=""){$I=array();foreach(get_rows("SELECT name AS Name, type_desc AS Engine FROM sys.all_objects WHERE schema_id = SCHEMA_ID(".q(get_schema()).") AND type IN ('S', 'U', 'V') ".($C!=""?"AND name = ".q($C):"ORDER BY name"))as$J){if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
|
|||
|
is_view($R){return$R["Engine"]=="VIEW";}function
|
|||
|
fk_support($R){return
|
|||
|
true;}function
|
|||
|
fields($Q){$I=array();foreach(get_rows("SELECT c.max_length, c.precision, c.scale, c.name, c.is_nullable, c.is_identity, c.collation_name, t.name type, CAST(d.definition as text) [default]
|
|||
|
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$J){$T=$J["type"];$pe=(preg_match("~char|binary~",$T)?$J["max_length"]:($T=="decimal"?"$J[precision],$J[scale]":""));$I[$J["name"]]=array("field"=>$J["name"],"full_type"=>$T.($pe?"($pe)":""),"type"=>$T,"length"=>$pe,"default"=>$J["default"],"null"=>$J["is_nullable"],"auto_increment"=>$J["is_identity"],"collation"=>$J["collation_name"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"primary"=>$J["is_identity"],);}return$I;}function
|
|||
|
indexes($Q,$h=null){$I=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),$h)as$J){$C=$J["name"];$I[$C]["type"]=($J["is_primary_key"]?"PRIMARY":($J["is_unique"]?"UNIQUE":"INDEX"));$I[$C]["lengths"]=array();$I[$C]["columns"][$J["key_ordinal"]]=$J["column_name"];$I[$C]["descs"][$J["key_ordinal"]]=($J["is_descending_key"]?'1':null);}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>preg_replace('~^(?:[^[]|\\[[^]]*])*\\s+AS\\s+~isU','',$g->result("SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = SCHEMA_NAME() AND TABLE_NAME = ".q($C))));}function
|
|||
|
collations(){$I=array();foreach(get_vals("SELECT name FROM fn_helpcollations()")as$pb)$I[preg_replace('~_.*~','',$pb)][]=$pb;return$I;}function
|
|||
|
information_schema($m){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
nl_br(h(preg_replace('~^(\\[[^]]*])+~m','',$g->error)));}function
|
|||
|
create_database($m,$pb){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($m).(preg_match('~^[a-z0-9_]+$~i',$pb)?" COLLATE $pb":""));}function
|
|||
|
drop_databases($l){return
|
|||
|
queries("DROP DATABASE ".implode(", ",array_map('idf_escape',$l)));}function
|
|||
|
rename_database($C,$pb){if(preg_match('~^[a-z0-9_]+$~i',$pb))queries("ALTER DATABASE ".idf_escape(DB)." COLLATE $pb");queries("ALTER DATABASE ".idf_escape(DB)." MODIFY NAME = ".idf_escape($C));return
|
|||
|
true;}function
|
|||
|
auto_increment(){return" IDENTITY".($_POST["Auto_increment"]!=""?"(".number($_POST["Auto_increment"]).",1)":"")." PRIMARY KEY";}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$Kf){$c=array();foreach($p
|
|||
|
as$o){$d=idf_escape($o[0]);$X=$o[1];if(!$X)$c["DROP"][]=" COLUMN $d";else{$X[1]=preg_replace("~( COLLATE )'(\\w+)'~","\\1\\2",$X[1]);if($o[0]=="")$c["ADD"][]="\n ".implode("",$X).($Q==""?substr($ad[$X[0]],16+strlen($X[0])):"");else{unset($X[6]);if($d!=$X[0])queries("EXEC sp_rename ".q(table($Q).".$d").", ".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($ad)$c[""]=$ad;foreach($c
|
|||
|
as$y=>$X){if(!queries("ALTER TABLE ".idf_escape($C)." $y".implode(",",$X)))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
alter_indexes($Q,$c){$v=array();$fc=array();foreach($c
|
|||
|
as$X){if($X[2]=="DROP"){if($X[0]=="PRIMARY")$fc[]=idf_escape($X[1]);else$v[]=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(!$v||queries("DROP INDEX ".implode(", ",$v)))&&(!$fc||queries("ALTER TABLE ".table($Q)." DROP ".implode(", ",$fc)));}function
|
|||
|
last_id(){global$g;return$g->result("SELECT SCOPE_IDENTITY()");}function
|
|||
|
explain($g,$G){$g->query("SET SHOWPLAN_ALL ON");$I=$g->query($G);$g->query("SET SHOWPLAN_ALL OFF");return$I;}function
|
|||
|
found_rows($R,$Z){}function
|
|||
|
foreign_keys($Q){$I=array();foreach(get_rows("EXEC sp_fkeys @fktable_name = ".q($Q))as$J){$q=&$I[$J["FK_NAME"]];$q["table"]=$J["PKTABLE_NAME"];$q["source"][]=$J["FKCOLUMN_NAME"];$q["target"][]=$J["PKCOLUMN_NAME"];}return$I;}function
|
|||
|
truncate_tables($S){return
|
|||
|
apply_queries("TRUNCATE TABLE",$S);}function
|
|||
|
drop_views($Ni){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$Ni)));}function
|
|||
|
drop_tables($S){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
|
|||
|
move_tables($S,$Ni,$Lh){return
|
|||
|
apply_queries("ALTER SCHEMA ".idf_escape($Lh)." TRANSFER",array_merge($S,$Ni));}function
|
|||
|
trigger($C){if($C=="")return
|
|||
|
array();$K=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));$I=reset($K);if($I)$I["Statement"]=preg_replace('~^.+\\s+AS\\s+~isU','',$I["text"]);return$I;}function
|
|||
|
triggers($Q){$I=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$J)$I[$J["name"]]=array($J["Timing"],$J["Event"]);return$I;}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$g;if($_GET["ns"]!="")return$_GET["ns"];return$g->result("SELECT SCHEMA_NAME()");}function
|
|||
|
set_schema($Rg){return
|
|||
|
true;}function
|
|||
|
use_sql($k){return"USE ".idf_escape($k);}function
|
|||
|
show_variables(){return
|
|||
|
array();}function
|
|||
|
show_status(){return
|
|||
|
array();}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
support($Oc){return
|
|||
|
preg_match('~^(columns|database|drop_col|indexes|scheme|sql|table|trigger|view|view_trigger)$~',$Oc);}$x="mssql";$U=array();$wh=array();foreach(array(lang(25)=>array("tinyint"=>3,"smallint"=>5,"int"=>10,"bigint"=>20,"bit"=>1,"decimal"=>0,"real"=>12,"float"=>53,"smallmoney"=>10,"money"=>20),lang(26)=>array("date"=>10,"smalldatetime"=>19,"datetime"=>19,"datetime2"=>19,"time"=>8,"datetimeoffset"=>10),lang(23)=>array("char"=>8000,"varchar"=>8000,"text"=>2147483647,"nchar"=>4000,"nvarchar"=>4000,"ntext"=>1073741823),lang(27)=>array("binary"=>8000,"varbinary"=>8000,"image"=>2147483647),)as$y=>$X){$U+=$X;$wh[$y]=array_keys($X);}$xi=array();$mf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","NOT IN","IS NOT NULL");$jd=array("len","lower","round","upper");$od=array("avg","count","count distinct","max","min","sum");$mc=array(array("date|time"=>"getdate",),array("int|decimal|real|float|money|datetime"=>"+/-","char|text"=>"+",));}$ec['firebird']='Firebird (alpha)';if(isset($_GET["firebird"])){$Xf=array("interbase");define("DRIVER","firebird");if(extension_loaded("interbase")){class
|
|||
|
Min_DB{var$extension="Firebird",$server_info,$affected_rows,$errno,$error,$_link,$_result;function
|
|||
|
connect($M,$V,$F){$this->_link=ibase_connect($M,$V,$F);if($this->_link){$Ai=explode(':',$M);$this->service_link=ibase_service_attach($Ai[0],$V,$F);$this->server_info=ibase_server_info($this->service_link,IBASE_SVC_SERVER_VERSION);}else{$this->errno=ibase_errcode();$this->error=ibase_errmsg();}return(bool)$this->_link;}function
|
|||
|
quote($P){return"'".str_replace("'","''",$P)."'";}function
|
|||
|
select_db($k){return($k=="domain");}function
|
|||
|
query($G,$ri=false){$H=ibase_query($G,$this->_link);if(!$H){$this->errno=ibase_errcode();$this->error=ibase_errmsg();return
|
|||
|
false;}$this->error="";if($H===true){$this->affected_rows=ibase_affected_rows($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H||!$H->num_rows)return
|
|||
|
false;$J=$H->fetch_row();return$J[$o];}}class
|
|||
|
Min_Result{var$num_rows,$_result,$_offset=0;function
|
|||
|
__construct($H){$this->_result=$H;}function
|
|||
|
fetch_assoc(){return
|
|||
|
ibase_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
ibase_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$o=ibase_field_info($this->_result,$this->_offset++);return(object)array('name'=>$o['name'],'orgname'=>$o['name'],'type'=>$o['type'],'charsetnr'=>$o['length'],);}function
|
|||
|
__destruct(){ibase_free_result($this->_result);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{}function
|
|||
|
idf_escape($u){return'"'.str_replace('"','""',$u).'"';}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b;$g=new
|
|||
|
Min_DB;$j=$b->credentials();if($g->connect($j[0],$j[1],$j[2]))return$g;return$g->error;}function
|
|||
|
get_databases($Zc){return
|
|||
|
array("domain");}function
|
|||
|
limit($G,$Z,$z,$D=0,$Zg=" "){$I='';$I.=($z!==null?$Zg."FIRST $z".($D?" SKIP $D":""):"");$I.=" $G$Z";return$I;}function
|
|||
|
limit1($G,$Z){return
|
|||
|
limit($G,$Z,1);}function
|
|||
|
db_collation($m,$qb){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$b;$j=$b->credentials();return$j[1];}function
|
|||
|
tables_list(){global$g;$G='SELECT RDB$RELATION_NAME FROM rdb$relations WHERE rdb$system_flag = 0';$H=ibase_query($g->_link,$G);$I=array();while($J=ibase_fetch_assoc($H))$I[$J['RDB$RELATION_NAME']]='table';ksort($I);return$I;}function
|
|||
|
count_tables($l){return
|
|||
|
array();}function
|
|||
|
table_status($C="",$Nc=false){global$g;$I=array();$Lb=tables_list();foreach($Lb
|
|||
|
as$v=>$X){$v=trim($v);$I[$v]=array('Name'=>$v,'Engine'=>'standard',);if($C==$v)return$I[$v];}return$I;}function
|
|||
|
is_view($R){return
|
|||
|
false;}function
|
|||
|
fk_support($R){return
|
|||
|
preg_match('~InnoDB|IBMDB2I~i',$R["Engine"]);}function
|
|||
|
fields($Q){global$g;$I=array();$G='SELECT r.RDB$FIELD_NAME AS field_name,
|
|||
|
r.RDB$DESCRIPTION AS field_description,
|
|||
|
r.RDB$DEFAULT_VALUE AS field_default_value,
|
|||
|
r.RDB$NULL_FLAG AS field_not_null_constraint,
|
|||
|
f.RDB$FIELD_LENGTH AS field_length,
|
|||
|
f.RDB$FIELD_PRECISION AS field_precision,
|
|||
|
f.RDB$FIELD_SCALE AS field_scale,
|
|||
|
CASE f.RDB$FIELD_TYPE
|
|||
|
WHEN 261 THEN \'BLOB\'
|
|||
|
WHEN 14 THEN \'CHAR\'
|
|||
|
WHEN 40 THEN \'CSTRING\'
|
|||
|
WHEN 11 THEN \'D_FLOAT\'
|
|||
|
WHEN 27 THEN \'DOUBLE\'
|
|||
|
WHEN 10 THEN \'FLOAT\'
|
|||
|
WHEN 16 THEN \'INT64\'
|
|||
|
WHEN 8 THEN \'INTEGER\'
|
|||
|
WHEN 9 THEN \'QUAD\'
|
|||
|
WHEN 7 THEN \'SMALLINT\'
|
|||
|
WHEN 12 THEN \'DATE\'
|
|||
|
WHEN 13 THEN \'TIME\'
|
|||
|
WHEN 35 THEN \'TIMESTAMP\'
|
|||
|
WHEN 37 THEN \'VARCHAR\'
|
|||
|
ELSE \'UNKNOWN\'
|
|||
|
END AS field_type,
|
|||
|
f.RDB$FIELD_SUB_TYPE AS field_subtype,
|
|||
|
coll.RDB$COLLATION_NAME AS field_collation,
|
|||
|
cset.RDB$CHARACTER_SET_NAME AS field_charset
|
|||
|
FROM RDB$RELATION_FIELDS r
|
|||
|
LEFT JOIN RDB$FIELDS f ON r.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME
|
|||
|
LEFT JOIN RDB$COLLATIONS coll ON f.RDB$COLLATION_ID = coll.RDB$COLLATION_ID
|
|||
|
LEFT JOIN RDB$CHARACTER_SETS cset ON f.RDB$CHARACTER_SET_ID = cset.RDB$CHARACTER_SET_ID
|
|||
|
WHERE r.RDB$RELATION_NAME = '.q($Q).'
|
|||
|
ORDER BY r.RDB$FIELD_POSITION';$H=ibase_query($g->_link,$G);while($J=ibase_fetch_assoc($H))$I[trim($J['FIELD_NAME'])]=array("field"=>trim($J["FIELD_NAME"]),"full_type"=>trim($J["FIELD_TYPE"]),"type"=>trim($J["FIELD_SUB_TYPE"]),"default"=>trim($J['FIELD_DEFAULT_VALUE']),"null"=>(trim($J["FIELD_NOT_NULL_CONSTRAINT"])=="YES"),"auto_increment"=>'0',"collation"=>trim($J["FIELD_COLLATION"]),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),"comment"=>trim($J["FIELD_DESCRIPTION"]),);return$I;}function
|
|||
|
indexes($Q,$h=null){$I=array();return$I;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
information_schema($m){return
|
|||
|
false;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
types(){return
|
|||
|
array();}function
|
|||
|
schemas(){return
|
|||
|
array();}function
|
|||
|
get_schema(){return"";}function
|
|||
|
set_schema($Rg){return
|
|||
|
true;}function
|
|||
|
support($Oc){return
|
|||
|
preg_match("~^(columns|sql|status|table)$~",$Oc);}$x="firebird";$mf=array("=");$jd=array();$od=array();$mc=array();}$ec["simpledb"]="SimpleDB";if(isset($_GET["simpledb"])){$Xf=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($k){return($k=="domain");}function
|
|||
|
query($G,$ri=false){$Ef=array('SelectExpression'=>$G,'ConsistentRead'=>'true');if($this->next)$Ef['NextToken']=$this->next;$H=sdb_request_all('Select','Item',$Ef,$this->timeout);if($H===false)return$H;if(preg_match('~^\s*SELECT\s+COUNT\(~i',$G)){$_h=0;foreach($H
|
|||
|
as$Wd)$_h+=$Wd->Attribute->Value;$H=array((object)array('Attribute'=>array((object)array('Name'=>'Count','Value'=>$_h,))));}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}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
|
|||
|
__construct($H){foreach($H
|
|||
|
as$Wd){$J=array();if($Wd->Name!='')$J['itemName()']=(string)$Wd->Name;foreach($Wd->Attribute
|
|||
|
as$Ja){$C=$this->_processValue($Ja->Name);$Y=$this->_processValue($Ja->Value);if(isset($J[$C])){$J[$C]=(array)$J[$C];$J[$C][]=$Y;}else$J[$C]=$Y;}$this->_rows[]=$J;foreach($J
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
_processValue($pc){return(is_object($pc)&&$pc['encoding']=='base64'?base64_decode($pc):(string)$pc);}function
|
|||
|
fetch_assoc(){$J=current($this->_rows);if(!$J)return$J;$I=array();foreach($this->_rows[0]as$y=>$X)$I[$y]=$J[$y];next($this->_rows);return$I;}function
|
|||
|
fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
|
|||
|
array_values($I);}function
|
|||
|
fetch_field(){$ce=array_keys($this->_rows[0]);return(object)array('name'=>$ce[$this->_offset++]);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$ag="itemName()";function
|
|||
|
_chunkRequest($_d,$wa,$Ef,$Ec=array()){global$g;foreach(array_chunk($_d,25)as$ib){$Ff=$Ef;foreach($ib
|
|||
|
as$s=>$t){$Ff["Item.$s.ItemName"]=$t;foreach($Ec
|
|||
|
as$y=>$X)$Ff["Item.$s.$y"]=$X;}if(!sdb_request($wa,$Ff))return
|
|||
|
false;}$g->affected_rows=count($_d);return
|
|||
|
true;}function
|
|||
|
_extractIds($Q,$ng,$z){$I=array();if(preg_match_all("~itemName\(\) = (('[^']*+')+)~",$ng,$xe))$I=array_map('idf_unescape',$xe[1]);else{foreach(sdb_request_all('Select','Item',array('SelectExpression'=>'SELECT itemName() FROM '.table($Q).$ng.($z?" LIMIT 1":"")))as$Wd)$I[]=$Wd->Name;}return$I;}function
|
|||
|
select($Q,$L,$Z,$md,$rf=array(),$z=1,$E=0,$cg=false){global$g;$g->next=$_GET["next"];$I=parent::select($Q,$L,$Z,$md,$rf,$z,$E,$cg);$g->next=0;return$I;}function
|
|||
|
delete($Q,$ng,$z=0){return$this->_chunkRequest($this->_extractIds($Q,$ng,$z),'BatchDeleteAttributes',array('DomainName'=>$Q));}function
|
|||
|
update($Q,$N,$ng,$z=0,$Zg="\n"){$Tb=array();$Nd=array();$s=0;$_d=$this->_extractIds($Q,$ng,$z);$t=idf_unescape($N["`itemName()`"]);unset($N["`itemName()`"]);foreach($N
|
|||
|
as$y=>$X){$y=idf_unescape($y);if($X=="NULL"||($t!=""&&array($t)!=$_d))$Tb["Attribute.".count($Tb).".Name"]=$y;if($X!="NULL"){foreach((array)$X
|
|||
|
as$Yd=>$W){$Nd["Attribute.$s.Name"]=$y;$Nd["Attribute.$s.Value"]=(is_array($X)?$W:idf_unescape($W));if(!$Yd)$Nd["Attribute.$s.Replace"]="true";$s++;}}}$Ef=array('DomainName'=>$Q);return(!$Nd||$this->_chunkRequest(($t!=""?array($t):$_d),'BatchPutAttributes',$Ef,$Nd))&&(!$Tb||$this->_chunkRequest($_d,'BatchDeleteAttributes',$Ef,$Tb));}function
|
|||
|
insert($Q,$N){$Ef=array("DomainName"=>$Q);$s=0;foreach($N
|
|||
|
as$C=>$Y){if($Y!="NULL"){$C=idf_unescape($C);if($C=="itemName()")$Ef["ItemName"]=idf_unescape($Y);else{foreach((array)$Y
|
|||
|
as$X){$Ef["Attribute.$s.Name"]=$C;$Ef["Attribute.$s.Value"]=(is_array($Y)?$X:idf_unescape($Y));$s++;}}}}return
|
|||
|
sdb_request('PutAttributes',$Ef);}function
|
|||
|
insertUpdate($Q,$K,$ag){foreach($K
|
|||
|
as$N){if(!$this->update($Q,$N,"WHERE `itemName()` = ".q($N["`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($Oc){return
|
|||
|
preg_match('~sql~',$Oc);}function
|
|||
|
logged_user(){global$b;$j=$b->credentials();return$j[1];}function
|
|||
|
get_databases(){return
|
|||
|
array("domain");}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($m,$qb){}function
|
|||
|
tables_list(){global$g;$I=array();foreach(sdb_request_all('ListDomains','DomainName')as$Q)$I[(string)$Q]='table';if($g->error&&defined("PAGE_HEADER"))echo"<p class='error'>".error()."\n";return$I;}function
|
|||
|
table_status($C="",$Nc=false){$I=array();foreach(($C!=""?array($C=>true):tables_list())as$Q=>$T){$J=array("Name"=>$Q,"Auto_increment"=>"");if(!$Nc){$Je=sdb_request('DomainMetadata',array('DomainName'=>$Q));if($Je){foreach(array("Rows"=>"ItemCount","Data_length"=>"ItemNamesSizeBytes","Index_length"=>"AttributeValuesSizeBytes","Data_free"=>"AttributeNamesSizeBytes",)as$y=>$X)$J[$y]=(string)$Je->$X;}}if($C!="")return$J;$I[$Q]=$J;}return$I;}function
|
|||
|
explain($g,$G){}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
indexes($Q,$h=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("itemName()")),);}function
|
|||
|
fields($Q){return
|
|||
|
fields_from_edit();}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
idf_escape($u){return"`".str_replace("`","``",$u)."`";}function
|
|||
|
limit($G,$Z,$z,$D=0,$Zg=" "){return" $G$Z".($z!==null?$Zg."LIMIT $z":"");}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
fk_support($R){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$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($l){foreach($l
|
|||
|
as$m)return
|
|||
|
array($m=>count(tables_list()));}function
|
|||
|
found_rows($R,$Z){return($Z?null:$R["Rows"]);}function
|
|||
|
last_id(){}function
|
|||
|
hmac($Ca,$Lb,$y,$rg=false){$Va=64;if(strlen($y)>$Va)$y=pack("H*",$Ca($y));$y=str_pad($y,$Va,"\0");$Zd=$y^str_repeat("\x36",$Va);$ae=$y^str_repeat("\x5C",$Va);$I=$Ca($ae.pack("H*",$Ca($Zd.$Lb)));if($rg)$I=pack("H*",$I);return$I;}function
|
|||
|
sdb_request($wa,$Ef=array()){global$b,$g;list($xd,$Ef['AWSAccessKeyId'],$Ug)=$b->credentials();$Ef['Action']=$wa;$Ef['Timestamp']=gmdate('Y-m-d\TH:i:s+00:00');$Ef['Version']='2009-04-15';$Ef['SignatureVersion']=2;$Ef['SignatureMethod']='HmacSHA1';ksort($Ef);$G='';foreach($Ef
|
|||
|
as$y=>$X)$G.='&'.rawurlencode($y).'='.rawurlencode($X);$G=str_replace('%7E','~',substr($G,1));$G.="&Signature=".urlencode(base64_encode(hmac('sha1',"POST\n".preg_replace('~^https?://~','',$xd)."\n/\n$G",$Ug,true)));@ini_set('track_errors',1);$Sc=@file_get_contents((preg_match('~^https?://~',$xd)?$xd:"http://$xd"),false,stream_context_create(array('http'=>array('method'=>'POST','content'=>$G,'ignore_errors'=>1,))));if(!$Sc){$g->error=$php_errormsg;return
|
|||
|
false;}libxml_use_internal_errors(true);$Yi=simplexml_load_string($Sc);if(!$Yi){$n=libxml_get_last_error();$g->error=$n->message;return
|
|||
|
false;}if($Yi->Errors){$n=$Yi->Errors->Error;$g->error="$n->Message ($n->Code)";return
|
|||
|
false;}$g->error='';$Kh=$wa."Result";return($Yi->$Kh?$Yi->$Kh:true);}function
|
|||
|
sdb_request_all($wa,$Kh,$Ef=array(),$Th=0){$I=array();$sh=($Th?microtime(true):0);$z=(preg_match('~LIMIT\s+(\d+)\s*$~i',$Ef['SelectExpression'],$B)?$B[1]:0);do{$Yi=sdb_request($wa,$Ef);if(!$Yi)break;foreach($Yi->$Kh
|
|||
|
as$pc)$I[]=$pc;if($z&&count($I)>=$z){$_GET["next"]=$Yi->NextToken;break;}if($Th&µtime(true)-$sh>$Th)return
|
|||
|
false;$Ef['NextToken']=$Yi->NextToken;if($z)$Ef['SelectExpression']=preg_replace('~\d+\s*$~',$z-count($I),$Ef['SelectExpression']);}while($Yi->NextToken);return$I;}$x="simpledb";$mf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","IN","IS NULL","NOT LIKE","IS NOT NULL");$jd=array();$od=array("count");$mc=array(array("json"));}$ec["mongo"]="MongoDB (beta)";if(isset($_GET["mongo"])){$Xf=array("mongo","mongodb");define("DRIVER","mongo");if(class_exists('MongoDB')){class
|
|||
|
Min_DB{var$extension="Mongo",$error,$last_id,$_link,$_db;function
|
|||
|
connect($M,$V,$F){global$b;$m=$b->database();$pf=array();if($V!=""){$pf["username"]=$V;$pf["password"]=$F;}if($m!="")$pf["db"]=$m;try{$this->_link=@new
|
|||
|
MongoClient("mongodb://$M",$pf);return
|
|||
|
true;}catch(Exception$Ac){$this->error=$Ac->getMessage();return
|
|||
|
false;}}function
|
|||
|
query($G){return
|
|||
|
false;}function
|
|||
|
select_db($k){try{$this->_db=$this->_link->selectDB($k);return
|
|||
|
true;}catch(Exception$Ac){$this->error=$Ac->getMessage();return
|
|||
|
false;}}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
|
|||
|
__construct($H){foreach($H
|
|||
|
as$Wd){$J=array();foreach($Wd
|
|||
|
as$y=>$X){if(is_a($X,'MongoBinData'))$this->_charset[$y]=63;$J[$y]=(is_a($X,'MongoId')?'ObjectId("'.strval($X).'")':(is_a($X,'MongoDate')?gmdate("Y-m-d H:i:s",$X->sec)." GMT":(is_a($X,'MongoBinData')?$X->bin:(is_a($X,'MongoRegex')?strval($X):(is_object($X)?get_class($X):$X)))));}$this->_rows[]=$J;foreach($J
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=count($this->_rows);}function
|
|||
|
fetch_assoc(){$J=current($this->_rows);if(!$J)return$J;$I=array();foreach($this->_rows[0]as$y=>$X)$I[$y]=$J[$y];next($this->_rows);return$I;}function
|
|||
|
fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
|
|||
|
array_values($I);}function
|
|||
|
fetch_field(){$ce=array_keys($this->_rows[0]);$C=$ce[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$ag="_id";function
|
|||
|
select($Q,$L,$Z,$md,$rf=array(),$z=1,$E=0,$cg=false){$L=($L==array("*")?array():array_fill_keys($L,true));$kh=array();foreach($rf
|
|||
|
as$X){$X=preg_replace('~ DESC$~','',$X,1,$Eb);$kh[$X]=($Eb?-1:1);}return
|
|||
|
new
|
|||
|
Min_Result($this->_conn->_db->selectCollection($Q)->find(array(),$L)->sort($kh)->limit($z!=""?+$z:0)->skip($E*$z));}function
|
|||
|
insert($Q,$N){try{$I=$this->_conn->_db->selectCollection($Q)->insert($N);$this->_conn->errno=$I['code'];$this->_conn->error=$I['err'];$this->_conn->last_id=$N['_id'];return!$I['err'];}catch(Exception$Ac){$this->_conn->error=$Ac->getMessage();return
|
|||
|
false;}}}function
|
|||
|
get_databases($Zc){global$g;$I=array();$Qb=$g->_link->listDBs();foreach($Qb['databases']as$m)$I[]=$m['name'];return$I;}function
|
|||
|
count_tables($l){global$g;$I=array();foreach($l
|
|||
|
as$m)$I[$m]=count($g->_link->selectDB($m)->getCollectionNames(true));return$I;}function
|
|||
|
tables_list(){global$g;return
|
|||
|
array_fill_keys($g->_db->getCollectionNames(true),'table');}function
|
|||
|
drop_databases($l){global$g;foreach($l
|
|||
|
as$m){$Dg=$g->_link->selectDB($m)->drop();if(!$Dg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
indexes($Q,$h=null){global$g;$I=array();foreach($g->_db->selectCollection($Q)->getIndexInfo()as$v){$Wb=array();foreach($v["key"]as$d=>$T)$Wb[]=($T==-1?'1':null);$I[$v["name"]]=array("type"=>($v["name"]=="_id_"?"PRIMARY":($v["unique"]?"UNIQUE":"INDEX")),"columns"=>array_keys($v["key"]),"lengths"=>array(),"descs"=>$Wb,);}return$I;}function
|
|||
|
fields($Q){return
|
|||
|
fields_from_edit();}function
|
|||
|
found_rows($R,$Z){global$g;return$g->_db->selectCollection($_GET["select"])->count($Z);}$mf=array("=");}elseif(class_exists('MongoDB\Driver\Manager')){class
|
|||
|
Min_DB{var$extension="MongoDB",$error,$last_id;var$_link;var$_db,$_db_name;function
|
|||
|
connect($M,$V,$F){global$b;$m=$b->database();$pf=array();if($V!=""){$pf["username"]=$V;$pf["password"]=$F;}if($m!="")$pf["db"]=$m;try{$kb='MongoDB\Driver\Manager';$this->_link=new$kb("mongodb://$M",$pf);return
|
|||
|
true;}catch(Exception$Ac){$this->error=$Ac->getMessage();return
|
|||
|
false;}}function
|
|||
|
query($G){return
|
|||
|
false;}function
|
|||
|
select_db($k){try{$this->_db_name=$k;return
|
|||
|
true;}catch(Exception$Ac){$this->error=$Ac->getMessage();return
|
|||
|
false;}}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows=array(),$_offset=0,$_charset=array();function
|
|||
|
__construct($H){foreach($H
|
|||
|
as$Wd){$J=array();foreach($Wd
|
|||
|
as$y=>$X){if(is_a($X,'MongoDB\BSON\Binary'))$this->_charset[$y]=63;$J[$y]=(is_a($X,'MongoDB\BSON\ObjectID')?'MongoDB\BSON\ObjectID("'.strval($X).'")':(is_a($X,'MongoDB\BSON\UTCDatetime')?$X->toDateTime()->format('Y-m-d H:i:s'):(is_a($X,'MongoDB\BSON\Binary')?$X->bin:(is_a($X,'MongoDB\BSON\Regex')?strval($X):(is_object($X)?json_encode($X,256):$X)))));}$this->_rows[]=$J;foreach($J
|
|||
|
as$y=>$X){if(!isset($this->_rows[0][$y]))$this->_rows[0][$y]=null;}}$this->num_rows=$H->count;}function
|
|||
|
fetch_assoc(){$J=current($this->_rows);if(!$J)return$J;$I=array();foreach($this->_rows[0]as$y=>$X)$I[$y]=$J[$y];next($this->_rows);return$I;}function
|
|||
|
fetch_row(){$I=$this->fetch_assoc();if(!$I)return$I;return
|
|||
|
array_values($I);}function
|
|||
|
fetch_field(){$ce=array_keys($this->_rows[0]);$C=$ce[$this->_offset++];return(object)array('name'=>$C,'charsetnr'=>$this->_charset[$C],);}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{public$ag="_id";function
|
|||
|
select($Q,$L,$Z,$md,$rf=array(),$z=1,$E=0,$cg=false){global$g;$L=($L==array("*")?array():array_fill_keys($L,1));if(count($L)&&!isset($L['_id']))$L['_id']=0;$Z=where_to_query($Z);$kh=array();foreach($rf
|
|||
|
as$X){$X=preg_replace('~ DESC$~','',$X,1,$Eb);$kh[$X]=($Eb?-1:1);}if(isset($_GET['limit'])&&is_numeric($_GET['limit'])&&$_GET['limit']>0)$z=$_GET['limit'];$z=min(200,max(1,(int)$z));$ih=$E*$z;$kb='MongoDB\Driver\Query';$G=new$kb($Z,array('projection'=>$L,'limit'=>$z,'skip'=>$ih,'sort'=>$kh));$Gg=$g->_link->executeQuery("$g->_db_name.$Q",$G);return
|
|||
|
new
|
|||
|
Min_Result($Gg);}function
|
|||
|
update($Q,$N,$ng,$z=0,$Zg="\n"){global$g;$m=$g->_db_name;$Z=sql_query_where_parser($ng);$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());if(isset($N['_id']))unset($N['_id']);$Ag=array();foreach($N
|
|||
|
as$y=>$Y){if($Y=='NULL'){$Ag[$y]=1;unset($N[$y]);}}$yi=array('$set'=>$N);if(count($Ag))$yi['$unset']=$Ag;$Za->update($Z,$yi,array('upsert'=>false));$Gg=$g->_link->executeBulkWrite("$m.$Q",$Za);$g->affected_rows=$Gg->getModifiedCount();return
|
|||
|
true;}function
|
|||
|
delete($Q,$ng,$z=0){global$g;$m=$g->_db_name;$Z=sql_query_where_parser($ng);$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());$Za->delete($Z,array('limit'=>$z));$Gg=$g->_link->executeBulkWrite("$m.$Q",$Za);$g->affected_rows=$Gg->getDeletedCount();return
|
|||
|
true;}function
|
|||
|
insert($Q,$N){global$g;$m=$g->_db_name;$kb='MongoDB\Driver\BulkWrite';$Za=new$kb(array());if(isset($N['_id'])&&empty($N['_id']))unset($N['_id']);$Za->insert($N);$Gg=$g->_link->executeBulkWrite("$m.$Q",$Za);$g->affected_rows=$Gg->getInsertedCount();return
|
|||
|
true;}}function
|
|||
|
get_databases($Zc){global$g;$I=array();$kb='MongoDB\Driver\Command';$tb=new$kb(array('listDatabases'=>1));$Gg=$g->_link->executeCommand('admin',$tb);foreach($Gg
|
|||
|
as$Qb){foreach($Qb->databases
|
|||
|
as$m)$I[]=$m->name;}return$I;}function
|
|||
|
count_tables($l){$I=array();return$I;}function
|
|||
|
tables_list(){global$g;$kb='MongoDB\Driver\Command';$tb=new$kb(array('listCollections'=>1));$Gg=$g->_link->executeCommand($g->_db_name,$tb);$rb=array();foreach($Gg
|
|||
|
as$H)$rb[$H->name]='table';return$rb;}function
|
|||
|
drop_databases($l){return
|
|||
|
false;}function
|
|||
|
indexes($Q,$h=null){global$g;$I=array();$kb='MongoDB\Driver\Command';$tb=new$kb(array('listIndexes'=>$Q));$Gg=$g->_link->executeCommand($g->_db_name,$tb);foreach($Gg
|
|||
|
as$v){$Wb=array();$e=array();foreach(get_object_vars($v->key)as$d=>$T){$Wb[]=($T==-1?'1':null);$e[]=$d;}$I[$v->name]=array("type"=>($v->name=="_id_"?"PRIMARY":(isset($v->unique)?"UNIQUE":"INDEX")),"columns"=>$e,"lengths"=>array(),"descs"=>$Wb,);}return$I;}function
|
|||
|
fields($Q){$p=fields_from_edit();if(!count($p)){global$dc;$H=$dc->select($Q,array("*"),null,null,array(),10);while($J=$H->fetch_assoc()){foreach($J
|
|||
|
as$y=>$X){$J[$y]=null;$p[$y]=array("field"=>$y,"type"=>"string","null"=>($y!=$dc->primary),"auto_increment"=>($y==$dc->primary),"privileges"=>array("insert"=>1,"select"=>1,"update"=>1,),);}}}return$p;}function
|
|||
|
found_rows($R,$Z){global$g;$Z=where_to_query($Z);$kb='MongoDB\Driver\Command';$tb=new$kb(array('count'=>$R['Name'],'query'=>$Z));$Gg=$g->_link->executeCommand($g->_db_name,$tb);$bi=$Gg->toArray();return$bi[0]->n;}function
|
|||
|
sql_query_where_parser($ng){$ng=trim(preg_replace('/WHERE[\s]?[(]?\(?/','',$ng));$ng=preg_replace('/\)\)\)$/',')',$ng);$Vi=explode(' AND ',$ng);$Wi=explode(') OR (',$ng);$Z=array();foreach($Vi
|
|||
|
as$Ti)$Z[]=trim($Ti);if(count($Wi)==1)$Wi=array();elseif(count($Wi)>1)$Z=array();return
|
|||
|
where_to_query($Z,$Wi);}function
|
|||
|
where_to_query($Ri=array(),$Si=array()){global$mf;$Lb=array();foreach(array('and'=>$Ri,'or'=>$Si)as$T=>$Z){if(is_array($Z)){foreach($Z
|
|||
|
as$Hc){list($nb,$kf,$X)=explode(" ",$Hc,3);if($nb=="_id"){$X=str_replace('MongoDB\BSON\ObjectID("',"",$X);$X=str_replace('")',"",$X);$kb='MongoDB\BSON\ObjectID';$X=new$kb($X);}if(!in_array($kf,$mf))continue;if(preg_match('~^\(f\)(.+)~',$kf,$B)){$X=(float)$X;$kf=$B[1];}elseif(preg_match('~^\(date\)(.+)~',$kf,$B)){$Nb=new
|
|||
|
DateTime($X);$kb='MongoDB\BSON\UTCDatetime';$X=new$kb($Nb->getTimestamp()*1000);$kf=$B[1];}switch($kf){case'=':$kf='$eq';break;case'!=':$kf='$ne';break;case'>':$kf='$gt';break;case'<':$kf='$lt';break;case'>=':$kf='$gte';break;case'<=':$kf='$lte';break;case'regex':$kf='$regex';break;default:continue;}if($T=='and')$Lb['$and'][]=array($nb=>array($kf=>$X));elseif($T=='or')$Lb['$or'][]=array($nb=>array($kf=>$X));}}}return$Lb;}$mf=array("=","!=",">","<",">=","<=","regex","(f)=","(f)!=","(f)>","(f)<","(f)>=","(f)<=","(date)=","(date)!=","(date)>","(date)<","(date)>=","(date)<=",);}function
|
|||
|
table($u){return$u;}function
|
|||
|
idf_escape($u){return$u;}function
|
|||
|
table_status($C="",$Nc=false){$I=array();foreach(tables_list()as$Q=>$T){$I[$Q]=array("Name"=>$Q);if($C==$Q)return$I[$Q];}return$I;}function
|
|||
|
last_id(){global$g;return$g->last_id;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
logged_user(){global$b;$j=$b->credentials();return$j[1];}function
|
|||
|
connect(){global$b;$g=new
|
|||
|
Min_DB;$j=$b->credentials();if($g->connect($j[0],$j[1],$j[2]))return$g;return$g->error;}function
|
|||
|
alter_indexes($Q,$c){global$g;foreach($c
|
|||
|
as$X){list($T,$C,$N)=$X;if($N=="DROP")$I=$g->_db->command(array("deleteIndexes"=>$Q,"index"=>$C));else{$e=array();foreach($N
|
|||
|
as$d){$d=preg_replace('~ DESC$~','',$d,1,$Eb);$e[$d]=($Eb?-1:1);}$I=$g->_db->selectCollection($Q)->ensureIndex($e,array("unique"=>($T=="UNIQUE"),"name"=>$C,));}if($I['errmsg']){$g->error=$I['errmsg'];return
|
|||
|
false;}}return
|
|||
|
true;}function
|
|||
|
support($Oc){return
|
|||
|
preg_match("~database|indexes~",$Oc);}function
|
|||
|
db_collation($m,$qb){}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
fk_support($R){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$Kf){global$g;if($Q==""){$g->_db->createCollection($C);return
|
|||
|
true;}}function
|
|||
|
drop_tables($S){global$g;foreach($S
|
|||
|
as$Q){$Dg=$g->_db->selectCollection($Q)->drop();if(!$Dg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
truncate_tables($S){global$g;foreach($S
|
|||
|
as$Q){$Dg=$g->_db->selectCollection($Q)->remove();if(!$Dg['ok'])return
|
|||
|
false;}return
|
|||
|
true;}$x="mongo";$jd=array();$od=array();$mc=array(array("json"));}$ec["elastic"]="Elasticsearch (beta)";if(isset($_GET["elastic"])){$Xf=array("json");define("DRIVER","elastic");if(function_exists('json_decode')){class
|
|||
|
Min_DB{var$extension="JSON",$server_info,$errno,$error,$_url;function
|
|||
|
rootQuery($Of,$_b=array(),$Ke='GET'){@ini_set('track_errors',1);$Sc=@file_get_contents("$this->_url/".ltrim($Of,'/'),false,stream_context_create(array('http'=>array('method'=>$Ke,'content'=>$_b===null?$_b:json_encode($_b),'header'=>'Content-Type: application/json','ignore_errors'=>1,))));if(!$Sc){$this->error=$php_errormsg;return$Sc;}if(!preg_match('~^HTTP/[0-9.]+ 2~i',$http_response_header[0])){$this->error=$Sc;return
|
|||
|
false;}$I=json_decode($Sc,true);if($I===null){$this->errno=json_last_error();if(function_exists('json_last_error_msg'))$this->error=json_last_error_msg();else{$zb=get_defined_constants(true);foreach($zb['json']as$C=>$Y){if($Y==$this->errno&&preg_match('~^JSON_ERROR_~',$C)){$this->error=$C;break;}}}}return$I;}function
|
|||
|
query($Of,$_b=array(),$Ke='GET'){return$this->rootQuery(($this->_db!=""?"$this->_db/":"/").ltrim($Of,'/'),$_b,$Ke);}function
|
|||
|
connect($M,$V,$F){preg_match('~^(https?://)?(.*)~',$M,$B);$this->_url=($B[1]?$B[1]:"http://")."$V:$F@$B[2]";$I=$this->query('');if($I)$this->server_info=$I['version']['number'];return(bool)$I;}function
|
|||
|
select_db($k){$this->_db=$k;return
|
|||
|
true;}function
|
|||
|
quote($P){return$P;}}class
|
|||
|
Min_Result{var$num_rows,$_rows;function
|
|||
|
__construct($K){$this->num_rows=count($this->_rows);$this->_rows=$K;reset($this->_rows);}function
|
|||
|
fetch_assoc(){$I=current($this->_rows);next($this->_rows);return$I;}function
|
|||
|
fetch_row(){return
|
|||
|
array_values($this->fetch_assoc());}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
select($Q,$L,$Z,$md,$rf=array(),$z=1,$E=0,$cg=false){global$b;$Lb=array();$G="$Q/_search";if($L!=array("*"))$Lb["fields"]=$L;if($rf){$kh=array();foreach($rf
|
|||
|
as$nb){$nb=preg_replace('~ DESC$~','',$nb,1,$Eb);$kh[]=($Eb?array($nb=>"desc"):$nb);}$Lb["sort"]=$kh;}if($z){$Lb["size"]=+$z;if($E)$Lb["from"]=($E*$z);}foreach($Z
|
|||
|
as$X){list($nb,$kf,$X)=explode(" ",$X,3);if($nb=="_id")$Lb["query"]["ids"]["values"][]=$X;elseif($nb.$X!=""){$Oh=array("term"=>array(($nb!=""?$nb:"_all")=>$X));if($kf=="=")$Lb["query"]["filtered"]["filter"]["and"][]=$Oh;else$Lb["query"]["filtered"]["query"]["bool"]["must"][]=$Oh;}}if($Lb["query"]&&!$Lb["query"]["filtered"]["query"]&&!$Lb["query"]["ids"])$Lb["query"]["filtered"]["query"]=array("match_all"=>array());$sh=microtime(true);$Tg=$this->_conn->query($G,$Lb);if($cg)echo$b->selectQuery("$G: ".print_r($Lb,true),format_time($sh));if(!$Tg)return
|
|||
|
false;$I=array();foreach($Tg['hits']['hits']as$wd){$J=array();if($L==array("*"))$J["_id"]=$wd["_id"];$p=$wd['_source'];if($L!=array("*")){$p=array();foreach($L
|
|||
|
as$y)$p[$y]=$wd['fields'][$y];}foreach($p
|
|||
|
as$y=>$X){if($Lb["fields"])$X=$X[0];$J[$y]=(is_array($X)?json_encode($X):$X);}$I[]=$J;}return
|
|||
|
new
|
|||
|
Min_Result($I);}function
|
|||
|
update($T,$sg,$ng){$Mf=preg_split('~ *= *~',$ng);if(count($Mf)==2){$t=trim($Mf[1]);$G="$T/$t";return$this->_conn->query($G,$sg,'POST');}return
|
|||
|
false;}function
|
|||
|
insert($T,$sg){$t="";$G="$T/$t";$Dg=$this->_conn->query($G,$sg,'POST');$this->_conn->last_id=$Dg['_id'];return$Dg['created'];}function
|
|||
|
delete($T,$ng){$_d=array();if(is_array($_GET["where"])&&$_GET["where"]["_id"])$_d[]=$_GET["where"]["_id"];if(is_array($_POST['check'])){foreach($_POST['check']as$db){$Mf=preg_split('~ *= *~',$db);if(count($Mf)==2)$_d[]=trim($Mf[1]);}}$this->_conn->affected_rows=0;foreach($_d
|
|||
|
as$t){$G="{$T}/{$t}";$Dg=$this->_conn->query($G,'{}','DELETE');if(is_array($Dg)&&$Dg['found']==true)$this->_conn->affected_rows++;}return$this->_conn->affected_rows;}}function
|
|||
|
connect(){global$b;$g=new
|
|||
|
Min_DB;$j=$b->credentials();if($g->connect($j[0],$j[1],$j[2]))return$g;return$g->error;}function
|
|||
|
support($Oc){return
|
|||
|
preg_match("~database|table|columns~",$Oc);}function
|
|||
|
logged_user(){global$b;$j=$b->credentials();return$j[1];}function
|
|||
|
get_databases(){global$g;$I=$g->rootQuery('_aliases');if($I){$I=array_keys($I);sort($I,SORT_STRING);}return$I;}function
|
|||
|
collations(){return
|
|||
|
array();}function
|
|||
|
db_collation($m,$qb){}function
|
|||
|
engines(){return
|
|||
|
array();}function
|
|||
|
count_tables($l){global$g;$I=array();$H=$g->query('_stats');if($H&&$H['indices']){$Gd=$H['indices'];foreach($Gd
|
|||
|
as$Fd=>$th){$Ed=$th['total']['indexing'];$I[$Fd]=$Ed['index_total'];}}return$I;}function
|
|||
|
tables_list(){global$g;$I=$g->query('_mapping');if($I)$I=array_fill_keys(array_keys($I[$g->_db]["mappings"]),'table');return$I;}function
|
|||
|
table_status($C="",$Nc=false){global$g;$Tg=$g->query("_search",array("size"=>0,"aggregations"=>array("count_by_type"=>array("terms"=>array("field"=>"_type")))),"POST");$I=array();if($Tg){$S=$Tg["aggregations"]["count_by_type"]["buckets"];foreach($S
|
|||
|
as$Q){$I[$Q["key"]]=array("Name"=>$Q["key"],"Engine"=>"table","Rows"=>$Q["doc_count"],);if($C!=""&&$C==$Q["key"])return$I[$C];}}return$I;}function
|
|||
|
error(){global$g;return
|
|||
|
h($g->error);}function
|
|||
|
information_schema(){}function
|
|||
|
is_view($R){}function
|
|||
|
indexes($Q,$h=null){return
|
|||
|
array(array("type"=>"PRIMARY","columns"=>array("_id")),);}function
|
|||
|
fields($Q){global$g;$H=$g->query("$Q/_mapping");$I=array();if($H){$ve=$H[$Q]['properties'];if(!$ve)$ve=$H[$g->_db]['mappings'][$Q]['properties'];if($ve){foreach($ve
|
|||
|
as$C=>$o){$I[$C]=array("field"=>$C,"full_type"=>$o["type"],"type"=>$o["type"],"privileges"=>array("insert"=>1,"select"=>1,"update"=>1),);if($o["properties"]){unset($I[$C]["privileges"]["insert"]);unset($I[$C]["privileges"]["update"]);}}}}return$I;}function
|
|||
|
foreign_keys($Q){return
|
|||
|
array();}function
|
|||
|
table($u){return$u;}function
|
|||
|
idf_escape($u){return$u;}function
|
|||
|
convert_field($o){}function
|
|||
|
unconvert_field($o,$I){return$I;}function
|
|||
|
fk_support($R){}function
|
|||
|
found_rows($R,$Z){return
|
|||
|
null;}function
|
|||
|
create_database($m){global$g;return$g->rootQuery(urlencode($m),null,'PUT');}function
|
|||
|
drop_databases($l){global$g;return$g->rootQuery(urlencode(implode(',',$l)),array(),'DELETE');}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$Kf){global$g;$ig=array();foreach($p
|
|||
|
as$Lc){$Qc=trim($Lc[1][0]);$Rc=trim($Lc[1][1]?:"text");$ig[$Qc]=array('type'=>$Rc);}if(!empty($ig))$ig=array('properties'=>$ig);return$g->query("_mapping/{$C}",$ig,'PUT');}function
|
|||
|
drop_tables($S){global$g;$I=true;foreach($S
|
|||
|
as$Q)$I=$I&&$g->query(urlencode($Q),array(),'DELETE');return$I;}function
|
|||
|
last_id(){global$g;return$g->last_id;}$x="elastic";$mf=array("=","query");$jd=array();$od=array();$mc=array(array("json"));$U=array();$wh=array();foreach(array(lang(25)=>array("long"=>3,"integer"=>5,"short"=>8,"byte"=>10,"double"=>20,"float"=>66,"half_float"=>12,"scaled_float"=>21),lang(26)=>array("date"=>10),lang(23)=>array("string"=>65535,"text"=>65535),lang(27)=>array("binary"=>255),)as$y=>$X){$U+=$X;$wh[$y]=array_keys($X);}}$ec=array("server"=>"MySQL")+$ec;if(!defined("DRIVER")){$Xf=array("MySQLi","MySQL","PDO_MySQL");define("DRIVER","server");if(extension_loaded("mysqli")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
MySQLi{var$extension="MySQLi";function
|
|||
|
__construct(){parent::init();}function
|
|||
|
connect($M="",$V="",$F="",$k=null,$Tf=null,$jh=null){mysqli_report(MYSQLI_REPORT_OFF);list($xd,$Tf)=explode(":",$M,2);$I=@$this->real_connect(($M!=""?$xd:ini_get("mysqli.default_host")),($M.$V!=""?$V:ini_get("mysqli.default_user")),($M.$V.$F!=""?$F:ini_get("mysqli.default_pw")),$k,(is_numeric($Tf)?$Tf:ini_get("mysqli.default_port")),(!is_numeric($Tf)?$Tf:$jh));return$I;}function
|
|||
|
set_charset($cb){if(parent::set_charset($cb))return
|
|||
|
true;parent::set_charset('utf8');return$this->query("SET NAMES $cb");}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H)return
|
|||
|
false;$J=$H->fetch_array();return$J[$o];}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($M,$V,$F){$this->_link=@mysql_connect(($M!=""?$M:ini_get("mysql.default_host")),("$M$V"!=""?$V:ini_get("mysql.default_user")),("$M$V$F"!=""?$F:ini_get("mysql.default_password")),true,131072);if($this->_link)$this->server_info=mysql_get_server_info($this->_link);else$this->error=mysql_error();return(bool)$this->_link;}function
|
|||
|
set_charset($cb){if(function_exists('mysql_set_charset')){if(mysql_set_charset($cb,$this->_link))return
|
|||
|
true;mysql_set_charset('utf8',$this->_link);}return$this->query("SET NAMES $cb");}function
|
|||
|
quote($P){return"'".mysql_real_escape_string($P,$this->_link)."'";}function
|
|||
|
select_db($k){return
|
|||
|
mysql_select_db($k,$this->_link);}function
|
|||
|
query($G,$ri=false){$H=@($ri?mysql_unbuffered_query($G,$this->_link):mysql_query($G,$this->_link));$this->error="";if(!$H){$this->errno=mysql_errno($this->_link);$this->error=mysql_error($this->_link);return
|
|||
|
false;}if($H===true){$this->affected_rows=mysql_affected_rows($this->_link);$this->info=mysql_info($this->_link);return
|
|||
|
true;}return
|
|||
|
new
|
|||
|
Min_Result($H);}function
|
|||
|
multi_query($G){return$this->_result=$this->query($G);}function
|
|||
|
store_result(){return$this->_result;}function
|
|||
|
next_result(){return
|
|||
|
false;}function
|
|||
|
result($G,$o=0){$H=$this->query($G);if(!$H||!$H->num_rows)return
|
|||
|
false;return
|
|||
|
mysql_result($H->_result,0,$o);}}class
|
|||
|
Min_Result{var$num_rows,$_result,$_offset=0;function
|
|||
|
__construct($H){$this->_result=$H;$this->num_rows=mysql_num_rows($H);}function
|
|||
|
fetch_assoc(){return
|
|||
|
mysql_fetch_assoc($this->_result);}function
|
|||
|
fetch_row(){return
|
|||
|
mysql_fetch_row($this->_result);}function
|
|||
|
fetch_field(){$I=mysql_fetch_field($this->_result,$this->_offset++);$I->orgtable=$I->table;$I->orgname=$I->name;$I->charsetnr=($I->blob?63:0);return$I;}function
|
|||
|
__destruct(){mysql_free_result($this->_result);}}}elseif(extension_loaded("pdo_mysql")){class
|
|||
|
Min_DB
|
|||
|
extends
|
|||
|
Min_PDO{var$extension="PDO_MySQL";function
|
|||
|
connect($M,$V,$F){$this->dsn("mysql:charset=utf8;host=".str_replace(":",";unix_socket=",preg_replace('~:(\\d)~',';port=\\1',$M)),$V,$F);return
|
|||
|
true;}function
|
|||
|
set_charset($cb){$this->query("SET NAMES $cb");}function
|
|||
|
select_db($k){return$this->query("USE ".idf_escape($k));}function
|
|||
|
query($G,$ri=false){$this->setAttribute(1000,!$ri);return
|
|||
|
parent::query($G,$ri);}}}class
|
|||
|
Min_Driver
|
|||
|
extends
|
|||
|
Min_SQL{function
|
|||
|
insert($Q,$N){return($N?parent::insert($Q,$N):queries("INSERT INTO ".table($Q)." ()\nVALUES ()"));}function
|
|||
|
insertUpdate($Q,$K,$ag){$e=array_keys(reset($K));$Yf="INSERT INTO ".table($Q)." (".implode(", ",$e).") VALUES\n";$Ii=array();foreach($e
|
|||
|
as$y)$Ii[$y]="$y = VALUES($y)";$zh="\nON DUPLICATE KEY UPDATE ".implode(", ",$Ii);$Ii=array();$pe=0;foreach($K
|
|||
|
as$N){$Y="(".implode(", ",$N).")";if($Ii&&(strlen($Yf)+$pe+strlen($Y)+strlen($zh)>1e6)){if(!queries($Yf.implode(",\n",$Ii).$zh))return
|
|||
|
false;$Ii=array();$pe=0;}$Ii[]=$Y;$pe+=strlen($Y)+2;}return
|
|||
|
queries($Yf.implode(",\n",$Ii).$zh);}}function
|
|||
|
idf_escape($u){return"`".str_replace("`","``",$u)."`";}function
|
|||
|
table($u){return
|
|||
|
idf_escape($u);}function
|
|||
|
connect(){global$b,$U,$wh;$g=new
|
|||
|
Min_DB;$j=$b->credentials();if($g->connect($j[0],$j[1],$j[2])){$g->set_charset(charset($g));$g->query("SET sql_quote_show_create = 1, autocommit = 1");if(version_compare($g->server_info,'5.7.8')>=0){$wh[lang(23)][]="json";$U["json"]=4294967295;}return$g;}$I=$g->error;if(function_exists('iconv')&&!is_utf8($I)&&strlen($Pg=iconv("windows-1250","utf-8",$I))>strlen($I))$I=$Pg;return$I;}function
|
|||
|
get_databases($Zc){global$g;$I=get_session("dbs");if($I===null){$G=($g->server_info>=5?"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA":"SHOW DATABASES");$I=($Zc?slow_query($G):get_vals($G));restart_session();set_session("dbs",$I);stop_session();}return$I;}function
|
|||
|
limit($G,$Z,$z,$D=0,$Zg=" "){return" $G$Z".($z!==null?$Zg."LIMIT $z".($D?" OFFSET $D":""):"");}function
|
|||
|
limit1($G,$Z){return
|
|||
|
limit($G,$Z,1);}function
|
|||
|
db_collation($m,$qb){global$g;$I=null;$i=$g->result("SHOW CREATE DATABASE ".idf_escape($m),1);if(preg_match('~ COLLATE ([^ ]+)~',$i,$B))$I=$B[1];elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$i,$B))$I=$qb[$B[1]][-1];return$I;}function
|
|||
|
engines(){$I=array();foreach(get_rows("SHOW ENGINES")as$J){if(preg_match("~YES|DEFAULT~",$J["Support"]))$I[]=$J["Engine"];}return$I;}function
|
|||
|
logged_user(){global$g;return$g->result("SELECT USER()");}function
|
|||
|
tables_list(){global$g;return
|
|||
|
get_key_vals($g->server_info>=5?"SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME":"SHOW TABLES");}function
|
|||
|
count_tables($l){$I=array();foreach($l
|
|||
|
as$m)$I[$m]=count(get_vals("SHOW TABLES IN ".idf_escape($m)));return$I;}function
|
|||
|
table_status($C="",$Nc=false){global$g;$I=array();foreach(get_rows($Nc&&$g->server_info>=5?"SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ".($C!=""?"AND TABLE_NAME = ".q($C):"ORDER BY Name"):"SHOW TABLE STATUS".($C!=""?" LIKE ".q(addcslashes($C,"%_\\")):""))as$J){if($J["Engine"]=="InnoDB")$J["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$J["Comment"]);if(!isset($J["Engine"]))$J["Comment"]="";if($C!="")return$J;$I[$J["Name"]]=$J;}return$I;}function
|
|||
|
is_view($R){return$R["Engine"]===null;}function
|
|||
|
fk_support($R){global$g;return
|
|||
|
preg_match('~InnoDB|IBMDB2I~i',$R["Engine"])||(preg_match('~NDB~i',$R["Engine"])&&version_compare($g->server_info,'5.6')>=0);}function
|
|||
|
fields($Q){$I=array();foreach(get_rows("SHOW FULL COLUMNS FROM ".table($Q))as$J){preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~',$J["Type"],$B);$I[$J["Field"]]=array("field"=>$J["Field"],"full_type"=>$J["Type"],"type"=>$B[1],"length"=>$B[2],"unsigned"=>ltrim($B[3].$B[4]),"default"=>($J["Default"]!=""||preg_match("~char|set~",$B[1])?$J["Default"]:null),"null"=>($J["Null"]=="YES"),"auto_increment"=>($J["Extra"]=="auto_increment"),"on_update"=>(preg_match('~^on update (.+)~i',$J["Extra"],$B)?$B[1]:""),"collation"=>$J["Collation"],"privileges"=>array_flip(preg_split('~, *~',$J["Privileges"])),"comment"=>$J["Comment"],"primary"=>($J["Key"]=="PRI"),);}return$I;}function
|
|||
|
indexes($Q,$h=null){$I=array();foreach(get_rows("SHOW INDEX FROM ".table($Q),$h)as$J){$C=$J["Key_name"];$I[$C]["type"]=($C=="PRIMARY"?"PRIMARY":($J["Index_type"]=="FULLTEXT"?"FULLTEXT":($J["Non_unique"]?($J["Index_type"]=="SPATIAL"?"SPATIAL":"INDEX"):"UNIQUE")));$I[$C]["columns"][]=$J["Column_name"];$I[$C]["lengths"][]=($J["Index_type"]=="SPATIAL"?null:$J["Sub_part"]);$I[$C]["descs"][]=null;}return$I;}function
|
|||
|
foreign_keys($Q){global$g,$hf;static$Qf='`(?:[^`]|``)+`';$I=array();$Fb=$g->result("SHOW CREATE TABLE ".table($Q),1);if($Fb){preg_match_all("~CONSTRAINT ($Qf) FOREIGN KEY ?\\(((?:$Qf,? ?)+)\\) REFERENCES ($Qf)(?:\\.($Qf))? \\(((?:$Qf,? ?)+)\\)(?: ON DELETE ($hf))?(?: ON UPDATE ($hf))?~",$Fb,$xe,PREG_SET_ORDER);foreach($xe
|
|||
|
as$B){preg_match_all("~$Qf~",$B[2],$lh);preg_match_all("~$Qf~",$B[5],$Lh);$I[idf_unescape($B[1])]=array("db"=>idf_unescape($B[4]!=""?$B[3]:$B[4]),"table"=>idf_unescape($B[4]!=""?$B[4]:$B[3]),"source"=>array_map('idf_unescape',$lh[0]),"target"=>array_map('idf_unescape',$Lh[0]),"on_delete"=>($B[6]?$B[6]:"RESTRICT"),"on_update"=>($B[7]?$B[7]:"RESTRICT"),);}}return$I;}function
|
|||
|
view($C){global$g;return
|
|||
|
array("select"=>preg_replace('~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU','',$g->result("SHOW CREATE VIEW ".table($C),1)));}function
|
|||
|
collations(){$I=array();foreach(get_rows("SHOW COLLATION")as$J){if($J["Default"])$I[$J["Charset"]][-1]=$J["Collation"];else$I[$J["Charset"]][]=$J["Collation"];}ksort($I);foreach($I
|
|||
|
as$y=>$X)asort($I[$y]);return$I;}function
|
|||
|
information_schema($m){global$g;return($g->server_info>=5&&$m=="information_schema")||($g->server_info>=5.5&&$m=="performance_schema");}function
|
|||
|
error(){global$g;return
|
|||
|
h(preg_replace('~^You have an error.*syntax to use~U',"Syntax error",$g->error));}function
|
|||
|
create_database($m,$pb){return
|
|||
|
queries("CREATE DATABASE ".idf_escape($m).($pb?" COLLATE ".q($pb):""));}function
|
|||
|
drop_databases($l){$I=apply_queries("DROP DATABASE",$l,'idf_escape');restart_session();set_session("dbs",null);return$I;}function
|
|||
|
rename_database($C,$pb){$I=false;if(create_database($C,$pb)){$Bg=array();foreach(tables_list()as$Q=>$T)$Bg[]=table($Q)." TO ".idf_escape($C).".".table($Q);$I=(!$Bg||queries("RENAME TABLE ".implode(", ",$Bg)));if($I)queries("DROP DATABASE ".idf_escape(DB));restart_session();set_session("dbs",null);}return$I;}function
|
|||
|
auto_increment(){$Na=" PRIMARY KEY";if($_GET["create"]!=""&&$_POST["auto_increment_col"]){foreach(indexes($_GET["create"])as$v){if(in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"],$v["columns"],true)){$Na="";break;}if($v["type"]=="PRIMARY")$Na=" UNIQUE";}}return" AUTO_INCREMENT$Na";}function
|
|||
|
alter_table($Q,$C,$p,$ad,$vb,$uc,$pb,$Ma,$Kf){$c=array();foreach($p
|
|||
|
as$o)$c[]=($o[1]?($Q!=""?($o[0]!=""?"CHANGE ".idf_escape($o[0]):"ADD"):" ")." ".implode($o[1]).($Q!=""?$o[2]:""):"DROP ".idf_escape($o[0]));$c=array_merge($c,$ad);$O=($vb!==null?" COMMENT=".q($vb):"").($uc?" ENGINE=".q($uc):"").($pb?" COLLATE ".q($pb):"").($Ma!=""?" AUTO_INCREMENT=$Ma":"");if($Q=="")return
|
|||
|
queries("CREATE TABLE ".table($C)." (\n".implode(",\n",$c)."\n)$O$Kf");if($Q!=$C)$c[]="RENAME TO ".table($C);if($O)$c[]=ltrim($O);return($c||$Kf?queries("ALTER TABLE ".table($Q)."\n".implode(",\n",$c).$Kf):true);}function
|
|||
|
alter_indexes($Q,$c){foreach($c
|
|||
|
as$y=>$X)$c[$y]=($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($Ni){return
|
|||
|
queries("DROP VIEW ".implode(", ",array_map('table',$Ni)));}function
|
|||
|
drop_tables($S){return
|
|||
|
queries("DROP TABLE ".implode(", ",array_map('table',$S)));}function
|
|||
|
move_tables($S,$Ni,$Lh){$Bg=array();foreach(array_merge($S,$Ni)as$Q)$Bg[]=table($Q)." TO ".idf_escape($Lh).".".table($Q);return
|
|||
|
queries("RENAME TABLE ".implode(", ",$Bg));}function
|
|||
|
copy_tables($S,$Ni,$Lh){queries("SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'");foreach($S
|
|||
|
as$Q){$C=($Lh==DB?table("copy_$Q"):idf_escape($Lh).".".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($Ni
|
|||
|
as$Q){$C=($Lh==DB?table("copy_$Q"):idf_escape($Lh).".".table($Q));$Mi=view($Q);if(!queries("DROP VIEW IF EXISTS $C")||!queries("CREATE VIEW $C AS $Mi[select]"))return
|
|||
|
false;}return
|
|||
|
true;}function
|
|||
|
trigger($C){if($C=="")return
|
|||
|
array();$K=get_rows("SHOW TRIGGERS WHERE `Trigger` = ".q($C));return
|
|||
|
reset($K);}function
|
|||
|
triggers($Q){$I=array();foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")))as$J)$I[$J["Trigger"]]=array($J["Timing"],$J["Event"]);return$I;}function
|
|||
|
trigger_options(){return
|
|||
|
array("Timing"=>array("BEFORE","AFTER"),"Event"=>array("INSERT","UPDATE","DELETE"),"Type"=>array("FOR EACH ROW"),);}function
|
|||
|
routine($C,$T){global$g,$wc,$Ld,$U;$Da=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$mh="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$qi="((".implode("|",array_merge(array_keys($U),$Da)).")\\b(?:\\s*\\(((?:[^'\")]|$wc)++)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s,]+)['\"]?)?";$Qf="$mh*(".($T=="FUNCTION"?"":$Ld).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$qi";$i=$g->result("SHOW CREATE $T ".idf_escape($C),2);preg_match("~\\(((?:$Qf\\s*,?)*)\\)\\s*".($T=="FUNCTION"?"RETURNS\\s+$qi\\s+":"")."(.*)~is",$i,$B);$p=array();preg_match_all("~$Qf\\s*,?~is",$B[1],$xe,PREG_SET_ORDER);foreach($xe
|
|||
|
as$Df){$C=str_replace("``","`",$Df[2]).$Df[3];$p[]=array("field"=>$C,"type"=>strtolower($Df[5]),"length"=>preg_replace_callback("~$wc~s",'normalize_enum',$Df[6]),"unsigned"=>strtolower(preg_replace('~\\s+~',' ',trim("$Df[8] $Df[7]"))),"null"=>1,"full_type"=>$Df[4],"inout"=>strtoupper($Df[1]),"collation"=>strtolower($Df[9]),);}if($T!="FUNCTION")return
|
|||
|
array("fields"=>$p,"definition"=>$B[11]);return
|
|||
|
array("fields"=>$p,"returns"=>array("type"=>$B[12],"length"=>$B[13],"unsigned"=>$B[15],"collation"=>$B[16]),"definition"=>$B[17],"language"=>"SQL",);}function
|
|||
|
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$g;return$g->result("SELECT LAST_INSERT_ID()");}function
|
|||
|
explain($g,$G){return$g->query("EXPLAIN ".($g->server_info>=5.1?"PARTITIONS ":"").$G);}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($Rg){return
|
|||
|
true;}function
|
|||
|
create_sql($Q,$Ma,$xh){global$g;$I=$g->result("SHOW CREATE TABLE ".table($Q),1);if(!$Ma)$I=preg_replace('~ AUTO_INCREMENT=\\d+~','',$I);return$I;}function
|
|||
|
truncate_sql($Q){return"TRUNCATE ".table($Q);}function
|
|||
|
use_sql($k){return"USE ".idf_escape($k);}function
|
|||
|
trigger_sql($Q){$I="";foreach(get_rows("SHOW TRIGGERS LIKE ".q(addcslashes($Q,"%_\\")),null,"-- ")as$J)$I.="\nCREATE TRIGGER ".idf_escape($J["Trigger"])." $J[Timing] $J[Event] ON ".table($J["Table"])." FOR EACH ROW\n$J[Statement];;\n";return$I;}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($o){global$g;if(preg_match("~binary~",$o["type"]))return"HEX(".idf_escape($o["field"]).")";if($o["type"]=="bit")return"BIN(".idf_escape($o["field"])." + 0)";if(preg_match("~geometry|point|linestring|polygon~",$o["type"]))return($g->server_info>=8?"ST_":"")."AsWKT(".idf_escape($o["field"]).")";}function
|
|||
|
unconvert_field($o,$I){if(preg_match("~binary~",$o["type"]))$I="UNHEX($I)";if($o["type"]=="bit")$I="CONV($I, 2, 10) + 0";if(preg_match("~geometry|point|linestring|polygon~",$o["type"]))$I="GeomFromText($I)";return$I;}function
|
|||
|
support($Oc){global$g;return!preg_match("~scheme|sequence|type|view_trigger|materializedview".($g->server_info<5.1?"|event|partitioning".($g->server_info<5?"|routine|trigger|view":""):"")."~",$Oc);}function
|
|||
|
kill_process($X){return
|
|||
|
queries("KILL ".number($X));}function
|
|||
|
connection_id(){return"SELECT CONNECTION_ID()";}function
|
|||
|
max_connections(){global$g;return$g->result("SELECT @@max_connections");}$x="sql";$U=array();$wh=array();foreach(array(lang(25)=>array("tinyint"=>3,"smallint"=>5,"mediumint"=>8,"int"=>10,"bigint"=>20,"decimal"=>66,"float"=>12,"double"=>21),lang(26)=>array("date"=>10,"datetime"=>19,"timestamp"=>19,"time"=>10,"year"=>4),lang(23)=>array("char"=>255,"varchar"=>65535,"tinytext"=>255,"text"=>65535,"mediumtext"=>16777215,"longtext"=>4294967295),lang(30)=>array("enum"=>65535,"set"=>64),lang(27)=>array("bit"=>20,"binary"=>255,"varbinary"=>65535,"tinyblob"=>255,"blob"=>65535,"mediumblob"=>16777215,"longblob"=>4294967295),lang(29)=>array("geometry"=>0,"point"=>0,"linestring"=>0,"polygon"=>0,"multipoint"=>0,"multilinestring"=>0,"multipolygon"=>0,"geometrycollection"=>0),)as$y=>$X){$U+=$X;$wh[$y]=array_keys($X);}$xi=array("unsigned","zerofill","unsigned zerofill");$mf=array("=","<",">","<=",">=","!=","LIKE","LIKE %%","REGEXP","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL","SQL");$jd=array("char_length","date","from_unixtime","lower","round","sec_to_time","time_to_sec","upper");$od=array("avg","count","count distinct","group_concat","max","min","sum");$mc=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.5.0";class
|
|||
|
Adminer{var$operators;function
|
|||
|
name(){return"<a href='https://www.adminer.org/'".target_blank()." id='h1'>Adminer</a>";}function
|
|||
|
credentials(){return
|
|||
|
array(SERVER,$_GET["username"],get_password());}function
|
|||
|
permanentLogin($i=false){return
|
|||
|
password_file($i);}function
|
|||
|
bruteForceKey(){return$_SERVER["REMOTE_ADDR"];}function
|
|||
|
database(){return
|
|||
|
DB;}function
|
|||
|
databases($Zc=true){return
|
|||
|
get_databases($Zc);}function
|
|||
|
schemas(){return
|
|||
|
schemas();}function
|
|||
|
queryTimeout(){return
|
|||
|
5;}function
|
|||
|
headers(){}function
|
|||
|
csp(){return
|
|||
|
csp();}function
|
|||
|
head(){return
|
|||
|
true;}function
|
|||
|
css(){$I=array();$Tc="adminer.css";if(file_exists($Tc))$I[]=$Tc;return$I;}function
|
|||
|
loginForm(){global$ec;echo'<table cellspacing="0">
|
|||
|
<tr><th>',lang(31),'<td>',html_select("auth[driver]",$ec,DRIVER)."\n",'<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("focus(qs('#username'));"),"<p><input type='submit' value='".lang(36)."'>\n",checkbox("auth[permanent]",1,$_COOKIE["adminer_permanent"],lang(37))."\n";}function
|
|||
|
login($te,$F){global$x;if($x=="sqlite")return
|
|||
|
lang(38,target_blank(),'<code>login()</code>');return
|
|||
|
true;}function
|
|||
|
tableName($Ch){return
|
|||
|
h($Ch["Name"]);}function
|
|||
|
fieldName($o,$rf=0){return'<span title="'.h($o["full_type"]).'">'.h($o["field"]).'</span>';}function
|
|||
|
selectLinks($Ch,$N=""){echo'<p class="links">';$se=array("select"=>lang(39));if(support("table")||support("indexes"))$se["table"]=lang(40);if(support("table")){if(is_view($Ch))$se["view"]=lang(41);else$se["create"]=lang(42);}if($N!==null)$se["edit"]=lang(43);foreach($se
|
|||
|
as$y=>$X)echo" <a href='".h(ME)."$y=".urlencode($Ch["Name"]).($y=="edit"?$N:"")."'".bold(isset($_GET[$y])).">$X</a>";echo"\n";}function
|
|||
|
foreignKeys($Q){return
|
|||
|
foreign_keys($Q);}function
|
|||
|
backwardKeys($Q,$Bh){return
|
|||
|
array();}function
|
|||
|
backwardKeysPrint($Pa,$J){}function
|
|||
|
selectQuery($G,$Sh){global$x;return"<p><code class='jush-$x'>".h(str_replace("\n"," ",$G))."</code> <span class='time'>($Sh)</span>".(support("sql")?" <a href='".h(ME)."sql=".urlencode($G)."'>".lang(10)."</a>":"")."</p>";}function
|
|||
|
sqlCommandQuery($G){return
|
|||
|
shorten_utf8(trim($G),1000);}function
|
|||
|
rowDescription($Q){return"";}function
|
|||
|
rowDescriptions($K,$bd){return$K;}function
|
|||
|
selectLink($X,$o){}function
|
|||
|
selectVal($X,$_,$o,$zf){$I=($X===null?"<i>NULL</i>":(preg_match("~char|binary|boolean~",$o["type"])&&!preg_match("~var~",$o["type"])?"<code>$X</code>":$X));if(preg_match('~blob|bytea|raw|file~',$o["type"])&&!is_utf8($X))$I="<i>".lang(44,strlen($zf))."</i>";if(preg_match('~json~',$o["type"]))$I="<code class='jush-js'>$I</code>";return($_?"<a href='".h($_)."'".(is_url($_)?" rel='noreferrer'":"").">$I</a>":$I);}function
|
|||
|
editVal($X,$o){return$X;}function
|
|||
|
tableStructurePrint($p){echo"<table cellspacing='0' class='nowrap'>\n","<thead><tr><th>".lang(45)."<td>".lang(46).(support("comment")?"<td>".lang(47):"")."</thead>\n";foreach($p
|
|||
|
as$o){echo"<tr".odd()."><th>".h($o["field"]),"<td><span title='".h($o["collation"])."'>".h($o["full_type"])."</span>",($o["null"]?" <i>NULL</i>":""),($o["auto_increment"]?" <i>".lang(48)."</i>":""),(isset($o["default"])?" <span title='".lang(49)."'>[<b>".h($o["default"])."</b>]</span>":""),(support("comment")?"<td>".nbsp($o["comment"]):""),"\n";}echo"</table>\n";}function
|
|||
|
tableIndexesPrint($w){echo"<table cellspacing='0'>\n";foreach($w
|
|||
|
as$C=>$v){ksort($v["columns"]);$cg=array();foreach($v["columns"]as$y=>$X)$cg[]="<i>".h($X)."</i>".($v["lengths"][$y]?"(".$v["lengths"][$y].")":"").($v["descs"][$y]?" DESC":"");echo"<tr title='".h($C)."'><th>$v[type]<td>".implode(", ",$cg)."\n";}echo"</table>\n";}function
|
|||
|
selectColumnsPrint($L,$e){global$jd,$od;print_fieldset("select",lang(50),$L);$s=0;$L[""]=array();foreach($L
|
|||
|
as$y=>$X){$X=$_GET["columns"][$y];$d=select_input(" name='columns[$s][col]'",$e,$X["col"],($y!==""?"selectFieldChange":"selectAddRow"));echo"<div>".($jd||$od?"<select name='columns[$s][fun]'>".optionlist(array(-1=>"")+array_filter(array(lang(51)=>$jd,lang(52)=>$od)),$X["fun"])."</select>".on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'",1).script("qsl('select').onchange = function () { helpClose();".($y!==""?"":" qsl('select, input', this.parentNode).onchange();")." };","")."($d)":$d)."</div>\n";$s++;}echo"</div></fieldset>\n";}function
|
|||
|
selectSearchPrint($Z,$e,$w){print_fieldset("search",lang(53),$Z);foreach($w
|
|||
|
as$s=>$v){if($v["type"]=="FULLTEXT"){echo"<div>(<i>".implode("</i>, <i>",array_map('h',$v["columns"]))."</i>) AGAINST"," <input type='search' name='fulltext[$s]' value='".h($_GET["fulltext"][$s])."'>",script("qsl('input').oninput = selectFieldChange;",""),checkbox("boolean[$s]",1,isset($_GET["boolean"][$s]),"BOOL"),"</div>\n";}}$_GET["where"]=(array)$_GET["where"];reset($_GET["where"]);$bb="this.parentNode.firstChild.onchange();";for($s=0;$s<=count($_GET["where"]);$s++){list(,$X)=each($_GET["where"]);if(!$X||("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators))){echo"<div>".select_input(" name='where[$s][col]'",$e,$X["col"],($X?"selectFieldChange":"selectAddRow"),"(".lang(54).")"),html_select("where[$s][op]",$this->operators,$X["op"],$bb),"<input type='search' name='where[$s][val]' value='".h($X["val"])."'>",script("mixin(qsl('input'), {oninput: function () { $bb }, onkeydown: selectSearchKeydown, onsearch: selectSearchSearch});",""),"</div>\n";}}echo"</div></fieldset>\n";}function
|
|||
|
selectOrderPrint($rf,$e,$w){print_fieldset("sort",lang(55),$rf);$s=0;foreach((array)$_GET["order"]as$y=>$X){if($X!=""){echo"<div>".select_input(" name='order[$s]'",$e,$X,"selectFieldChange"),checkbox("desc[$s]",1,isset($_GET["desc"][$y]),lang(56))."</div>\n";$s++;}}echo"<div>".select_input(" name='order[$s]'",$e,"","selectAddRow"),checkbox("desc[$s]",1,false,lang(56))."</div>\n","</div></fieldset>\n";}function
|
|||
|
selectLimitPrint($z){echo"<fieldset><legend>".lang(57)."</legend><div>";echo"<input type='number' name='limit' class='size' value='".h($z)."'>",script("qsl('input').oninput = selectFieldChange;",""),"</div></fieldset>\n";}function
|
|||
|
selectLengthPrint($Rh){if($Rh!==null){echo"<fieldset><legend>".lang(58)."</legend><div>","<input type='number' name='text_length' class='size' value='".h($Rh)."'>","</div></fieldset>\n";}}function
|
|||
|
selectActionPrint($w){echo"<fieldset><legend>".lang(59)."</legend><div>","<input type='submit' value='".lang(50)."'>"," <span id='noindex' title='".lang(60)."'></span>","<script".nonce().">\n","var indexColumns = ";$e=array();foreach($w
|
|||
|
as$v){$Kb=reset($v["columns"]);if($v["type"]!="FULLTEXT"&&$Kb)$e[$Kb]=1;}$e[""]=1;foreach($e
|
|||
|
as$y=>$X)json_row($y);echo";\n","selectFieldChange.call(qs('#form')['select']);\n","</script>\n","</div></fieldset>\n";}function
|
|||
|
selectCommandPrint(){return!information_schema(DB);}function
|
|||
|
selectImportPrint(){return!information_schema(DB);}function
|
|||
|
selectEmailPrint($rc,$e){}function
|
|||
|
selectColumnsProcess($e,$w){global$jd,$od;$L=array();$md=array();foreach((array)$_GET["columns"]as$y=>$X){if($X["fun"]=="count"||($X["col"]!=""&&(!$X["fun"]||in_array($X["fun"],$jd)||in_array($X["fun"],$od)))){$L[$y]=apply_sql_function($X["fun"],($X["col"]!=""?idf_escape($X["col"]):"*"));if(!in_array($X["fun"],$od))$md[]=$L[$y];}}return
|
|||
|
array($L,$md);}function
|
|||
|
selectSearchProcess($p,$w){global$g,$x;$I=array();foreach($w
|
|||
|
as$s=>$v){if($v["type"]=="FULLTEXT"&&$_GET["fulltext"][$s]!="")$I[]="MATCH (".implode(", ",array_map('idf_escape',$v["columns"])).") AGAINST (".q($_GET["fulltext"][$s]).(isset($_GET["boolean"][$s])?" IN BOOLEAN MODE":"").")";}foreach((array)$_GET["where"]as$X){if($X["op"]=="")$X["op"]="LIKE %%";if("$X[col]$X[val]"!=""&&in_array($X["op"],$this->operators)){$xb=" $X[op]";if(preg_match('~IN$~',$X["op"])){$Bd=process_length($X["val"]);$xb.=" ".($Bd!=""?$Bd:"(NULL)");}elseif($X["op"]=="SQL")$xb=" $X[val]";elseif($X["op"]=="LIKE %%")$xb=" LIKE ".$this->processInput($p[$X["col"]],"%$X[val]%");elseif($X["op"]=="ILIKE %%")$xb=" ILIKE ".$this->processInput($p[$X["col"]],"%$X[val]%");elseif(!preg_match('~NULL$~',$X["op"]))$xb.=" ".$this->processInput($p[$X["col"]],$X["val"]);if($X["col"]!="")$I[]=idf_escape($X["col"]).$xb;else{$sb=array();foreach($p
|
|||
|
as$C=>$o){$Ud=preg_match('~char|text|enum|set~',$o["type"]);if((is_numeric($X["val"])||!preg_match('~(^|[^o])int|float|double|decimal|bit~',$o["type"]))&&(!preg_match("~[\x80-\xFF]~",$X["val"])||$Ud)){$C=idf_escape($C);$sb[]=($x=="sql"&&$Ud&&!preg_match("~^utf8~",$o["collation"])?"CONVERT($C USING ".charset($g).")":$C);}}$I[]=($sb?"(".implode("$xb OR ",$sb)."$xb)":"0");}}}return$I;}function
|
|||
|
selectOrderProcess($p,$w){$I=array();foreach((array)$_GET["order"]as$y=>$X){if($X!="")$I[]=(preg_match('~^((COUNT\\(DISTINCT |[A-Z0-9_]+\\()(`(?:[^`]|``)+`|"(?:[^"]|"")+")\\)|COUNT\\(\\*\\))$~',$X)?$X:idf_escape($X)).(isset($_GET["desc"][$y])?" DESC":"");}return$I;}function
|
|||
|
selectLimitProcess(){return(isset($_GET["limit"])?$_GET["limit"]:"50");}function
|
|||
|
selectLengthProcess(){return(isset($_GET["text_length"])?$_GET["text_length"]:"100");}function
|
|||
|
selectEmailProcess($Z,$bd){return
|
|||
|
false;}function
|
|||
|
selectQueryBuild($L,$Z,$md,$rf,$z,$E){return"";}function
|
|||
|
messageQuery($G,$Sh){global$x;restart_session();$ud=&get_session("queries");if(!$ud[$_GET["db"]])$ud[$_GET["db"]]=array();$t="sql-".count($ud[$_GET["db"]]);if(strlen($G)>1e6)$G=preg_replace('~[\x80-\xFF]+$~','',substr($G,0,1e6))."\n...";$ud[$_GET["db"]][]=array($G,time(),$Sh);return" <span class='time'>".@date("H:i:s")."</span>"." <a href='#$t' class='toggle'>".lang(61)."</a>"."<div id='$t' class='hidden'><pre><code class='jush-$x'>".shorten_utf8($G,1000).'</code></pre>'.($Sh?" <span class='time'>($Sh)</span>":'').(support("sql")?'<p><a href="'.h(str_replace("db=".urlencode(DB),"db=".urlencode($_GET["db"]),ME).'sql=&history='.(count($ud[$_GET["db"]])-1)).'">'.lang(10).'</a>':'').'</div>';}function
|
|||
|
editFunctions($o){global$mc;$I=($o["null"]?"NULL/":"");foreach($mc
|
|||
|
as$y=>$jd){if(!$y||(!isset($_GET["call"])&&(isset($_GET["select"])||where($_GET)))){foreach($jd
|
|||
|
as$Qf=>$X){if(!$Qf||preg_match("~$Qf~",$o["type"]))$I.="/$X";}if($y&&!preg_match('~set|blob|bytea|raw|file~',$o["type"]))$I.="/SQL";}}if($o["auto_increment"]&&!isset($_GET["select"])&&!where($_GET))$I=lang(48);return
|
|||
|
explode("/",$I);}function
|
|||
|
editInput($Q,$o,$Ka,$Y){if($o["type"]=="enum")return(isset($_GET["select"])?"<label><input type='radio'$Ka value='-1' checked><i>".lang(8)."</i></label> ":"").($o["null"]?"<label><input type='radio'$Ka value=''".($Y!==null||isset($_GET["select"])?"":" checked")."><i>NULL</i></label> ":"").enum_input("radio",$Ka,$o,$Y,0);return"";}function
|
|||
|
editHint($Q,$o,$Y){return"";}function
|
|||
|
processInput($o,$Y,$r=""){if($r=="SQL")return$Y;$C=$o["field"];$I=q($Y);if(preg_match('~^(now|getdate|uuid)$~',$r))$I="$r()";elseif(preg_match('~^current_(date|timestamp)$~',$r))$I=$r;elseif(preg_match('~^([+-]|\\|\\|)$~',$r))$I=idf_escape($C)." $r $I";elseif(preg_match('~^[+-] interval$~',$r))$I=idf_escape($C)." $r ".(preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+\$~i",$Y)?$Y:$I);elseif(preg_match('~^(addtime|subtime|concat)$~',$r))$I="$r(".idf_escape($C).", $I)";elseif(preg_match('~^(md5|sha1|password|encrypt)$~',$r))$I="$r($I)";return
|
|||
|
unconvert_field($o,$I);}function
|
|||
|
dumpOutput(){$I=array('text'=>lang(62),'file'=>lang(63));if(function_exists('gzencode'))$I['gz']='gzip';return$I;}function
|
|||
|
dumpFormat(){return
|
|||
|
array('sql'=>'SQL','csv'=>'CSV,','csv;'=>'CSV;','tsv'=>'TSV');}function
|
|||
|
dumpDatabase($m){}function
|
|||
|
dumpTable($Q,$xh,$Vd=0){if($_POST["format"]!="sql"){echo"\xef\xbb\xbf";if($xh)dump_csv(array_keys(fields($Q)));}else{if($Vd==2){$p=array();foreach(fields($Q)as$C=>$o)$p[]=idf_escape($C)." $o[full_type]";$i="CREATE TABLE ".table($Q)." (".implode(", ",$p).")";}else$i=create_sql($Q,$_POST["auto_increment"],$xh);set_utf8mb4($i);if($xh&&$i){if($xh=="DROP+CREATE"||$Vd==1)echo"DROP ".($Vd==2?"VIEW":"TABLE")." IF EXISTS ".table($Q).";\n";if($Vd==1)$i=remove_definer($i);echo"$i;\n\n";}}}function
|
|||
|
dumpData($Q,$xh,$G){global$g,$x;$ze=($x=="sqlite"?0:1048576);if($xh){if($_POST["format"]=="sql"){if($xh=="TRUNCATE+INSERT")echo
|
|||
|
truncate_sql($Q).";\n";$p=fields($Q);}$H=$g->query($G,1);if($H){$Nd="";$Ya="";$ce=array();$zh="";$Pc=($Q!=''?'fetch_assoc':'fetch_row');while($J=$H->$Pc()){if(!$ce){$Ii=array();foreach($J
|
|||
|
as$X){$o=$H->fetch_field();$ce[]=$o->name;$y=idf_escape($o->name);$Ii[]="$y = VALUES($y)";}$zh=($xh=="INSERT+UPDATE"?"\nON DUPLICATE KEY UPDATE ".implode(", ",$Ii):"").";\n";}if($_POST["format"]!="sql"){if($xh=="table"){dump_csv($ce);$xh="INSERT";}dump_csv($J);}else{if(!$Nd)$Nd="INSERT INTO ".table($Q)." (".implode(", ",array_map('idf_escape',$ce)).") VALUES";foreach($J
|
|||
|
as$y=>$X){$o=$p[$y];$J[$y]=($X!==null?unconvert_field($o,preg_match('~(^|[^o])int|float|double|decimal~',$o["type"])&&$X!=''?$X:q($X)):"NULL");}$Pg=($ze?"\n":" ")."(".implode(",\t",$J).")";if(!$Ya)$Ya=$Nd.$Pg;elseif(strlen($Ya)+4+strlen($Pg)+strlen($zh)<$ze)$Ya.=",$Pg";else{echo$Ya.$zh;$Ya=$Nd.$Pg;}}}if($Ya)echo$Ya.$zh;}elseif($_POST["format"]=="sql")echo"-- ".str_replace("\n"," ",$g->error)."\n";}}function
|
|||
|
dumpFilename($zd){return
|
|||
|
friendly_url($zd!=""?$zd:(SERVER!=""?SERVER:"localhost"));}function
|
|||
|
dumpHeaders($zd,$Ne=false){$Bf=$_POST["output"];$Ic=(preg_match('~sql~',$_POST["format"])?"sql":($Ne?"tar":"csv"));header("Content-Type: ".($Bf=="gz"?"application/x-gzip":($Ic=="tar"?"application/x-tar":($Ic=="sql"||$Bf!="file"?"text/plain":"text/csv")."; charset=utf-8")));if($Bf=="gz")ob_start('ob_gzencode',1e6);return$Ic;}function
|
|||
|
importServerPath(){return"adminer.sql";}function
|
|||
|
homepage(){echo'<p class="links">'.($_GET["ns"]==""&&support("database")?'<a href="'.h(ME).'database=">'.lang(64)."</a>\n":""),(support("scheme")?"<a href='".h(ME)."scheme='>".($_GET["ns"]!=""?lang(65):lang(66))."</a>\n":""),($_GET["ns"]!==""?'<a href="'.h(ME).'schema=">'.lang(67)."</a>\n":""),(support("privileges")?"<a href='".h(ME)."privileges='>".lang(68)."</a>\n":"");return
|
|||
|
true;}function
|
|||
|
navigation($Me){global$ia,$x,$ec,$g;echo'<h1>
|
|||
|
',$this->name(),' <span class="version">',$ia,'</span>
|
|||
|
<a href="https://www.adminer.org/#download"',target_blank(),' id="version">',(version_compare($ia,$_COOKIE["adminer_version"])<0?h($_COOKIE["adminer_version"]):""),'</a>
|
|||
|
</h1>
|
|||
|
';if($Me=="auth"){$Vc=true;foreach((array)$_SESSION["pwds"]as$Ki=>$dh){foreach($dh
|
|||
|
as$M=>$Fi){foreach($Fi
|
|||
|
as$V=>$F){if($F!==null){if($Vc){echo"<p id='logins'>".script("mixin(qs('#logins'), {onmouseover: menuOver, onmouseout: menuOut});");$Vc=false;}$Qb=$_SESSION["db"][$Ki][$M][$V];foreach(($Qb?array_keys($Qb):array(""))as$m)echo"<a href='".h(auth_url($Ki,$M,$V,$m))."'>($ec[$Ki]) ".h($V.($M!=""?"@$M":"").($m!=""?" - $m":""))."</a><br>\n";}}}}}else{if($_GET["ns"]!==""&&!$Me&&DB!=""){$g->select_db(DB);$S=table_status('',true);}echo
|
|||
|
script_src(preg_replace("~\\?.*~","",ME)."?file=jush.js&version=4.5.0");if(support("sql")){echo'<script',nonce(),'>
|
|||
|
';if($S){$se=array();foreach($S
|
|||
|
as$Q=>$T)$se[]=preg_quote($Q,'/');echo"var jushLinks = { $x: [ '".js_escape(ME).(support("table")?"table=":"select=")."\$&', /\\b(".implode("|",$se).")\\b/g ] };\n";foreach(array("bac","bra","sqlite_quo","mssql_bra")as$X)echo"jushLinks.$X = jushLinks.$x;\n";}echo'bodyLoad(\'',(is_object($g)?substr($g->server_info,0,3):""),'\');
|
|||
|
</script>
|
|||
|
';}$this->databasesPrint($Me);if(DB==""||!$Me){echo"<p class='links'>".(support("sql")?"<a href='".h(ME)."sql='".bold(isset($_GET["sql"])&&!isset($_GET["import"])).">".lang(61)."</a>\n<a href='".h(ME)."import='".bold(isset($_GET["import"])).">".lang(69)."</a>\n":"")."";if(support("dump"))echo"<a href='".h(ME)."dump=".urlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"])."' id='dump'".bold(isset($_GET["dump"])).">".lang(70)."</a>\n";}if($_GET["ns"]!==""&&!$Me&&DB!=""){echo'<a href="'.h(ME).'create="'.bold($_GET["create"]==="").">".lang(71)."</a>\n";if(!$S)echo"<p class='message'>".lang(9)."\n";else$this->tablesPrint($S);}}}function
|
|||
|
databasesPrint($Me){global$b,$g;$l=$this->databases();echo'<form action="">
|
|||
|
<p id="dbs">
|
|||
|
';hidden_fields_get();$Ob=script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});","");echo"<span title='".lang(72)."'>DB</span>: ".($l?"<select name='db'>".optionlist(array(""=>"")+$l,DB)."</select>$Ob":'<input name="db" value="'.h(DB).'" autocapitalize="off">'),"<input type='submit' value='".lang(20)."'".($l?" class='hidden'":"").">\n";if($Me!="db"&&DB!=""&&$g->select_db(DB)){if(support("scheme")){echo"<br>".lang(73).": <select name='ns'>".optionlist(array(""=>"")+$b->schemas(),$_GET["ns"])."</select>$Ob";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"<ul id='tables'>".script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");foreach($S
|
|||
|
as$Q=>$O){echo'<li><a href="'.h(ME).'select='.urlencode($Q).'"'.bold($_GET["select"]==$Q||$_GET["edit"]==$Q,"select").">".lang(74)."</a> ";$C=$this->tableName($O);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($O)?"view":"structure"))." title='".lang(40)."'>$C</a>":"<span>$C</span>")."\n";}echo"</ul>\n";}}$b=(function_exists('adminer_object')?adminer_object():new
|
|||
|
Adminer);if($b->operators===null)$b->operators=$mf;function
|
|||
|
page_header($Vh,$n="",$Xa=array(),$Wh=""){global$ca,$ia,$b,$ec,$x;page_headers();if(is_ajax()&&$n){page_messages($n);exit;}$Xh=$Vh.($Wh!=""?": $Wh":"");$Yh=strip_tags($Xh.(SERVER!=""&&SERVER!="localhost"?h(" - ".SERVER):"")." - ".$b->name());echo'<!DOCTYPE html>
|
|||
|
<html lang="',$ca,'" dir="',lang(75),'">
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|||
|
<meta name="robots" content="noindex">
|
|||
|
<title>',$Yh,'</title>
|
|||
|
<link rel="stylesheet" type="text/css" href="',h(preg_replace("~\\?.*~","",ME)."?file=default.css&version=4.5.0"),'">
|
|||
|
',script_src(preg_replace("~\\?.*~","",ME)."?file=functions.js&version=4.5.0");if($b->head()){echo'<link rel="shortcut icon" type="image/x-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.5.0"),'">
|
|||
|
<link rel="apple-touch-icon" href="',h(preg_replace("~\\?.*~","",ME)."?file=favicon.ico&version=4.5.0"),'">
|
|||
|
';foreach($b->css()as$Ib){echo'<link rel="stylesheet" type="text/css" href="',h($Ib),'">
|
|||
|
';}}echo'
|
|||
|
<body class="',lang(75),' nojs">
|
|||
|
';$Tc=get_temp_dir()."/adminer.version";if(!$_COOKIE["adminer_version"]&&function_exists('openssl_verify')&&file_exists($Tc)&&filemtime($Tc)+86400>time()){$Li=unserialize(file_get_contents($Tc));$kg="-----BEGIN PUBLIC KEY-----
|
|||
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwqWOVuF5uw7/+Z70djoK
|
|||
|
RlHIZFZPO0uYRezq90+7Amk+FDNd7KkL5eDve+vHRJBLAszF/7XKXe11xwliIsFs
|
|||
|
DFWQlsABVZB3oisKCBEuI71J4kPH8dKGEWR9jDHFw3cWmoH3PmqImX6FISWbG3B8
|
|||
|
h7FIx3jEaw5ckVPVTeo5JRm/1DZzJxjyDenXvBQ/6o9DgZKeNDgxwKzH+sw9/YCO
|
|||
|
jHnq1cFpOIISzARlrHMa/43YfeNRAm/tsBXjSxembBPo7aQZLAWHmaj5+K19H10B
|
|||
|
nCpz9Y++cipkVEiKRGih4ZEvjoFysEOdRLj6WiD/uUNky4xGeA6LaJqh5XpkFkcQ
|
|||
|
fQIDAQAB
|
|||
|
-----END PUBLIC KEY-----
|
|||
|
";if(openssl_verify($Li["version"],base64_decode($Li["signature"]),$kg)==1)$_COOKIE["adminer_version"]=$Li["version"];}echo'<script',nonce(),'>
|
|||
|
mixin(document.body, {onkeydown: bodyKeydown, onclick: bodyClick',(isset($_COOKIE["adminer_version"])?"":", onload: partial(verifyVersion, '$ia', '".js_escape(ME)."', '".get_token()."')");?>});
|
|||
|
document.body.className = document.body.className.replace(/ nojs/, ' js');
|
|||
|
var offlineMessage = '<?php echo
|
|||
|
js_escape(lang(76)),'\';
|
|||
|
</script>
|
|||
|
|
|||
|
<div id="help" class="jush-',$x,' jsonly hidden"></div>
|
|||
|
',script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"),'
|
|||
|
<div id="content">
|
|||
|
';if($Xa!==null){$_=substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1);echo'<p id="breadcrumb"><a href="'.h($_?$_:".").'">'.$ec[DRIVER].'</a> » ';$_=substr(preg_replace('~\b(db|ns)=[^&]*&~','',ME),0,-1);$M=(SERVER!=""?h(SERVER):lang(32));if($Xa===false)echo"$M\n";else{echo"<a href='".($_?h($_):".")."' accesskey='1' title='Alt+Shift+1'>$M</a> » ";if($_GET["ns"]!=""||(DB!=""&&is_array($Xa)))echo'<a href="'.h($_."&db=".urlencode(DB).(support("scheme")?"&ns=":"")).'">'.h(DB).'</a> » ';if(is_array($Xa)){if($_GET["ns"]!="")echo'<a href="'.h(substr(ME,0,-1)).'">'.h($_GET["ns"]).'</a> » ';foreach($Xa
|
|||
|
as$y=>$X){$Vb=(is_array($X)?$X[1]:h($X));if($Vb!="")echo"<a href='".h(ME."$y=").urlencode(is_array($X)?$X[0]:$X)."'>$Vb</a> » ";}}echo"$Vh\n";}}echo"<h2>$Xh</h2>\n","<div id='ajaxstatus' class='jsonly hidden'></div>\n";restart_session();page_messages($n);$l=&get_session("dbs");if(DB!=""&&$l&&!in_array(DB,$l,true))$l=null;stop_session();define("PAGE_HEADER",1);}function
|
|||
|
page_headers(){global$b;header("Content-Type: text/html; charset=utf-8");header("Cache-Control: no-cache");header("X-Frame-Options: deny");header("X-XSS-Protection: 0");header("X-Content-Type-Options: nosniff");header("Referrer-Policy: origin-when-cross-origin");foreach($b->csp()as$Hb){$td=array();foreach($Hb
|
|||
|
as$y=>$X)$td[]="$y $X";header("Content-Security-Policy: ".implode("; ",$td));}$b->headers();}function
|
|||
|
csp(){return
|
|||
|
array(array("script-src"=>"'self' 'unsafe-inline' 'nonce-".get_nonce()."' 'strict-dynamic'","connect-src"=>"'self'","frame-src"=>"https://www.adminer.org","object-src"=>"'none'","base-uri"=>"'none'","form-action"=>"'self'",),);}function
|
|||
|
get_nonce(){static$We;if(!$We)$We=base64_encode(rand_string());return$We;}function
|
|||
|
page_messages($n){$zi=preg_replace('~^[^?]*~','',$_SERVER["REQUEST_URI"]);$Ie=$_SESSION["messages"][$zi];if($Ie){echo"<div class='message'>".implode("</div>\n<div class='message'>",$Ie)."</div>".script("messagesPrint();");unset($_SESSION["messages"][$zi]);}if($n)echo"<div class='error'>$n</div>\n";}function
|
|||
|
page_footer($Me=""){global$b,$ci;echo'</div>
|
|||
|
|
|||
|
';switch_lang();if($Me!="auth"){echo'<form action="" method="post">
|
|||
|
<p class="logout">
|
|||
|
<input type="submit" name="logout" value="',lang(77),'" id="logout">
|
|||
|
<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</p>
|
|||
|
</form>
|
|||
|
';}echo'<div id="menu">
|
|||
|
';$b->navigation($Me);echo'</div>
|
|||
|
',script("setupSubmitHighlight(document);");}function
|
|||
|
int32($Pe){while($Pe>=2147483648)$Pe-=4294967296;while($Pe<=-2147483649)$Pe+=4294967296;return(int)$Pe;}function
|
|||
|
long2str($W,$Pi){$Pg='';foreach($W
|
|||
|
as$X)$Pg.=pack('V',$X);if($Pi)return
|
|||
|
substr($Pg,0,end($W));return$Pg;}function
|
|||
|
str2long($Pg,$Pi){$W=array_values(unpack('V*',str_pad($Pg,4*ceil(strlen($Pg)/4),"\0")));if($Pi)$W[]=strlen($Pg);return$W;}function
|
|||
|
xxtea_mx($aj,$Zi,$_h,$Yd){return
|
|||
|
int32((($aj>>5&0x7FFFFFF)^$Zi<<2)+(($Zi>>3&0x1FFFFFFF)^$aj<<4))^int32(($_h^$Zi)+($Yd^$aj));}function
|
|||
|
encrypt_string($vh,$y){if($vh=="")return"";$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($vh,true);$Pe=count($W)-1;$aj=$W[$Pe];$Zi=$W[0];$lg=floor(6+52/($Pe+1));$_h=0;while($lg-->0){$_h=int32($_h+0x9E3779B9);$lc=$_h>>2&3;for($Cf=0;$Cf<$Pe;$Cf++){$Zi=$W[$Cf+1];$Oe=xxtea_mx($aj,$Zi,$_h,$y[$Cf&3^$lc]);$aj=int32($W[$Cf]+$Oe);$W[$Cf]=$aj;}$Zi=$W[0];$Oe=xxtea_mx($aj,$Zi,$_h,$y[$Cf&3^$lc]);$aj=int32($W[$Pe]+$Oe);$W[$Pe]=$aj;}return
|
|||
|
long2str($W,false);}function
|
|||
|
decrypt_string($vh,$y){if($vh=="")return"";if(!$y)return
|
|||
|
false;$y=array_values(unpack("V*",pack("H*",md5($y))));$W=str2long($vh,false);$Pe=count($W)-1;$aj=$W[$Pe];$Zi=$W[0];$lg=floor(6+52/($Pe+1));$_h=int32($lg*0x9E3779B9);while($_h){$lc=$_h>>2&3;for($Cf=$Pe;$Cf>0;$Cf--){$aj=$W[$Cf-1];$Oe=xxtea_mx($aj,$Zi,$_h,$y[$Cf&3^$lc]);$Zi=int32($W[$Cf]-$Oe);$W[$Cf]=$Zi;}$aj=$W[$Pe];$Oe=xxtea_mx($aj,$Zi,$_h,$y[$Cf&3^$lc]);$Zi=int32($W[0]-$Oe);$W[0]=$Zi;$_h=int32($_h-0x9E3779B9);}return
|
|||
|
long2str($W,true);}$g='';$sd=$_SESSION["token"];if(!$sd)$_SESSION["token"]=rand(1,1e6);$ci=get_token();$Rf=array();if($_COOKIE["adminer_permanent"]){foreach(explode(" ",$_COOKIE["adminer_permanent"])as$X){list($y)=explode(":",$X);$Rf[$y]=$X;}}function
|
|||
|
add_invalid_login(){global$b;$gd=file_open_lock(get_temp_dir()."/adminer.invalid");if(!$gd)return;$Qd=unserialize(stream_get_contents($gd));$Sh=time();if($Qd){foreach($Qd
|
|||
|
as$Rd=>$X){if($X[0]<$Sh)unset($Qd[$Rd]);}}$Pd=&$Qd[$b->bruteForceKey()];if(!$Pd)$Pd=array($Sh+30*60,0);$Pd[1]++;file_write_unlock($gd,serialize($Qd));}function
|
|||
|
check_invalid_login(){global$b;$Qd=unserialize(@file_get_contents(get_temp_dir()."/adminer.invalid"));$Pd=$Qd[$b->bruteForceKey()];$Ve=($Pd[1]>29?$Pd[0]-time():0);if($Ve>0)auth_error(lang(78,ceil($Ve/60)));}$La=$_POST["auth"];if($La){session_regenerate_id();$Ki=$La["driver"];$M=$La["server"];$V=$La["username"];$F=(string)$La["password"];$m=$La["db"];set_password($Ki,$M,$V,$F);$_SESSION["db"][$Ki][$M][$V][$m]=true;if($La["permanent"]){$y=base64_encode($Ki)."-".base64_encode($M)."-".base64_encode($V)."-".base64_encode($m);$dg=$b->permanentLogin(true);$Rf[$y]="$y:".base64_encode($dg?encrypt_string($F,$dg):"");cookie("adminer_permanent",implode(" ",$Rf));}if(count($_POST)==1||DRIVER!=$Ki||SERVER!=$M||$_GET["username"]!==$V||DB!=$m)redirect(auth_url($Ki,$M,$V,$m));}elseif($_POST["logout"]){if($sd&&!verify_token()){page_header(lang(77),lang(79));page_footer("db");exit;}else{foreach(array("pwds","db","dbs","queries")as$y)set_session($y,null);unset_permanent();redirect(substr(preg_replace('~\b(username|db|ns)=[^&]*&~','',ME),0,-1),lang(80).' '.lang(81,'https://sourceforge.net/donate/index.php?group_id=264133'));}}elseif($Rf&&!$_SESSION["pwds"]){session_regenerate_id();$dg=$b->permanentLogin();foreach($Rf
|
|||
|
as$y=>$X){list(,$jb)=explode(":",$X);list($Ki,$M,$V,$m)=array_map('base64_decode',explode("-",$y));set_password($Ki,$M,$V,decrypt_string(base64_decode($jb),$dg));$_SESSION["db"][$Ki][$M][$V][$m]=true;}}function
|
|||
|
unset_permanent(){global$Rf;foreach($Rf
|
|||
|
as$y=>$X){list($Ki,$M,$V,$m)=array_map('base64_decode',explode("-",$y));if($Ki==DRIVER&&$M==SERVER&&$V==$_GET["username"]&&$m==DB)unset($Rf[$y]);}cookie("adminer_permanent",implode(" ",$Rf));}function
|
|||
|
auth_error($n){global$b,$sd;$eh=session_name();if(isset($_GET["username"])){header("HTTP/1.1 403 Forbidden");if(($_COOKIE[$eh]||$_GET[$eh])&&!$sd)$n=lang(82);else{add_invalid_login();$F=get_password();if($F!==null){if($F===false)$n.='<br>'.lang(83,target_blank(),'<code>permanentLogin()</code>');set_password(DRIVER,SERVER,$_GET["username"],null);}unset_permanent();}}if(!$_COOKIE[$eh]&&$_GET[$eh]&&ini_bool("session.use_only_cookies"))$n=lang(84);$Ef=session_get_cookie_params();cookie("adminer_key",($_COOKIE["adminer_key"]?$_COOKIE["adminer_key"]:rand_string()),$Ef["lifetime"]);page_header(lang(36),$n,null);echo"<form action='' method='post'>\n";$b->loginForm();echo"<div>";hidden_fields($_POST,array("auth"));echo"</div>\n","</form>\n";page_footer("auth");exit;}if(isset($_GET["username"])){if(!class_exists("Min_DB")){unset($_SESSION["pwds"][DRIVER]);unset_permanent();page_header(lang(85),lang(86,implode(", ",$Xf)),false);page_footer("auth");exit;}list($xd,$Tf)=explode(":",SERVER,2);if(is_numeric($Tf)&&$Tf<1024)auth_error(lang(87));check_invalid_login();$g=connect();$dc=new
|
|||
|
Min_Driver($g);}if(!is_object($g)||($te=$b->login($_GET["username"],get_password()))!==true)auth_error((is_string($g)?h($g):(is_string($te)?$te:lang(88))));if($La&&$_POST["token"])$_POST["token"]=$ci;$n='';if($_POST){if(!verify_token()){$Kd="max_input_vars";$Ce=ini_get($Kd);if(extension_loaded("suhosin")){foreach(array("suhosin.request.max_vars","suhosin.post.max_vars")as$y){$X=ini_get($y);if($X&&(!$Ce||$X<$Ce)){$Kd=$y;$Ce=$X;}}}$n=(!$_POST["token"]&&$Ce?lang(89,"'$Kd'"):lang(79).' '.lang(90));}}elseif($_SERVER["REQUEST_METHOD"]=="POST"){$n=lang(91,"'post_max_size'");if(isset($_GET["sql"]))$n.=' '.lang(92);}if(!ini_bool("session.use_cookies")||@ini_set("session.use_cookies",false)!==false)session_write_close();function
|
|||
|
select($H,$h=null,$uf=array(),$z=0){global$x;$se=array();$w=array();$e=array();$Ua=array();$U=array();$I=array();odd('');for($s=0;(!$z||$s<$z)&&($J=$H->fetch_row());$s++){if(!$s){echo"<table cellspacing='0' class='nowrap'>\n","<thead><tr>";for($Xd=0;$Xd<count($J);$Xd++){$o=$H->fetch_field();$C=$o->name;$tf=$o->orgtable;$sf=$o->orgname;$I[$o->table]=$tf;if($uf&&$x=="sql")$se[$Xd]=($C=="table"?"table=":($C=="possible_keys"?"indexes=":null));elseif($tf!=""){if(!isset($w[$tf])){$w[$tf]=array();foreach(indexes($tf,$h)as$v){if($v["type"]=="PRIMARY"){$w[$tf]=array_flip($v["columns"]);break;}}$e[$tf]=$w[$tf];}if(isset($e[$tf][$sf])){unset($e[$tf][$sf]);$w[$tf][$sf]=$Xd;$se[$Xd]=$tf;}}if($o->charsetnr==63)$Ua[$Xd]=true;$U[$Xd]=$o->type;echo"<th".($tf!=""||$o->name!=$sf?" title='".h(($tf!=""?"$tf.":"").$sf)."'":"").">".h($C).($uf?doc_link(array('sql'=>"explain-output.html#explain_".strtolower($C))):"");}echo"</thead>\n";}echo"<tr".odd().">";foreach($J
|
|||
|
as$y=>$X){if($X===null)$X="<i>NULL</i>";elseif($Ua[$y]&&!is_utf8($X))$X="<i>".lang(44,strlen($X))."</i>";elseif(!strlen($X))$X=" ";else{$X=h($X);if($U[$y]==254)$X="<code>$X</code>";}if(isset($se[$y])&&!$e[$se[$y]]){if($uf&&$x=="sql"){$Q=$J[array_search("table=",$se)];$_=$se[$y].urlencode($uf[$Q]!=""?$uf[$Q]:$Q);}else{$_="edit=".urlencode($se[$y]);foreach($w[$se[$y]]as$nb=>$Xd)$_.="&where".urlencode("[".bracket_escape($nb)."]")."=".urlencode($J[$Xd]);}$X="<a href='".h(ME.$_)."'>$X</a>";}echo"<td>$X";}}echo($s?"</table>":"<p class='message'>".lang(12))."\n";return$I;}function
|
|||
|
referencable_primary($Yg){$I=array();foreach(table_status('',true)as$Dh=>$Q){if($Dh!=$Yg&&fk_support($Q)){foreach(fields($Dh)as$o){if($o["primary"]){if($I[$Dh]){unset($I[$Dh]);break;}$I[$Dh]=$o;}}}}return$I;}function
|
|||
|
textarea($C,$Y,$K=10,$sb=80){global$x;echo"<textarea name='$C' rows='$K' cols='$sb' class='sqlarea jush-$x' 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($y,$o,$qb,$cd=array()){global$wh,$U,$xi,$hf;$T=$o["type"];echo'<td><select name="',h($y),'[type]" class="type" aria-labelledby="label-type">';if($T&&!isset($U[$T])&&!isset($cd[$T]))array_unshift($wh,$T);if($cd)$wh[lang(93)]=$cd;echo
|
|||
|
optionlist($wh,$T),'</select>
|
|||
|
',on_help("getTarget(event).value",1),script("mixin(qsl('select'), {onfocus: function () { lastType = selectValue(this); }, onchange: editingTypeChange});",""),'<td><input name="',h($y),'[length]" value="',h($o["length"]),'" size="3"',(!$o["length"]&&preg_match('~var(char|binary)$~',$T)?" class='required'":""),' aria-labelledby="label-length">',script("mixin(qsl('input'), {onfocus: editingLengthFocus, oninput: editingLengthChange});",""),'<td class="options">';echo"<select name='".h($y)."[collation]'".(preg_match('~(char|text|enum|set)$~',$T)?"":" class='hidden'").'><option value="">('.lang(94).')'.optionlist($qb,$o["collation"]).'</select>',($xi?"<select name='".h($y)."[unsigned]'".(!$T||preg_match('~((^|[^o])int|float|double|decimal)$~',$T)?"":" class='hidden'").'><option>'.optionlist($xi,$o["unsigned"]).'</select>':''),(isset($o['on_update'])?"<select name='".h($y)."[on_update]'".(preg_match('~timestamp|datetime~',$T)?"":" class='hidden'").'>'.optionlist(array(""=>"(".lang(95).")","CURRENT_TIMESTAMP"),$o["on_update"]).'</select>':''),($cd?"<select name='".h($y)."[on_delete]'".(preg_match("~`~",$T)?"":" class='hidden'")."><option value=''>(".lang(96).")".optionlist(explode("|",$hf),$o["on_delete"])."</select> ":" ");}function
|
|||
|
process_length($pe){global$wc;return(preg_match("~^\\s*\\(?\\s*$wc(?:\\s*,\\s*$wc)*+\\s*\\)?\\s*\$~",$pe)&&preg_match_all("~$wc~",$pe,$xe)?"(".implode(",",$xe[0]).")":preg_replace('~^[0-9].*~','(\0)',preg_replace('~[^-0-9,+()[\]]~','',$pe)));}function
|
|||
|
process_type($o,$ob="COLLATE"){global$xi;return" $o[type]".process_length($o["length"]).(preg_match('~(^|[^o])int|float|double|decimal~',$o["type"])&&in_array($o["unsigned"],$xi)?" $o[unsigned]":"").(preg_match('~char|text|enum|set~',$o["type"])&&$o["collation"]?" $ob ".q($o["collation"]):"");}function
|
|||
|
process_field($o,$pi){global$x;$Sb=$o["default"];return
|
|||
|
array(idf_escape(trim($o["field"])),process_type($pi),($o["null"]?" NULL":" NOT NULL"),(isset($Sb)?" DEFAULT ".((preg_match('~time~',$o["type"])&&preg_match('~^CURRENT_TIMESTAMP(\(\))?$~i',$Sb))||($x=="sqlite"&&preg_match('~^CURRENT_(TIME|TIMESTAMP|DATE)$~i',$Sb))||($o["type"]=="bit"&&preg_match("~^([0-9]+|b'[0-1]+')\$~",$Sb))||($x=="pgsql"&&preg_match("~^[a-z]+\\(('[^']*')+\\)\$~",$Sb))?$Sb:q($Sb)):""),(preg_match('~timestamp|datetime~',$o["type"])&&$o["on_update"]?" ON UPDATE $o[on_update]":""),(support("comment")&&$o["comment"]!=""?" COMMENT ".q($o["comment"]):""),($o["auto_increment"]?auto_increment():null),);}function
|
|||
|
type_class($T){foreach(array('char'=>'text','date'=>'time|year','binary'=>'blob','enum'=>'set',)as$y=>$X){if(preg_match("~$y|$X~",$T))return" class='$y'";}}function
|
|||
|
edit_fields($p,$qb,$T="TABLE",$cd=array(),$wb=false){global$g,$Ld;$p=array_values($p);echo'<thead><tr class="wrap">
|
|||
|
';if($T=="PROCEDURE"){echo'<td> ';}echo'<th id="label-name">',($T=="TABLE"?lang(97):lang(98)),'<td id="label-type">',lang(46),'<textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;"></textarea>',script("qs('#enum-edit').onblur = editingLengthBlur;"),'<td id="label-length">',lang(99),'<td>',lang(100);if($T=="TABLE"){echo'<td id="label-null">NULL
|
|||
|
<td><input type="radio" name="auto_increment_col" value=""><acronym id="label-ai" title="',lang(48),'">AI</acronym>',doc_link(array('sql'=>"example-auto-increment.html",'sqlite'=>"autoinc.html",'pgsql'=>"datatype.html#DATATYPE-SERIAL",'mssql'=>"ms186775.aspx",)),'<td id="label-default">',lang(49),(support("comment")?"<td id='label-comment'".($wb?"":" class='hidden'").">".lang(47):"");}echo'<td>',"<input type='image' class='icon' name='add[".(support("move_col")?0:count($p))."]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.5.0")."' alt='+' title='".lang(101)."'>".script("row_count = ".count($p).";"),'</thead>
|
|||
|
<tbody>
|
|||
|
',script("qsl('tbody').onkeydown = editingKeydown;");foreach($p
|
|||
|
as$s=>$o){$s++;$vf=$o[($_POST?"orig":"field")];$Zb=(isset($_POST["add"][$s-1])||(isset($o["field"])&&!$_POST["drop_col"][$s]))&&(support("drop_col")||$vf=="");echo'<tr',($Zb?"":" style='display: none;'"),'>
|
|||
|
',($T=="PROCEDURE"?"<td>".html_select("fields[$s][inout]",explode("|",$Ld),$o["inout"]):""),'<th>';if($Zb){echo'<input name="fields[',$s,'][field]" value="',h($o["field"]),'" maxlength="64" autocapitalize="off" aria-labelledby="label-name">',script("qsl('input').oninput = function () { editingNameChange.call(this);".($o["field"]!=""||count($p)>1?"":" editingAddRow.call(this);")." };","");}echo'<input type="hidden" name="fields[',$s,'][orig]" value="',h($vf),'">
|
|||
|
';edit_type("fields[$s]",$o,$qb,$cd);if($T=="TABLE"){echo'<td>',checkbox("fields[$s][null]",1,$o["null"],"","","block","label-null"),'<td><label class="block"><input type="radio" name="auto_increment_col" value="',$s,'"';if($o["auto_increment"]){echo' checked';}echo' aria-labelledby="label-ai">',script("qsl('input').onclick = function () { var field = this.form['fields[' + this.value + '][field]']; if (!field.value) { field.value = 'id'; field.oninput(); } }"),'</label><td>',checkbox("fields[$s][has_default]",1,$o["has_default"],"","","","label-default"),'<input name="fields[',$s,'][default]" value="',h($o["default"]),'" aria-labelledby="label-default">',script("qsl('input').oninput = function () { this.previousSibling.checked = true; }",""),(support("comment")?"<td".($wb?"":" class='hidden'")."><input name='fields[$s][comment]' value='".h($o["comment"])."' maxlength='".($g->server_info>=5.5?1024:255)."' aria-labelledby='label-comment'>":"");}echo"<td>",(support("move_col")?"<input type='image' class='icon' name='add[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.5.0")."' alt='+' title='".lang(101)."'> ".script("qsl('input').onclick = partial(editingAddRow, 1);","")."<input type='image' class='icon' name='up[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=up.gif&version=4.5.0")."' alt='^' title='".lang(102)."'> ".script("qsl('input').onclick = partial(editingMoveRow, 1);","")."<input type='image' class='icon' name='down[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=down.gif&version=4.5.0")."' alt='v' title='".lang(103)."'> ".script("qsl('input').onclick = partial(editingMoveRow, 0);",""):""),($vf==""||support("drop_col")?"<input type='image' class='icon' name='drop_col[$s]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.5.0")."' alt='x' title='".lang(104)."'>".script("qsl('input').onclick = partial(editingRemoveRow, 'fields\$1[field]');"):"");}}function
|
|||
|
process_fields(&$p){$D=0;if($_POST["up"]){$je=0;foreach($p
|
|||
|
as$y=>$o){if(key($_POST["up"])==$y){unset($p[$y]);array_splice($p,$je,0,array($o));break;}if(isset($o["field"]))$je=$D;$D++;}}elseif($_POST["down"]){$ed=false;foreach($p
|
|||
|
as$y=>$o){if(isset($o["field"])&&$ed){unset($p[key($_POST["down"])]);array_splice($p,$D,0,array($ed));break;}if(key($_POST["down"])==$y)$ed=$o;$D++;}}elseif($_POST["add"]){$p=array_values($p);array_splice($p,key($_POST["add"]),0,array(array()));}elseif(!$_POST["drop_col"])return
|
|||
|
false;return
|
|||
|
true;}function
|
|||
|
normalize_enum($B){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($B[0][0].$B[0][0],$B[0][0],substr($B[0],1,-1))),'\\'))."'";}function
|
|||
|
grant($kd,$fg,$e,$gf){if(!$fg)return
|
|||
|
true;if($fg==array("ALL PRIVILEGES","GRANT OPTION"))return($kd=="GRANT"?queries("$kd ALL PRIVILEGES$gf WITH GRANT OPTION"):queries("$kd ALL PRIVILEGES$gf")&&queries("$kd GRANT OPTION$gf"));return
|
|||
|
queries("$kd ".preg_replace('~(GRANT OPTION)\\([^)]*\\)~','\\1',implode("$e, ",$fg).$e).$gf);}function
|
|||
|
drop_create($fc,$i,$gc,$Ph,$ic,$A,$He,$Fe,$Ge,$df,$Se){if($_POST["drop"])query_redirect($fc,$A,$He);elseif($df=="")query_redirect($i,$A,$Ge);elseif($df!=$Se){$Gb=queries($i);queries_redirect($A,$Fe,$Gb&&queries($fc));if($Gb)queries($gc);}else
|
|||
|
queries_redirect($A,$Fe,queries($Ph)&&queries($ic)&&queries($fc)&&queries($i));}function
|
|||
|
create_trigger($gf,$J){global$x;$Uh=" $J[Timing] $J[Event]".($J["Event"]=="UPDATE OF"?" ".idf_escape($J["Of"]):"");return"CREATE TRIGGER ".idf_escape($J["Trigger"]).($x=="mssql"?$gf.$Uh:$Uh.$gf).rtrim(" $J[Type]\n$J[Statement]",";").";";}function
|
|||
|
create_routine($Lg,$J){global$Ld;$N=array();$p=(array)$J["fields"];ksort($p);foreach($p
|
|||
|
as$o){if($o["field"]!="")$N[]=(preg_match("~^($Ld)\$~",$o["inout"])?"$o[inout] ":"").idf_escape($o["field"]).process_type($o,"CHARACTER SET");}return"CREATE $Lg ".idf_escape(trim($J["name"]))." (".implode(", ",$N).")".(isset($_GET["function"])?" RETURNS".process_type($J["returns"],"CHARACTER SET"):"").($J["language"]?" LANGUAGE $J[language]":"").rtrim("\n$J[definition]",";").";";}function
|
|||
|
remove_definer($G){return
|
|||
|
preg_replace('~^([A-Z =]+) DEFINER=`'.preg_replace('~@(.*)~','`@`(%|\\1)',logged_user()).'`~','\\1',$G);}function
|
|||
|
format_foreign_key($q){global$hf;return" FOREIGN KEY (".implode(", ",array_map('idf_escape',$q["source"])).") REFERENCES ".table($q["table"])." (".implode(", ",array_map('idf_escape',$q["target"])).")".(preg_match("~^($hf)\$~",$q["on_delete"])?" ON DELETE $q[on_delete]":"").(preg_match("~^($hf)\$~",$q["on_update"])?" ON UPDATE $q[on_update]":"");}function
|
|||
|
tar_file($Tc,$Zh){$I=pack("a100a8a8a8a12a12",$Tc,644,0,0,decoct($Zh->size),decoct(time()));$hb=8*32;for($s=0;$s<strlen($I);$s++)$hb+=ord($I[$s]);$I.=sprintf("%06o",$hb)."\0 ";echo$I,str_repeat("\0",512-strlen($I));$Zh->send();echo
|
|||
|
str_repeat("\0",511-($Zh->size+511)%512);}function
|
|||
|
ini_bytes($Kd){$X=ini_get($Kd);switch(strtolower(substr($X,-1))){case'g':$X*=1024;case'm':$X*=1024;case'k':$X*=1024;}return$X;}function
|
|||
|
doc_link($Pf){global$x,$g;$Bi=array('sql'=>"https://dev.mysql.com/doc/refman/".substr($g->server_info,0,3)."/en/",'sqlite'=>"https://www.sqlite.org/",'pgsql'=>"https://www.postgresql.org/docs/".substr($g->server_info,0,3)."/static/",'mssql'=>"https://msdn.microsoft.com/library/",'oracle'=>"https://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",);return($Pf[$x]?"<a href='$Bi[$x]$Pf[$x]'".target_blank()."><sup>?</sup></a>":"");}function
|
|||
|
ob_gzencode($P){return
|
|||
|
gzencode($P);}function
|
|||
|
db_size($m){global$g;if(!$g->select_db($m))return"?";$I=0;foreach(table_status()as$R)$I+=$R["Data_length"]+$R["Index_length"];return
|
|||
|
format_number($I);}function
|
|||
|
set_utf8mb4($i){global$g;static$N=false;if(!$N&&preg_match('~\butf8mb4~i',$i)){$N=true;echo"SET NAMES ".charset($g).";\n\n";}}function
|
|||
|
connect_error(){global$b,$g,$ci,$n,$ec;if(DB!=""){header("HTTP/1.1 404 Not Found");page_header(lang(35).": ".h(DB),lang(105),true);}else{if($_POST["db"]&&!$n)queries_redirect(substr(ME,0,-1),lang(106),drop_databases($_POST["db"]));page_header(lang(107),$n,false);echo"<p class='links'>\n";foreach(array('database'=>lang(108),'privileges'=>lang(68),'processlist'=>lang(109),'variables'=>lang(110),'status'=>lang(111),)as$y=>$X){if(support($y))echo"<a href='".h(ME)."$y='>$X</a>\n";}echo"<p>".lang(112,$ec[DRIVER],"<b>".h($g->server_info)."</b>","<b>$g->extension</b>")."\n","<p>".lang(113,"<b>".h(logged_user())."</b>")."\n";$l=$b->databases();if($l){$Sg=support("scheme");$qb=collations();echo"<form action='' method='post'>\n","<table cellspacing='0' class='checkable'>\n",script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"),"<thead><tr>".(support("database")?"<td> ":"")."<th>".lang(35)." - <a href='".h(ME)."refresh=1'>".lang(114)."</a>"."<td>".lang(115)."<td>".lang(116)."<td>".lang(117)." - <a href='".h(ME)."dbsize=1'>".lang(118)."</a>".script("qsl('a').onclick = partial(ajaxSetHtml, '".js_escape(ME)."script=connect');","")."</thead>\n";$l=($_GET["dbsize"]?count_tables($l):array_flip($l));foreach($l
|
|||
|
as$m=>$S){$Kg=h(ME)."db=".urlencode($m);$t=h("Db-".$m);echo"<tr".odd().">".(support("database")?"<td>".checkbox("db[]",$m,in_array($m,(array)$_POST["db"]),"","","",$t):""),"<th><a href='$Kg' id='$m'>".h($m)."</a>";$pb=nbsp(db_collation($m,$qb));echo"<td>".(support("database")?"<a href='$Kg".($Sg?"&ns=":"")."&database=' title='".lang(64)."'>$pb</a>":$pb),"<td align='right'><a href='$Kg&schema=' id='tables-".h($m)."' title='".lang(67)."'>".($_GET["dbsize"]?$S:"?")."</a>","<td align='right' id='size-".h($m)."'>".($_GET["dbsize"]?db_size($m):"?"),"\n";}echo"</table>\n",(support("database")?"<fieldset><legend>".lang(119)." <span id='selected'></span></legend><div>\n"."<input type='hidden' name='all' value=''>".script("qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^db/)); };")."<input type='submit' name='drop' value='".lang(120)."'>".confirm()."\n"."</div></fieldset>\n":""),script("tableCheck();"),"<input type='hidden' name='token' value='$ci'>\n","</form>\n";}}page_footer("db");}if(isset($_GET["status"]))$_GET["variables"]=$_GET["status"];if(isset($_GET["import"]))$_GET["sql"]=$_GET["import"];if(!(DB!=""?$g->select_db(DB):isset($_GET["sql"])||isset($_GET["dump"])||isset($_GET["database"])||isset($_GET["processlist"])||isset($_GET["privileges"])||isset($_GET["user"])||isset($_GET["variables"])||$_GET["script"]=="connect"||$_GET["script"]=="kill")){if(DB!=""||$_GET["refresh"]){restart_session();set_session("dbs",null);}connect_error();exit;}if(support("scheme")&&DB!=""&&$_GET["ns"]!==""){if(!isset($_GET["ns"]))redirect(preg_replace('~ns=[^&]*&~','',ME)."ns=".get_schema());if(!set_schema($_GET["ns"])){header("HTTP/1.1 404 Not Found");page_header(lang(73).": ".h($_GET["ns"]),lang(121),true);page_footer("ns");exit;}}$hf="RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT";class
|
|||
|
TmpFile{var$handler;var$size;function
|
|||
|
__construct(){$this->handler=tmpfile();}function
|
|||
|
write($Ab){$this->size+=strlen($Ab);fwrite($this->handler,$Ab);}function
|
|||
|
send(){fseek($this->handler,0);fpassthru($this->handler);fclose($this->handler);}}$wc="'(?:''|[^'\\\\]|\\\\.)*'";$Ld="IN|OUT|INOUT";if(isset($_GET["select"])&&($_POST["edit"]||$_POST["clone"])&&!$_POST["save"])$_GET["edit"]=$_GET["select"];if(isset($_GET["callf"]))$_GET["call"]=$_GET["callf"];if(isset($_GET["function"]))$_GET["procedure"]=$_GET["function"];if(isset($_GET["download"])){$a=$_GET["download"];$p=fields($a);header("Content-Type: application/octet-stream");header("Content-Disposition: attachment; filename=".friendly_url("$a-".implode("_",$_GET["where"])).".".friendly_url($_GET["field"]));$L=array(idf_escape($_GET["field"]));$H=$dc->select($a,$L,array(where($_GET,$p)),$L);$J=($H?$H->fetch_row():array());echo$J[0];exit;}elseif(isset($_GET["table"])){$a=$_GET["table"];$p=fields($a);if(!$p)$n=error();$R=table_status1($a,true);page_header(($p&&is_view($R)?$R['Engine']=='materialized view'?lang(122):lang(123):lang(124)).": ".h($a),$n);$b->selectLinks($R);$vb=$R["Comment"];if($vb!="")echo"<p class='nowrap'>".lang(47).": ".h($vb)."\n";if($p)$b->tableStructurePrint($p);if(!is_view($R)){if(support("indexes")){echo"<h3 id='indexes'>".lang(125)."</h3>\n";$w=indexes($a);if($w)$b->tableIndexesPrint($w);echo'<p class="links"><a href="'.h(ME).'indexes='.urlencode($a).'">'.lang(126)."</a>\n";}if(fk_support($R)){echo"<h3 id='foreign-keys'>".lang(93)."</h3>\n";$cd=foreign_keys($a);if($cd){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(127)."<td>".lang(128)."<td>".lang(96)."<td>".lang(95)."<td> </thead>\n";foreach($cd
|
|||
|
as$C=>$q){echo"<tr title='".h($C)."'>","<th><i>".implode("</i>, <i>",array_map('h',$q["source"]))."</i>","<td><a href='".h($q["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($q["db"]),ME):($q["ns"]!=""?preg_replace('~ns=[^&]*~',"ns=".urlencode($q["ns"]),ME):ME))."table=".urlencode($q["table"])."'>".($q["db"]!=""?"<b>".h($q["db"])."</b>.":"").($q["ns"]!=""?"<b>".h($q["ns"])."</b>.":"").h($q["table"])."</a>","(<i>".implode("</i>, <i>",array_map('h',$q["target"]))."</i>)","<td>".nbsp($q["on_delete"])."\n","<td>".nbsp($q["on_update"])."\n",'<td><a href="'.h(ME.'foreign='.urlencode($a).'&name='.urlencode($C)).'">'.lang(129).'</a>';}echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'foreign='.urlencode($a).'">'.lang(130)."</a>\n";}}if(support(is_view($R)?"view_trigger":"trigger")){echo"<h3 id='triggers'>".lang(131)."</h3>\n";$oi=triggers($a);if($oi){echo"<table cellspacing='0'>\n";foreach($oi
|
|||
|
as$y=>$X)echo"<tr valign='top'><td>".h($X[0])."<td>".h($X[1])."<th>".h($y)."<td><a href='".h(ME.'trigger='.urlencode($a).'&name='.urlencode($y))."'>".lang(129)."</a>\n";echo"</table>\n";}echo'<p class="links"><a href="'.h(ME).'trigger='.urlencode($a).'">'.lang(132)."</a>\n";}}elseif(isset($_GET["schema"])){page_header(lang(67),"",array(),h(DB.($_GET["ns"]?".$_GET[ns]":"")));$Fh=array();$Gh=array();$ea=($_GET["schema"]?$_GET["schema"]:$_COOKIE["adminer_schema-".str_replace(".","_",DB)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$ea,$xe,PREG_SET_ORDER);foreach($xe
|
|||
|
as$s=>$B){$Fh[$B[1]]=array($B[2],$B[3]);$Gh[]="\n\t'".js_escape($B[1])."': [ $B[2], $B[3] ]";}$di=0;$Ra=-1;$Rg=array();$xg=array();$ne=array();foreach(table_status('',true)as$Q=>$R){if(is_view($R))continue;$Uf=0;$Rg[$Q]["fields"]=array();foreach(fields($Q)as$C=>$o){$Uf+=1.25;$o["pos"]=$Uf;$Rg[$Q]["fields"][$C]=$o;}$Rg[$Q]["pos"]=($Fh[$Q]?$Fh[$Q]:array($di,0));foreach($b->foreignKeys($Q)as$X){if(!$X["db"]){$le=$Ra;if($Fh[$Q][1]||$Fh[$X["table"]][1])$le=min(floatval($Fh[$Q][1]),floatval($Fh[$X["table"]][1]))-1;else$Ra-=.1;while($ne[(string)$le])$le-=.0001;$Rg[$Q]["references"][$X["table"]][(string)$le]=array($X["source"],$X["target"]);$xg[$X["table"]][$Q][(string)$le]=$X["target"];$ne[(string)$le]=true;}}$di=max($di,$Rg[$Q]["pos"][0]+2.5+$Uf);}echo'<div id="schema" style="height: ',$di,'em;">
|
|||
|
<script',nonce(),'>
|
|||
|
qs(\'#schema\').onselectstart = function () { return false; };
|
|||
|
var tablePos = {',implode(",",$Gh)."\n",'};
|
|||
|
var em = qs(\'#schema\').offsetHeight / ',$di,';
|
|||
|
document.onmousemove = schemaMousemove;
|
|||
|
document.onmouseup = partialArg(schemaMouseup, \'',js_escape(DB),'\');
|
|||
|
</script>
|
|||
|
';foreach($Rg
|
|||
|
as$C=>$Q){echo"<div class='table' style='top: ".$Q["pos"][0]."em; left: ".$Q["pos"][1]."em;'>",'<a href="'.h(ME).'table='.urlencode($C).'"><b>'.h($C)."</b></a>",script("qsl('div').onmousedown = schemaMousedown;");foreach($Q["fields"]as$o){$X='<span'.type_class($o["type"]).' title="'.h($o["full_type"].($o["null"]?" NULL":'')).'">'.h($o["field"]).'</span>';echo"<br>".($o["primary"]?"<i>$X</i>":$X);}foreach((array)$Q["references"]as$Mh=>$yg){foreach($yg
|
|||
|
as$le=>$ug){$me=$le-$Fh[$C][1];$s=0;foreach($ug[0]as$lh)echo"\n<div class='references' title='".h($Mh)."' id='refs$le-".($s++)."' style='left: $me"."em; top: ".$Q["fields"][$lh]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$me)."em;'></div></div>";}}foreach((array)$xg[$C]as$Mh=>$yg){foreach($yg
|
|||
|
as$le=>$e){$me=$le-$Fh[$C][1];$s=0;foreach($e
|
|||
|
as$Lh)echo"\n<div class='references' title='".h($Mh)."' id='refd$le-".($s++)."' style='left: $me"."em; top: ".$Q["fields"][$Lh]["pos"]."em; height: 1.25em; background: url(".h(preg_replace("~\\?.*~","",ME)."?file=arrow.gif) no-repeat right center;&version=4.5.0")."'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$me)."em;'></div></div>";}}echo"\n</div>\n";}foreach($Rg
|
|||
|
as$C=>$Q){foreach((array)$Q["references"]as$Mh=>$yg){foreach($yg
|
|||
|
as$le=>$ug){$Le=$di;$Ae=-10;foreach($ug[0]as$y=>$lh){$Vf=$Q["pos"][0]+$Q["fields"][$lh]["pos"];$Wf=$Rg[$Mh]["pos"][0]+$Rg[$Mh]["fields"][$ug[1][$y]]["pos"];$Le=min($Le,$Vf,$Wf);$Ae=max($Ae,$Vf,$Wf);}echo"<div class='references' id='refl$le' style='left: $le"."em; top: $Le"."em; padding: .5em 0;'><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Ae-$Le)."em;'></div></div>\n";}}}echo'</div>
|
|||
|
<p class="links"><a href="',h(ME."schema=".urlencode($ea)),'" id="schema-link">',lang(133),'</a>
|
|||
|
';}elseif(isset($_GET["dump"])){$a=$_GET["dump"];if($_POST&&!$n){$Db="";foreach(array("output","format","db_style","routines","events","table_style","auto_increment","triggers","data_style")as$y)$Db.="&$y=".urlencode($_POST[$y]);cookie("adminer_export",substr($Db,1));$S=array_flip((array)$_POST["tables"])+array_flip((array)$_POST["data"]);$Ic=dump_headers((count($S)==1?key($S):DB),(DB==""||count($S)>1));$Td=preg_match('~sql~',$_POST["format"]);if($Td){echo"-- Adminer $ia ".$ec[DRIVER]." dump\n\n";if($x=="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';
|
|||
|
":"")."
|
|||
|
";$g->query("SET time_zone = '+00:00';");}}$xh=$_POST["db_style"];$l=array(DB);if(DB==""){$l=$_POST["databases"];if(is_string($l))$l=explode("\n",rtrim(str_replace("\r","",$l),"\n"));}foreach((array)$l
|
|||
|
as$m){$b->dumpDatabase($m);if($g->select_db($m)){if($Td&&preg_match('~CREATE~',$xh)&&($i=$g->result("SHOW CREATE DATABASE ".idf_escape($m),1))){set_utf8mb4($i);if($xh=="DROP+CREATE")echo"DROP DATABASE IF EXISTS ".idf_escape($m).";\n";echo"$i;\n";}if($Td){if($xh)echo
|
|||
|
use_sql($m).";\n\n";$Af="";if($_POST["routines"]){foreach(array("FUNCTION","PROCEDURE")as$Lg){foreach(get_rows("SHOW $Lg STATUS WHERE Db = ".q($m),null,"-- ")as$J){$i=remove_definer($g->result("SHOW CREATE $Lg ".idf_escape($J["Name"]),2));set_utf8mb4($i);$Af.=($xh!='DROP+CREATE'?"DROP $Lg IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$i;;\n\n";}}}if($_POST["events"]){foreach(get_rows("SHOW EVENTS",null,"-- ")as$J){$i=remove_definer($g->result("SHOW CREATE EVENT ".idf_escape($J["Name"]),3));set_utf8mb4($i);$Af.=($xh!='DROP+CREATE'?"DROP EVENT IF EXISTS ".idf_escape($J["Name"]).";;\n":"")."$i;;\n\n";}}if($Af)echo"DELIMITER ;;\n\n$Af"."DELIMITER ;\n\n";}if($_POST["table_style"]||$_POST["data_style"]){$Ni=array();foreach(table_status('',true)as$C=>$R){$Q=(DB==""||in_array($C,(array)$_POST["tables"]));$Lb=(DB==""||in_array($C,(array)$_POST["data"]));if($Q||$Lb){if($Ic=="tar"){$Zh=new
|
|||
|
TmpFile;ob_start(array($Zh,'write'),1e5);}$b->dumpTable($C,($Q?$_POST["table_style"]:""),(is_view($R)?2:0));if(is_view($R))$Ni[]=$C;elseif($Lb){$p=fields($C);$b->dumpData($C,$_POST["data_style"],"SELECT *".convert_fields($p,$p)." FROM ".table($C));}if($Td&&$_POST["triggers"]&&$Q&&($oi=trigger_sql($C)))echo"\nDELIMITER ;;\n$oi\nDELIMITER ;\n";if($Ic=="tar"){ob_end_flush();tar_file((DB!=""?"":"$m/")."$C.csv",$Zh);}elseif($Td)echo"\n";}}foreach($Ni
|
|||
|
as$Mi)$b->dumpTable($Mi,$_POST["table_style"],1);if($Ic=="tar")echo
|
|||
|
pack("x512");}}}if($Td)echo"-- ".$g->result("SELECT NOW()")."\n";exit;}page_header(lang(70),$n,($_GET["export"]!=""?array("table"=>$_GET["export"]):array()),h(DB));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0">
|
|||
|
';$Pb=array('','USE','DROP+CREATE','CREATE');$Hh=array('','DROP+CREATE','CREATE');$Mb=array('','TRUNCATE+INSERT','INSERT');if($x=="sql")$Mb[]='INSERT+UPDATE';parse_str($_COOKIE["adminer_export"],$J);if(!$J)$J=array("output"=>"text","format"=>"sql","db_style"=>(DB!=""?"":"CREATE"),"table_style"=>"DROP+CREATE","data_style"=>"INSERT");if(!isset($J["events"])){$J["routines"]=$J["events"]=($_GET["dump"]=="");$J["triggers"]=$J["table_style"];}echo"<tr><th>".lang(134)."<td>".html_select("output",$b->dumpOutput(),$J["output"],0)."\n";echo"<tr><th>".lang(135)."<td>".html_select("format",$b->dumpFormat(),$J["format"],0)."\n";echo($x=="sqlite"?"":"<tr><th>".lang(35)."<td>".html_select('db_style',$Pb,$J["db_style"]).(support("routine")?checkbox("routines",1,$J["routines"],lang(136)):"").(support("event")?checkbox("events",1,$J["events"],lang(137)):"")),"<tr><th>".lang(116)."<td>".html_select('table_style',$Hh,$J["table_style"]).checkbox("auto_increment",1,$J["auto_increment"],lang(48)).(support("trigger")?checkbox("triggers",1,$J["triggers"],lang(131)):""),"<tr><th>".lang(138)."<td>".html_select('data_style',$Mb,$J["data_style"]),'</table>
|
|||
|
<p><input type="submit" value="',lang(70),'">
|
|||
|
<input type="hidden" name="token" value="',$ci,'">
|
|||
|
|
|||
|
<table cellspacing="0">
|
|||
|
';$Zf=array();if(DB!=""){$fb=($a!=""?"":" checked");echo"<thead><tr>","<th style='text-align: left;'><label class='block'><input type='checkbox' id='check-tables'$fb>".lang(116)."</label>".script("qs('#check-tables').onclick = partial(formCheck, /^tables\\[/);",""),"<th style='text-align: right;'><label class='block'>".lang(138)."<input type='checkbox' id='check-data'$fb></label>".script("qs('#check-data').onclick = partial(formCheck, /^data\\[/);",""),"</thead>\n";$Ni="";$Ih=tables_list();foreach($Ih
|
|||
|
as$C=>$T){$Yf=preg_replace('~_.*~','',$C);$fb=($a==""||$a==(substr($a,-1)=="%"?"$Yf%":$C));$cg="<tr><td>".checkbox("tables[]",$C,$fb,$C,"checkboxClick.call(this, event); formUncheck('check-tables');","block");if($T!==null&&!preg_match('~table~i',$T))$Ni.="$cg\n";else
|
|||
|
echo"$cg<td align='right'><label class='block'><span id='Rows-".h($C)."'></span>".checkbox("data[]",$C,$fb,"","checkboxClick.call(this, event); formUncheck('check-data');")."</label>\n";$Zf[$Yf]++;}echo$Ni;if($Ih)echo
|
|||
|
script("ajaxSetHtml('".js_escape(ME)."script=db');");}else{echo"<thead><tr><th style='text-align: left;'>","<label class='block'><input type='checkbox' id='check-databases'".($a==""?" checked":"").">".lang(35)."</label>",script("qs('#check-databases').onclick = partial(formCheck, /^databases\\[/);",""),"</thead>\n";$l=$b->databases();if($l){foreach($l
|
|||
|
as$m){if(!information_schema($m)){$Yf=preg_replace('~_.*~','',$m);echo"<tr><td>".checkbox("databases[]",$m,$a==""||$a=="$Yf%",$m,"formUncheck('check-databases');","block")."\n";$Zf[$Yf]++;}}}else
|
|||
|
echo"<tr><td><textarea name='databases' rows='10' cols='20'></textarea>";}echo'</table>
|
|||
|
</form>
|
|||
|
';$Vc=true;foreach($Zf
|
|||
|
as$y=>$X){if($y!=""&&$X>1){echo($Vc?"<p>":" ")."<a href='".h(ME)."dump=".urlencode("$y%")."'>".h($y)."</a>";$Vc=false;}}}elseif(isset($_GET["privileges"])){page_header(lang(68));echo'<p class="links"><a href="'.h(ME).'user=">'.lang(139)."</a>";$H=$g->query("SELECT User, Host FROM mysql.".(DB==""?"user":"db WHERE ".q(DB)." LIKE Db")." ORDER BY Host, User");$kd=$H;if(!$H)$H=$g->query("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");echo"<form action=''><p>\n";hidden_fields_get();echo"<input type='hidden' name='db' value='".h(DB)."'>\n",($kd?"":"<input type='hidden' name='grant' value=''>\n"),"<table cellspacing='0'>\n","<thead><tr><th>".lang(33)."<th>".lang(32)."<th> </thead>\n";while($J=$H->fetch_assoc())echo'<tr'.odd().'><td>'.h($J["User"])."<td>".h($J["Host"]).'<td><a href="'.h(ME.'user='.urlencode($J["User"]).'&host='.urlencode($J["Host"])).'">'.lang(10)."</a>\n";if(!$kd||DB!="")echo"<tr".odd()."><td><input name='user' autocapitalize='off'><td><input name='host' value='localhost' autocapitalize='off'><td><input type='submit' value='".lang(10)."'>\n";echo"</table>\n","</form>\n";}elseif(isset($_GET["sql"])){if(!$n&&$_POST["export"]){dump_headers("sql");$b->dumpTable("","");$b->dumpData("","table",$_POST["query"]);exit;}restart_session();$vd=&get_session("queries");$ud=&$vd[DB];if(!$n&&$_POST["clear"]){$ud=array();redirect(remove_from_uri("history"));}page_header((isset($_GET["import"])?lang(69):lang(61)),$n);if(!$n&&$_POST){$gd=false;if(!isset($_GET["import"]))$G=$_POST["query"];elseif($_POST["webfile"]){$qh=$b->importServerPath();$gd=@fopen((file_exists($qh)?$qh:"compress.zlib://$qh.gz"),"rb");$G=($gd?fread($gd,1e6):false);}else$G=get_file("sql_file",true);if(is_string($G)){if(function_exists('memory_get_usage'))@ini_set("memory_limit",max(ini_bytes("memory_limit"),2*strlen($G)+memory_get_usage()+8e6));if($G!=""&&strlen($G)<1e6){$lg=$G.(preg_match("~;[ \t\r\n]*\$~",$G)?"":";");if(!$ud||reset(end($ud))!=$lg){restart_session();$ud[]=array($lg,time());set_session("queries",$vd);stop_session();}}$mh="(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)";$Ub=";";$D=0;$tc=true;$h=connect();if(is_object($h)&&DB!="")$h->select_db(DB);$ub=0;$yc=array();$Gf='[\'"'.($x=="sql"?'`#':($x=="sqlite"?'`[':($x=="mssql"?'[':''))).']|/\\*|-- |$'.($x=="pgsql"?'|\\$[^$]*\\$':'');$ei=microtime(true);parse_str($_COOKIE["adminer_export"],$ya);$kc=$b->dumpFormat();unset($kc["sql"]);while($G!=""){if(!$D&&preg_match("~^$mh*+DELIMITER\\s+(\\S+)~i",$G,$B)){$Ub=$B[1];$G=substr($G,strlen($B[0]));}else{preg_match('('.preg_quote($Ub)."\\s*|$Gf)",$G,$B,PREG_OFFSET_CAPTURE,$D);list($ed,$Uf)=$B[0];if(!$ed&&$gd&&!feof($gd))$G.=fread($gd,1e5);else{if(!$ed&&rtrim($G)=="")break;$D=$Uf+strlen($ed);if($ed&&rtrim($ed)!=$Ub){while(preg_match('('.($ed=='/*'?'\\*/':($ed=='['?']':(preg_match('~^-- |^#~',$ed)?"\n":preg_quote($ed)."|\\\\."))).'|$)s',$G,$B,PREG_OFFSET_CAPTURE,$D)){$Pg=$B[0][0];if(!$Pg&&$gd&&!feof($gd))$G.=fread($gd,1e5);else{$D=$B[0][1]+strlen($Pg);if($Pg[0]!="\\")break;}}}else{$tc=false;$lg=substr($G,0,$Uf);$ub++;$cg="<pre id='sql-$ub'><code class='jush-$x'>".$b->sqlCommandQuery($lg)."</code></pre>\n";if($x=="sqlite"&&preg_match("~^$mh*+ATTACH\\b~i",$lg,$B)){echo$cg,"<p class='error'>".lang(140)."\n";$yc[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break;}else{if(!$_POST["only_errors"]){echo$cg;ob_flush();flush();}$sh=microtime(true);if($g->multi_query($lg)&&is_object($h)&&preg_match("~^$mh*+USE\\b~i",$lg))$h->query($lg);do{$H=$g->store_result();$Sh=" <span class='time'>(".format_time($sh).")</span>".(strlen($lg)<1000?" <a href='".h(ME)."sql=".urlencode(trim($lg))."'>".lang(10)."</a>":"");if($g->error){echo($_POST["only_errors"]?$cg:""),"<p class='error'>".lang(141).($g->errno?" ($g->errno)":"").": ".error()."\n";$yc[]=" <a href='#sql-$ub'>$ub</a>";if($_POST["error_stops"])break
|
|||
|
2;}elseif(is_object($H)){$z=$_POST["limit"];$uf=select($H,$h,array(),$z);if(!$_POST["only_errors"]){echo"<form action='' method='post'>\n";$Xe=$H->num_rows;echo"<p>".($Xe?($z&&$Xe>$z?lang(142,$z):"").lang(143,$Xe):""),$Sh;$t="export-$ub";$Gc=", <a href='#$t'>".lang(70)."</a>".script("qsl('a').onclick = partial(toggle, '$t');","")."<span id='$t' class='hidden'>: ".html_select("output",$b->dumpOutput(),$ya["output"])." ".html_select("format",$kc,$ya["format"])."<input type='hidden' name='query' value='".h($lg)."'>"." <input type='submit' name='export' value='".lang(70)."'><input type='hidden' name='token' value='$ci'></span>\n";if($h&&preg_match("~^($mh|\\()*+SELECT\\b~i",$lg)&&($Fc=explain($h,$lg))){$t="explain-$ub";echo", <a href='#$t'>EXPLAIN</a>".script("qsl('a').onclick = partial(toggle, '$t');","").$Gc,"<div id='$t' class='hidden'>\n";select($Fc,$h,$uf);echo"</div>\n";}else
|
|||
|
echo$Gc;echo"</form>\n";}}else{if(preg_match("~^$mh*+(CREATE|DROP|ALTER)$mh++(DATABASE|SCHEMA)\\b~i",$lg)){restart_session();set_session("dbs",null);stop_session();}if(!$_POST["only_errors"])echo"<p class='message' title='".h($g->info)."'>".lang(144,$g->affected_rows)."$Sh\n";}$sh=microtime(true);}while($g->next_result());}$G=substr($G,$D);$D=0;}}}}if($tc)echo"<p class='message'>".lang(145)."\n";elseif($_POST["only_errors"]){echo"<p class='message'>".lang(146,$ub-count($yc))," <span class='time'>(".format_time($ei).")</span>\n";}elseif($yc&&$ub>1)echo"<p class='error'>".lang(141).": ".implode("",$yc)."\n";}else
|
|||
|
echo"<p class='error'>".upload_error($G)."\n";}echo'
|
|||
|
<form action="" method="post" enctype="multipart/form-data" id="form">
|
|||
|
';$Cc="<input type='submit' value='".lang(147)."' title='Ctrl+Enter'>";if(!isset($_GET["import"])){$lg=$_GET["sql"];if($_POST)$lg=$_POST["query"];elseif($_GET["history"]=="all")$lg=$ud;elseif($_GET["history"]!="")$lg=$ud[$_GET["history"]][0];echo"<p>";textarea("query",$lg,20);echo($_POST?"":script("qs('textarea').focus();")),"<p>$Cc\n",lang(148).": <input type='number' name='limit' class='size' value='".h($_POST?$_POST["limit"]:$_GET["limit"])."'>\n";}else{echo"<fieldset><legend>".lang(149)."</legend><div>",(ini_bool("file_uploads")?"SQL (< ".ini_get("upload_max_filesize")."B): <input type='file' name='sql_file[]' multiple>\n$Cc":lang(150)),"</div></fieldset>\n","<fieldset><legend>".lang(151)."</legend><div>",lang(152,"<code>".h($b->importServerPath()).(extension_loaded("zlib")?"[.gz]":"")."</code>"),' <input type="submit" name="webfile" value="'.lang(153).'">',"</div></fieldset>\n","<p>";}echo
|
|||
|
checkbox("error_stops",1,($_POST?$_POST["error_stops"]:isset($_GET["import"])),lang(154))."\n",checkbox("only_errors",1,($_POST?$_POST["only_errors"]:isset($_GET["import"])),lang(155))."\n","<input type='hidden' name='token' value='$ci'>\n";if(!isset($_GET["import"])&&$ud){print_fieldset("history",lang(156),$_GET["history"]!="");for($X=end($ud);$X;$X=prev($ud)){$y=key($ud);list($lg,$Sh,$oc)=$X;echo'<a href="'.h(ME."sql=&history=$y").'">'.lang(10)."</a>"." <span class='time' title='".@date('Y-m-d',$Sh)."'>".@date("H:i:s",$Sh)."</span>"." <code class='jush-$x'>".shorten_utf8(ltrim(str_replace("\n"," ",str_replace("\r","",preg_replace('~^(#|-- ).*~m','',$lg)))),80,"</code>").($oc?" <span class='time'>($oc)</span>":"")."<br>\n";}echo"<input type='submit' name='clear' value='".lang(157)."'>\n","<a href='".h(ME."sql=&history=all")."'>".lang(158)."</a>\n","</div></fieldset>\n";}echo'</form>
|
|||
|
';}elseif(isset($_GET["edit"])){$a=$_GET["edit"];$p=fields($a);$Z=(isset($_GET["select"])?($_POST["check"]&&count($_POST["check"])==1?where_check($_POST["check"][0],$p):""):where($_GET,$p));$yi=(isset($_GET["select"])?$_POST["edit"]:$Z);foreach($p
|
|||
|
as$C=>$o){if(!isset($o["privileges"][$yi?"update":"insert"])||$b->fieldName($o)=="")unset($p[$C]);}if($_POST&&!$n&&!isset($_GET["select"])){$A=$_POST["referer"];if($_POST["insert"])$A=($yi?null:$_SERVER["REQUEST_URI"]);elseif(!preg_match('~^.+&select=.+$~',$A))$A=ME."select=".urlencode($a);$w=indexes($a);$ti=unique_array($_GET["where"],$w);$og="\nWHERE $Z";if(isset($_POST["delete"]))queries_redirect($A,lang(159),$dc->delete($a,$og,!$ti));else{$N=array();foreach($p
|
|||
|
as$C=>$o){$X=process_input($o);if($X!==false&&$X!==null)$N[idf_escape($C)]=$X;}if($yi){if(!$N)redirect($A);queries_redirect($A,lang(160),$dc->update($a,$N,$og,!$ti));if(is_ajax()){page_headers();page_messages($n);exit;}}else{$H=$dc->insert($a,$N);$ke=($H?last_id():0);queries_redirect($A,lang(161,($ke?" $ke":"")),$H);}}}$J=null;if($_POST["save"])$J=(array)$_POST["fields"];elseif($Z){$L=array();foreach($p
|
|||
|
as$C=>$o){if(isset($o["privileges"]["select"])){$Ha=convert_field($o);if($_POST["clone"]&&$o["auto_increment"])$Ha="''";if($x=="sql"&&preg_match("~enum|set~",$o["type"]))$Ha="1*".idf_escape($C);$L[]=($Ha?"$Ha AS ":"").idf_escape($C);}}$J=array();if(!support("table"))$L=array("*");if($L){$H=$dc->select($a,$L,array($Z),$L,array(),(isset($_GET["select"])?2:1));if(!$H)$n=error();else{$J=$H->fetch_assoc();if(!$J)$J=false;}if(isset($_GET["select"])&&(!$J||$H->fetch_assoc()))$J=null;}}if(!support("table")&&!$p){if(!$Z){$H=$dc->select($a,array("*"),$Z,array("*"));$J=($H?$H->fetch_assoc():false);if(!$J)$J=array($dc->primary=>"");}if($J){foreach($J
|
|||
|
as$y=>$X){if(!$Z)$J[$y]=null;$p[$y]=array("field"=>$y,"null"=>($y!=$dc->primary),"auto_increment"=>($y==$dc->primary));}}}edit_form($a,$p,$J,$yi);}elseif(isset($_GET["create"])){$a=$_GET["create"];$If=array();foreach(array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST')as$y)$If[$y]=$y;$wg=referencable_primary($a);$cd=array();foreach($wg
|
|||
|
as$Dh=>$o)$cd[str_replace("`","``",$Dh)."`".str_replace("`","``",$o["field"])]=$Dh;$xf=array();$R=array();if($a!=""){$xf=fields($a);$R=table_status($a);if(!$R)$n=lang(9);}$J=$_POST;$J["fields"]=(array)$J["fields"];if($J["auto_increment_col"])$J["fields"][$J["auto_increment_col"]]["auto_increment"]=true;if($_POST&&!process_fields($J["fields"])&&!$n){if($_POST["drop"])queries_redirect(substr(ME,0,-1),lang(162),drop_tables(array($a)));else{$p=array();$Ea=array();$Ci=false;$ad=array();$wf=reset($xf);$Ba=" FIRST";foreach($J["fields"]as$y=>$o){$q=$cd[$o["type"]];$pi=($q!==null?$wg[$q]:$o);if($o["field"]!=""){if(!$o["has_default"])$o["default"]=null;if($y==$J["auto_increment_col"])$o["auto_increment"]=true;$hg=process_field($o,$pi);$Ea[]=array($o["orig"],$hg,$Ba);if($hg!=process_field($wf,$wf)){$p[]=array($o["orig"],$hg,$Ba);if($o["orig"]!=""||$Ba)$Ci=true;}if($q!==null)$ad[idf_escape($o["field"])]=($a!=""&&$x!="sqlite"?"ADD":" ").format_foreign_key(array('table'=>$cd[$o["type"]],'source'=>array($o["field"]),'target'=>array($pi["field"]),'on_delete'=>$o["on_delete"],));$Ba=" AFTER ".idf_escape($o["field"]);}elseif($o["orig"]!=""){$Ci=true;$p[]=array($o["orig"]);}if($o["orig"]!=""){$wf=next($xf);if(!$wf)$Ba="";}}$Kf="";if($If[$J["partition_by"]]){$Lf=array();if($J["partition_by"]=='RANGE'||$J["partition_by"]=='LIST'){foreach(array_filter($J["partition_names"])as$y=>$X){$Y=$J["partition_values"][$y];$Lf[]="\n PARTITION ".idf_escape($X)." VALUES ".($J["partition_by"]=='RANGE'?"LESS THAN":"IN").($Y!=""?" ($Y)":" MAXVALUE");}}$Kf.="\nPARTITION BY $J[partition_by]($J[partition])".($Lf?" (".implode(",",$Lf)."\n)":($J["partitions"]?" PARTITIONS ".(+$J["partitions"]):""));}elseif(support("partitioning")&&preg_match("~partitioned~",$R["Create_options"]))$Kf.="\nREMOVE PARTITIONING";$Ee=lang(163);if($a==""){cookie("adminer_engine",$J["Engine"]);$Ee=lang(164);}$C=trim($J["name"]);queries_redirect(ME.(support("table")?"table=":"select=").urlencode($C),$Ee,alter_table($a,$C,($x=="sqlite"&&($Ci||$ad)?$Ea:$p),$ad,($J["Comment"]!=$R["Comment"]?$J["Comment"]:null),($J["Engine"]&&$J["Engine"]!=$R["Engine"]?$J["Engine"]:""),($J["Collation"]&&$J["Collation"]!=$R["Collation"]?$J["Collation"]:""),($J["Auto_increment"]!=""?number($J["Auto_increment"]):""),$Kf));}}page_header(($a!=""?lang(42):lang(71)),$n,array("table"=>$a),h($a));if(!$_POST){$J=array("Engine"=>$_COOKIE["adminer_engine"],"fields"=>array(array("field"=>"","type"=>(isset($U["int"])?"int":(isset($U["integer"])?"integer":"")))),"partition_names"=>array(""),);if($a!=""){$J=$R;$J["name"]=$a;$J["fields"]=array();if(!$_GET["auto_increment"])$J["Auto_increment"]="";foreach($xf
|
|||
|
as$o){$o["has_default"]=isset($o["default"]);$J["fields"][]=$o;}if(support("partitioning")){$hd="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = ".q(DB)." AND TABLE_NAME = ".q($a);$H=$g->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $hd ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($J["partition_by"],$J["partitions"],$J["partition"])=$H->fetch_row();$Lf=get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $hd AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");$Lf[""]="";$J["partition_names"]=array_keys($Lf);$J["partition_values"]=array_values($Lf);}}}$qb=collations();$vc=engines();foreach($vc
|
|||
|
as$uc){if(!strcasecmp($uc,$J["Engine"])){$J["Engine"]=$uc;break;}}echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>
|
|||
|
';if(support("columns")||$a==""){echo
|
|||
|
lang(165),': <input name="name" maxlength="64" value="',h($J["name"]),'" autocapitalize="off">
|
|||
|
';if($a==""&&!$_POST)echo
|
|||
|
script("focus(qs('#form')['name']);");echo($vc?"<select name='Engine'>".optionlist(array(""=>"(".lang(166).")")+$vc,$J["Engine"])."</select>".on_help("getTarget(event).value",1).script("qsl('select').onchange = helpClose;"):""),' ',($qb&&!preg_match("~sqlite|mssql~",$x)?html_select("Collation",array(""=>"(".lang(94).")")+$qb,$J["Collation"]):""),' <input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if(support("columns")){echo'<table cellspacing="0" id="edit-fields" class="nowrap">
|
|||
|
';$wb=($_POST?$_POST["comments"]:$J["Comment"]!="");if(!$_POST&&!$wb){foreach($J["fields"]as$o){if($o["comment"]!=""){$wb=true;break;}}}edit_fields($J["fields"],$qb,"TABLE",$cd,$wb);echo'</table>
|
|||
|
<p>
|
|||
|
',lang(48),': <input type="number" name="Auto_increment" size="6" value="',h($J["Auto_increment"]),'">
|
|||
|
',checkbox("defaults",1,true,lang(167),"columnShow(this.checked, 5)","jsonly");if(!$_POST["defaults"])echo
|
|||
|
script("editingHideDefaults();");echo(support("comment")?"<label><input type='checkbox' name='comments' value='1' class='jsonly'".($wb?" checked":"").">".lang(47)."</label>".script("qsl('input').onclick = function () { columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus(); };").' <input name="Comment" id="Comment" value="'.h($J["Comment"]).'" maxlength="'.($g->server_info>=5.5?2048:60).'"'.($wb?'':' class="hidden"').'>':''),'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';}echo'
|
|||
|
';if($a!=""){echo'<input type="submit" name="drop" value="',lang(120),'">',confirm(lang(168,$a));}if(support("partitioning")){$Jf=preg_match('~RANGE|LIST~',$J["partition_by"]);print_fieldset("partition",lang(169),$J["partition_by"]);echo'<p>
|
|||
|
',"<select name='partition_by'>".optionlist(array(""=>"")+$If,$J["partition_by"])."</select>".on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')",1).script("qsl('select').onchange = partitionByChange;"),'(<input name="partition" value="',h($J["partition"]),'">)
|
|||
|
',lang(170),': <input type="number" name="partitions" class="size',($Jf||!$J["partition_by"]?" hidden":""),'" value="',h($J["partitions"]),'">
|
|||
|
<table cellspacing="0" id="partition-table"',($Jf?"":" class='hidden'"),'>
|
|||
|
<thead><tr><th>',lang(171),'<th>',lang(172),'</thead>
|
|||
|
';foreach($J["partition_names"]as$y=>$X){echo'<tr>','<td><input name="partition_names[]" value="'.h($X).'" autocapitalize="off">',($y==count($J["partition_names"])-1?script("qsl('input').oninput = partitionNameChange;"):''),'<td><input name="partition_values[]" value="'.h($J["partition_values"][$y]).'">';}echo'</table>
|
|||
|
</div></fieldset>
|
|||
|
';}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["indexes"])){$a=$_GET["indexes"];$Dd=array("PRIMARY","UNIQUE","INDEX");$R=table_status($a,true);$ch=$g->server_info;$id=($ch>=5.6);$nh=($ch>=5.7);if(preg_match('~([\d.]+)-MariaDB~',$ch,$B)){$ch=$B[1];$id=(version_compare($ch,'10.0.5')>=0);$nh=(version_compare($ch,'10.2.2')>=0);}if(preg_match('~MyISAM|M?aria'.($id?'|InnoDB':'').'~i',$R["Engine"]))$Dd[]="FULLTEXT";if(preg_match('~MyISAM|M?aria'.($nh?'|InnoDB':'').'~i',$R["Engine"]))$Dd[]="SPATIAL";$w=indexes($a);$ag=array();if($x=="mongo"){$ag=$w["_id_"];unset($Dd[0]);unset($w["_id_"]);}$J=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["drop_col"]){$c=array();foreach($J["indexes"]as$v){$C=$v["name"];if(in_array($v["type"],$Dd)){$e=array();$qe=array();$Wb=array();$N=array();ksort($v["columns"]);foreach($v["columns"]as$y=>$d){if($d!=""){$pe=$v["lengths"][$y];$Vb=$v["descs"][$y];$N[]=idf_escape($d).($pe?"(".(+$pe).")":"").($Vb?" DESC":"");$e[]=$d;$qe[]=($pe?$pe:null);$Wb[]=$Vb;}}if($e){$Dc=$w[$C];if($Dc){ksort($Dc["columns"]);ksort($Dc["lengths"]);ksort($Dc["descs"]);if($v["type"]==$Dc["type"]&&array_values($Dc["columns"])===$e&&(!$Dc["lengths"]||array_values($Dc["lengths"])===$qe)&&array_values($Dc["descs"])===$Wb){unset($w[$C]);continue;}}$c[]=array($v["type"],$C,$N);}}}foreach($w
|
|||
|
as$C=>$Dc)$c[]=array($Dc["type"],$C,"DROP");if(!$c)redirect(ME."table=".urlencode($a));queries_redirect(ME."table=".urlencode($a),lang(173),alter_indexes($a,$c));}page_header(lang(125),$n,array("table"=>$a),h($a));$p=array_keys(fields($a));if($_POST["add"]){foreach($J["indexes"]as$y=>$v){if($v["columns"][count($v["columns"])]!="")$J["indexes"][$y]["columns"][]="";}$v=end($J["indexes"]);if($v["type"]||array_filter($v["columns"],'strlen'))$J["indexes"][]=array("columns"=>array(1=>""));}if(!$J){foreach($w
|
|||
|
as$y=>$v){$w[$y]["name"]=$y;$w[$y]["columns"][]="";}$w[]=array("columns"=>array(1=>""));$J["indexes"]=$w;}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
<thead><tr>
|
|||
|
<th id="label-type">',lang(174),'<th><input type="submit" class="wayoff">',lang(175),'<th id="label-name">',lang(176);?>
|
|||
|
<th><noscript><input type='image' class='icon' name='add[0]' src='" . h(preg_replace("~\\?.*~", "", ME) . "?file=plus.gif&version=4.5.0") . "' alt='+' title='<?php echo
|
|||
|
lang(101),'\'></noscript>
|
|||
|
</thead>
|
|||
|
';if($ag){echo"<tr><td>PRIMARY<td>";foreach($ag["columns"]as$y=>$d){echo
|
|||
|
select_input(" disabled",$p,$d),"<label><input disabled type='checkbox'>".lang(56)."</label> ";}echo"<td><td>\n";}$Xd=1;foreach($J["indexes"]as$v){if(!$_POST["drop_col"]||$Xd!=key($_POST["drop_col"])){echo"<tr><td>".html_select("indexes[$Xd][type]",array(-1=>"")+$Dd,$v["type"],($Xd==count($J["indexes"])?"indexesAddRow.call(this);":1),"label-type"),"<td>";ksort($v["columns"]);$s=1;foreach($v["columns"]as$y=>$d){echo"<span>".select_input(" name='indexes[$Xd][columns][$s]' title='".lang(45)."'",($p?array_combine($p,$p):$p),$d,"partial(".($s==count($v["columns"])?"indexesAddColumn":"indexesChangeColumn").", '".js_escape($x=="sql"?"":$_GET["indexes"]."_")."')"),($x=="sql"||$x=="mssql"?"<input type='number' name='indexes[$Xd][lengths][$s]' class='size' value='".h($v["lengths"][$y])."' title='".lang(99)."'>":""),($x!="sql"?checkbox("indexes[$Xd][descs][$s]",1,$v["descs"][$y],lang(56)):"")," </span>";$s++;}echo"<td><input name='indexes[$Xd][name]' value='".h($v["name"])."' autocapitalize='off' aria-labelledby='label-name'>\n","<td><input type='image' class='icon' name='drop_col[$Xd]' src='".h(preg_replace("~\\?.*~","",ME)."?file=cross.gif&version=4.5.0")."' alt='x' title='".lang(104)."'>".script("qsl('input').onclick = partial(editingRemoveRow, 'indexes\$1[type]');");}$Xd++;}echo'</table>
|
|||
|
<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["database"])){$J=$_POST;if($_POST&&!$n&&!isset($_POST["add_x"])){$C=trim($J["name"]);if($_POST["drop"]){$_GET["db"]="";queries_redirect(remove_from_uri("db|database"),lang(177),drop_databases(array(DB)));}elseif(DB!==$C){if(DB!=""){$_GET["db"]=$C;queries_redirect(preg_replace('~\bdb=[^&]*&~','',ME)."db=".urlencode($C),lang(178),rename_database($C,$J["collation"]));}else{$l=explode("\n",str_replace("\r","",$C));$yh=true;$je="";foreach($l
|
|||
|
as$m){if(count($l)==1||$m!=""){if(!create_database($m,$J["collation"]))$yh=false;$je=$m;}}restart_session();set_session("dbs",null);queries_redirect(ME."db=".urlencode($je),lang(179),$yh);}}else{if(!$J["collation"])redirect(substr(ME,0,-1));query_redirect("ALTER DATABASE ".idf_escape($C).(preg_match('~^[a-z0-9_]+$~i',$J["collation"])?" COLLATE $J[collation]":""),substr(ME,0,-1),lang(180));}}page_header(DB!=""?lang(64):lang(108),$n,array(),h(DB));$qb=collations();$C=DB;if($_POST)$C=$J["name"];elseif(DB!="")$J["collation"]=db_collation(DB,$qb);elseif($x=="sql"){foreach(get_vals("SHOW GRANTS")as$kd){if(preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~',$kd,$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".($qb?html_select("collation",array(""=>"(".lang(94).")")+$qb,$J["collation"]).doc_link(array('sql'=>"charset-charsets.html",'mssql'=>"ms187963.aspx",)):""),script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
|
|||
|
';if(DB!="")echo"<input type='submit' name='drop' value='".lang(120)."'>".confirm(lang(168,DB))."\n";elseif(!$_POST["add_x"]&&$_GET["db"]=="")echo"<input type='image' class='icon' name='add' src='".h(preg_replace("~\\?.*~","",ME)."?file=plus.gif&version=4.5.0")."' alt='+' title='".lang(101)."'>\n";echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["scheme"])){$J=$_POST;if($_POST&&!$n){$_=preg_replace('~ns=[^&]*&~','',ME)."ns=";if($_POST["drop"])query_redirect("DROP SCHEMA ".idf_escape($_GET["ns"]),$_,lang(181));else{$C=trim($J["name"]);$_.=urlencode($C);if($_GET["ns"]=="")query_redirect("CREATE SCHEMA ".idf_escape($C),$_,lang(182));elseif($_GET["ns"]!=$C)query_redirect("ALTER SCHEMA ".idf_escape($_GET["ns"])." RENAME TO ".idf_escape($C),$_,lang(183));else
|
|||
|
redirect($_);}}page_header($_GET["ns"]!=""?lang(65):lang(66),$n);if(!$J)$J["name"]=$_GET["ns"];echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" id="name" value="',h($J["name"]),'" autocapitalize="off">
|
|||
|
',script("focus(qs('#name'));"),'<input type="submit" value="',lang(14),'">
|
|||
|
';if($_GET["ns"]!="")echo"<input type='submit' name='drop' value='".lang(120)."'>".confirm(lang(168,$_GET["ns"]))."\n";echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["call"])){$da=$_GET["call"];page_header(lang(184).": ".h($da),$n);$Lg=routine($da,(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Bd=array();$Af=array();foreach($Lg["fields"]as$s=>$o){if(substr($o["inout"],-3)=="OUT")$Af[$s]="@".idf_escape($o["field"])." AS ".idf_escape($o["field"]);if(!$o["inout"]||substr($o["inout"],0,2)=="IN")$Bd[]=$s;}if(!$n&&$_POST){$ab=array();foreach($Lg["fields"]as$y=>$o){if(in_array($y,$Bd)){$X=process_input($o);if($X===false)$X="''";if(isset($Af[$y]))$g->query("SET @".idf_escape($o["field"])." = $X");}$ab[]=(isset($Af[$y])?"@".idf_escape($o["field"]):$X);}$G=(isset($_GET["callf"])?"SELECT":"CALL")." ".table($da)."(".implode(", ",$ab).")";echo"<p><code class='jush-$x'>".h($G)."</code> <a href='".h(ME)."sql=".urlencode($G)."'>".lang(10)."</a>\n";if(!$g->multi_query($G))echo"<p class='error'>".error()."\n";else{$h=connect();if(is_object($h))$h->select_db(DB);do{$H=$g->store_result();if(is_object($H))select($H,$h);else
|
|||
|
echo"<p class='message'>".lang(185,$g->affected_rows)."\n";}while($g->next_result());if($Af)select($g->query("SELECT ".implode(", ",$Af)));}}echo'
|
|||
|
<form action="" method="post">
|
|||
|
';if($Bd){echo"<table cellspacing='0'>\n";foreach($Bd
|
|||
|
as$y){$o=$Lg["fields"][$y];$C=$o["field"];echo"<tr><th>".$b->fieldName($o);$Y=$_POST["fields"][$C];if($Y!=""){if($o["type"]=="enum")$Y=+$Y;if($o["type"]=="set")$Y=array_sum($Y);}input($o,$Y,(string)$_POST["function"][$C]);echo"\n";}echo"</table>\n";}echo'<p>
|
|||
|
<input type="submit" value="',lang(184),'">
|
|||
|
<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["foreign"])){$a=$_GET["foreign"];$C=$_GET["name"];$J=$_POST;if($_POST&&!$n&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){$Ee=($_POST["drop"]?lang(186):($C!=""?lang(187):lang(188)));$A=ME."table=".urlencode($a);if(!$_POST["drop"]){$J["source"]=array_filter($J["source"],'strlen');ksort($J["source"]);$Lh=array();foreach($J["source"]as$y=>$X)$Lh[$y]=$J["target"][$y];$J["target"]=$Lh;}if($x=="sqlite")queries_redirect($A,$Ee,recreate_table($a,$a,array(),array(),array(" $C"=>($_POST["drop"]?"":" ".format_foreign_key($J)))));else{$c="ALTER TABLE ".table($a);$fc="\nDROP ".($x=="sql"?"FOREIGN KEY ":"CONSTRAINT ").idf_escape($C);if($_POST["drop"])query_redirect($c.$fc,$A,$Ee);else{query_redirect($c.($C!=""?"$fc,":"")."\nADD".format_foreign_key($J),$A,$Ee);$n=lang(189)."<br>$n";}}}page_header(lang(190),$n,array("table"=>$a),h($a));if($_POST){ksort($J["source"]);if($_POST["add"])$J["source"][]="";elseif($_POST["change"]||$_POST["change-js"])$J["target"]=array();}elseif($C!=""){$cd=foreign_keys($a);$J=$cd[$C];$J["source"][]="";}else{$J["table"]=$a;$J["source"]=array("");}$lh=array_keys(fields($a));$Lh=($a===$J["table"]?$lh:array_keys(fields($J["table"])));$vg=array_keys(array_filter(table_status('',true),'fk_support'));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
';if($J["db"]==""&&$J["ns"]==""){echo
|
|||
|
lang(191),':
|
|||
|
',html_select("table",$vg,$J["table"],"this.form['change-js'].value = '1'; this.form.submit();"),'<input type="hidden" name="change-js" value="">
|
|||
|
<noscript><p><input type="submit" name="change" value="',lang(192),'"></noscript>
|
|||
|
<table cellspacing="0">
|
|||
|
<thead><tr><th id="label-source">',lang(127),'<th id="label-target">',lang(128),'</thead>
|
|||
|
';$Xd=0;foreach($J["source"]as$y=>$X){echo"<tr>","<td>".html_select("source[".(+$y)."]",array(-1=>"")+$lh,$X,($Xd==count($J["source"])-1?"foreignAddRow.call(this);":1),"label-source"),"<td>".html_select("target[".(+$y)."]",$Lh,$J["target"][$y],1,"label-target");$Xd++;}echo'</table>
|
|||
|
<p>
|
|||
|
',lang(96),': ',html_select("on_delete",array(-1=>"")+explode("|",$hf),$J["on_delete"]),' ',lang(95),': ',html_select("on_update",array(-1=>"")+explode("|",$hf),$J["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(193),'"></noscript>
|
|||
|
';}if($C!=""){echo'<input type="submit" name="drop" value="',lang(120),'">',confirm(lang(168,$C));}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["view"])){$a=$_GET["view"];$J=$_POST;$yf="VIEW";if($x=="pgsql"&&$a!=""){$O=table_status($a);$yf=strtoupper($O["Engine"]);}if($_POST&&!$n){$C=trim($J["name"]);$Ha=" AS\n$J[select]";$A=ME."table=".urlencode($C);$Ee=lang(194);$T=($_POST["materialized"]?"MATERIALIZED VIEW":"VIEW");if(!$_POST["drop"]&&$a==$C&&$x!="sqlite"&&$T=="VIEW"&&$yf=="VIEW")query_redirect(($x=="mssql"?"ALTER":"CREATE OR REPLACE")." VIEW ".table($C).$Ha,$A,$Ee);else{$Nh=$C."_adminer_".uniqid();drop_create("DROP $yf ".table($a),"CREATE $T ".table($C).$Ha,"DROP $T ".table($C),"CREATE $T ".table($Nh).$Ha,"DROP $T ".table($Nh),($_POST["drop"]?substr(ME,0,-1):$A),lang(195),$Ee,lang(196),$a,$C);}}if(!$_POST&&$a!=""){$J=view($a);$J["name"]=$a;$J["materialized"]=($yf!="VIEW");if(!$n)$n=error();}page_header(($a!=""?lang(41):lang(197)),$n,array("table"=>$a),h($a));echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>',lang(176),': <input name="name" value="',h($J["name"]),'" maxlength="64" autocapitalize="off">
|
|||
|
',(support("materializedview")?" ".checkbox("materialized",1,$J["materialized"],lang(122)):""),'<p>';textarea("select",$J["select"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($a!=""){echo'<input type="submit" name="drop" value="',lang(120),'">',confirm(lang(168,$a));}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["event"])){$aa=$_GET["event"];$Od=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$uh=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");$J=$_POST;if($_POST&&!$n){if($_POST["drop"])query_redirect("DROP EVENT ".idf_escape($aa),substr(ME,0,-1),lang(198));elseif(in_array($J["INTERVAL_FIELD"],$Od)&&isset($uh[$J["STATUS"]])){$Qg="\nON SCHEDULE ".($J["INTERVAL_VALUE"]?"EVERY ".q($J["INTERVAL_VALUE"])." $J[INTERVAL_FIELD]".($J["STARTS"]?" STARTS ".q($J["STARTS"]):"").($J["ENDS"]?" ENDS ".q($J["ENDS"]):""):"AT ".q($J["STARTS"]))." ON COMPLETION".($J["ON_COMPLETION"]?"":" NOT")." PRESERVE";queries_redirect(substr(ME,0,-1),($aa!=""?lang(199):lang(200)),queries(($aa!=""?"ALTER EVENT ".idf_escape($aa).$Qg.($aa!=$J["EVENT_NAME"]?"\nRENAME TO ".idf_escape($J["EVENT_NAME"]):""):"CREATE EVENT ".idf_escape($J["EVENT_NAME"]).$Qg)."\n".$uh[$J["STATUS"]]." COMMENT ".q($J["EVENT_COMMENT"]).rtrim(" DO\n$J[EVENT_DEFINITION]",";").";"));}}page_header(($aa!=""?lang(201).": ".h($aa):lang(202)),$n);if(!$J&&$aa!=""){$K=get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = ".q(DB)." AND EVENT_NAME = ".q($aa));$J=reset($K);}echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(176),'<td><input name="EVENT_NAME" value="',h($J["EVENT_NAME"]),'" maxlength="64" autocapitalize="off">
|
|||
|
<tr><th title="datetime">',lang(203),'<td><input name="STARTS" value="',h("$J[EXECUTE_AT]$J[STARTS]"),'">
|
|||
|
<tr><th title="datetime">',lang(204),'<td><input name="ENDS" value="',h($J["ENDS"]),'">
|
|||
|
<tr><th>',lang(205),'<td><input type="number" name="INTERVAL_VALUE" value="',h($J["INTERVAL_VALUE"]),'" class="size"> ',html_select("INTERVAL_FIELD",$Od,$J["INTERVAL_FIELD"]),'<tr><th>',lang(111),'<td>',html_select("STATUS",$uh,$J["STATUS"]),'<tr><th>',lang(47),'<td><input name="EVENT_COMMENT" value="',h($J["EVENT_COMMENT"]),'" maxlength="64">
|
|||
|
<tr><th> <td>',checkbox("ON_COMPLETION","PRESERVE",$J["ON_COMPLETION"]=="PRESERVE",lang(206)),'</table>
|
|||
|
<p>';textarea("EVENT_DEFINITION",$J["EVENT_DEFINITION"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($aa!=""){echo'<input type="submit" name="drop" value="',lang(120),'">',confirm(lang(168,$aa));}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["procedure"])){$da=$_GET["procedure"];$Lg=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$J=$_POST;$J["fields"]=(array)$J["fields"];if($_POST&&!process_fields($J["fields"])&&!$n){$Nh="$J[name]_adminer_".uniqid();drop_create("DROP $Lg ".idf_escape($da),create_routine($Lg,$J),"DROP $Lg ".idf_escape($J["name"]),create_routine($Lg,array("name"=>$Nh)+$J),"DROP $Lg ".idf_escape($Nh),substr(ME,0,-1),lang(207),lang(208),lang(209),$da,$J["name"]);}page_header(($da!=""?(isset($_GET["function"])?lang(210):lang(211)).": ".h($da):(isset($_GET["function"])?lang(212):lang(213))),$n);if(!$_POST&&$da!=""){$J=routine($da,$Lg);$J["name"]=$da;}$qb=get_vals("SHOW CHARACTER SET");sort($qb);$Mg=routine_languages();echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<p>',lang(176),': <input name="name" value="',h($J["name"]),'" maxlength="64" autocapitalize="off">
|
|||
|
',($Mg?lang(19).": ".html_select("language",$Mg,$J["language"]):""),'<input type="submit" value="',lang(14),'">
|
|||
|
<table cellspacing="0" class="nowrap">
|
|||
|
';edit_fields($J["fields"],$qb,$Lg);if(isset($_GET["function"])){echo"<tr><td>".lang(214);edit_type("returns",$J["returns"],$qb);}echo'</table>
|
|||
|
<p>';textarea("definition",$J["definition"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($da!=""){echo'<input type="submit" name="drop" value="',lang(120),'">',confirm(lang(168,$da));}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["sequence"])){$fa=$_GET["sequence"];$J=$_POST;if($_POST&&!$n){$_=substr(ME,0,-1);$C=trim($J["name"]);if($_POST["drop"])query_redirect("DROP SEQUENCE ".idf_escape($fa),$_,lang(215));elseif($fa=="")query_redirect("CREATE SEQUENCE ".idf_escape($C),$_,lang(216));elseif($fa!=$C)query_redirect("ALTER SEQUENCE ".idf_escape($fa)." RENAME TO ".idf_escape($C),$_,lang(217));else
|
|||
|
redirect($_);}page_header($fa!=""?lang(218).": ".h($fa):lang(219),$n);if(!$J)$J["name"]=$fa;echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p><input name="name" value="',h($J["name"]),'" autocapitalize="off">
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($fa!="")echo"<input type='submit' name='drop' value='".lang(120)."'>".confirm(lang(168,$fa))."\n";echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["type"])){$ga=$_GET["type"];$J=$_POST;if($_POST&&!$n){$_=substr(ME,0,-1);if($_POST["drop"])query_redirect("DROP TYPE ".idf_escape($ga),$_,lang(220));else
|
|||
|
query_redirect("CREATE TYPE ".idf_escape(trim($J["name"]))." $J[as]",$_,lang(221));}page_header($ga!=""?lang(222).": ".h($ga):lang(223),$n);if(!$J)$J["as"]="AS ";echo'
|
|||
|
<form action="" method="post">
|
|||
|
<p>
|
|||
|
';if($ga!="")echo"<input type='submit' name='drop' value='".lang(120)."'>".confirm(lang(168,$ga))."\n";else{echo"<input name='name' value='".h($J['name'])."' autocapitalize='off'>\n";textarea("as",$J["as"]);echo"<p><input type='submit' value='".lang(14)."'>\n";}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["trigger"])){$a=$_GET["trigger"];$C=$_GET["name"];$ni=trigger_options();$J=(array)trigger($C)+array("Trigger"=>$a."_bi");if($_POST){if(!$n&&in_array($_POST["Timing"],$ni["Timing"])&&in_array($_POST["Event"],$ni["Event"])&&in_array($_POST["Type"],$ni["Type"])){$gf=" ON ".table($a);$fc="DROP TRIGGER ".idf_escape($C).($x=="pgsql"?$gf:"");$A=ME."table=".urlencode($a);if($_POST["drop"])query_redirect($fc,$A,lang(224));else{if($C!="")queries($fc);queries_redirect($A,($C!=""?lang(225):lang(226)),queries(create_trigger($gf,$_POST)));if($C!="")queries(create_trigger($gf,$J+array("Type"=>reset($ni["Type"]))));}}$J=$_POST;}page_header(($C!=""?lang(227).": ".h($C):lang(228)),$n,array("table"=>$a));echo'
|
|||
|
<form action="" method="post" id="form">
|
|||
|
<table cellspacing="0">
|
|||
|
<tr><th>',lang(229),'<td>',html_select("Timing",$ni["Timing"],$J["Timing"],"triggerChange(/^".preg_quote($a,"/")."_[ba][iud]$/, '".js_escape($a)."', this.form);"),'<tr><th>',lang(230),'<td>',html_select("Event",$ni["Event"],$J["Event"],"this.form['Timing'].onchange();"),(in_array("UPDATE OF",$ni["Event"])?" <input name='Of' value='".h($J["Of"])."' class='hidden'>":""),'<tr><th>',lang(46),'<td>',html_select("Type",$ni["Type"],$J["Type"]),'</table>
|
|||
|
<p>',lang(176),': <input name="Trigger" value="',h($J["Trigger"]),'" maxlength="64" autocapitalize="off">
|
|||
|
',script("qs('#form')['Timing'].onchange();"),'<p>';textarea("Statement",$J["Statement"]);echo'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if($C!=""){echo'<input type="submit" name="drop" value="',lang(120),'">',confirm(lang(168,$C));}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["user"])){$ha=$_GET["user"];$fg=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$J){foreach(explode(",",($J["Privilege"]=="Grant option"?"":$J["Context"]))as$Bb)$fg[$Bb][$J["Privilege"]]=$J["Comment"];}$fg["Server Admin"]+=$fg["File access on server"];$fg["Databases"]["Create routine"]=$fg["Procedures"]["Create routine"];unset($fg["Procedures"]["Create routine"]);$fg["Columns"]=array();foreach(array("Select","Insert","Update","References")as$X)$fg["Columns"][$X]=$fg["Tables"][$X];unset($fg["Server Admin"]["Usage"]);foreach($fg["Tables"]as$y=>$X)unset($fg["Databases"][$y]);$Re=array();if($_POST){foreach($_POST["objects"]as$y=>$X)$Re[$X]=(array)$Re[$X]+(array)$_POST["grants"][$y];}$ld=array();$ef="";if(isset($_GET["host"])&&($H=$g->query("SHOW GRANTS FOR ".q($ha)."@".q($_GET["host"])))){while($J=$H->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$J[0],$B)&&preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~',$B[1],$xe,PREG_SET_ORDER)){foreach($xe
|
|||
|
as$X){if($X[1]!="USAGE")$ld["$B[2]$X[2]"][$X[1]]=true;if(preg_match('~ WITH GRANT OPTION~',$J[0]))$ld["$B[2]$X[2]"]["GRANT OPTION"]=true;}}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$J[0],$B))$ef=$B[1];}}if($_POST&&!$n){$ff=(isset($_GET["host"])?q($ha)."@".q($_GET["host"]):"''");if($_POST["drop"])query_redirect("DROP USER $ff",ME."privileges=",lang(231));else{$Te=q($_POST["user"])."@".q($_POST["host"]);$Nf=$_POST["pass"];if($Nf!=''&&!$_POST["hashed"]){$Nf=$g->result("SELECT PASSWORD(".q($Nf).")");$n=!$Nf;}$Gb=false;if(!$n){if($ff!=$Te){$Gb=queries(($g->server_info<5?"GRANT USAGE ON *.* TO":"CREATE USER")." $Te IDENTIFIED BY PASSWORD ".q($Nf));$n=!$Gb;}elseif($Nf!=$ef)queries("SET PASSWORD FOR $Te = ".q($Nf));}if(!$n){$Ig=array();foreach($Re
|
|||
|
as$Ze=>$kd){if(isset($_GET["grant"]))$kd=array_filter($kd);$kd=array_keys($kd);if(isset($_GET["grant"]))$Ig=array_diff(array_keys(array_filter($Re[$Ze],'strlen')),$kd);elseif($ff==$Te){$cf=array_keys((array)$ld[$Ze]);$Ig=array_diff($cf,$kd);$kd=array_diff($kd,$cf);unset($ld[$Ze]);}if(preg_match('~^(.+)\\s*(\\(.*\\))?$~U',$Ze,$B)&&(!grant("REVOKE",$Ig,$B[2]," ON $B[1] FROM $Te")||!grant("GRANT",$kd,$B[2]," ON $B[1] TO $Te"))){$n=true;break;}}}if(!$n&&isset($_GET["host"])){if($ff!=$Te)queries("DROP USER $ff");elseif(!isset($_GET["grant"])){foreach($ld
|
|||
|
as$Ze=>$Ig){if(preg_match('~^(.+)(\\(.*\\))?$~U',$Ze,$B))grant("REVOKE",array_keys($Ig),$B[2]," ON $B[1] FROM $Te");}}}queries_redirect(ME."privileges=",(isset($_GET["host"])?lang(232):lang(233)),!$n);if($Gb)$g->query("DROP USER $Te");}}page_header((isset($_GET["host"])?lang(33).": ".h("$ha@$_GET[host]"):lang(139)),$n,array("privileges"=>array('',lang(68))));if($_POST){$J=$_POST;$ld=$Re;}else{$J=$_GET+array("host"=>$g->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));$J["pass"]=$ef;if($ef!="")$J["hashed"]=true;$ld[(DB==""||$ld?"":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($J["host"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(33),'<td><input name="user" maxlength="16" value="',h($J["user"]),'" autocapitalize="off">
|
|||
|
<tr><th>',lang(34),'<td><input name="pass" id="pass" value="',h($J["pass"]),'">
|
|||
|
';if(!$J["hashed"])echo
|
|||
|
script("typePassword(qs('#pass'));");echo
|
|||
|
checkbox("hashed",1,$J["hashed"],lang(234),"typePassword(this.form['pass'], this.checked);"),'</table>
|
|||
|
|
|||
|
';echo"<table cellspacing='0'>\n","<thead><tr><th colspan='2'>".lang(68).doc_link(array('sql'=>"grant.html#priv_level"));$s=0;foreach($ld
|
|||
|
as$Ze=>$kd){echo'<th>'.($Ze!="*.*"?"<input name='objects[$s]' value='".h($Ze)."' size='10' autocapitalize='off'>":"<input type='hidden' name='objects[$s]' value='*.*' size='10'>*.*");$s++;}echo"</thead>\n";foreach(array(""=>"","Server Admin"=>lang(32),"Databases"=>lang(35),"Tables"=>lang(124),"Columns"=>lang(45),"Procedures"=>lang(235),)as$Bb=>$Vb){foreach((array)$fg[$Bb]as$eg=>$vb){echo"<tr".odd()."><td".($Vb?">$Vb<td":" colspan='2'").' lang="en" title="'.h($vb).'">'.h($eg);$s=0;foreach($ld
|
|||
|
as$Ze=>$kd){$C="'grants[$s][".h(strtoupper($eg))."]'";$Y=$kd[strtoupper($eg)];if($Bb=="Server Admin"&&$Ze!=(isset($ld["*.*"])?"*.*":".*"))echo"<td> ";elseif(isset($_GET["grant"]))echo"<td><select name=$C><option><option value='1'".($Y?" selected":"").">".lang(236)."<option value='0'".($Y=="0"?" selected":"").">".lang(237)."</select>";else{echo"<td align='center'><label class='block'>","<input type='checkbox' name=$C value='1'".($Y?" checked":"").($eg=="All privileges"?" id='grants-$s-all'>":">".($eg=="Grant option"?"":script("qsl('input').onclick = function () { if (this.checked) formUncheck('grants-$s-all'); };"))),"</label>";}$s++;}}}echo"</table>\n",'<p>
|
|||
|
<input type="submit" value="',lang(14),'">
|
|||
|
';if(isset($_GET["host"])){echo'<input type="submit" name="drop" value="',lang(120),'">',confirm(lang(168,"$ha@$_GET[host]"));}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["processlist"])){if(support("kill")&&$_POST&&!$n){$ee=0;foreach((array)$_POST["kill"]as$X){if(kill_process($X))$ee++;}queries_redirect(ME."processlist=",lang(238,$ee),$ee||!$_POST["kill"]);}page_header(lang(109),$n);echo'
|
|||
|
<form action="" method="post">
|
|||
|
<table cellspacing="0" class="nowrap checkable">
|
|||
|
',script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});");$s=-1;foreach(process_list()as$s=>$J){if(!$s){echo"<thead><tr lang='en'>".(support("kill")?"<th> ":"");foreach($J
|
|||
|
as$y=>$X)echo"<th>$y".doc_link(array('sql'=>"show-processlist.html#processlist_".strtolower($y),'pgsql'=>"monitoring-stats.html#PG-STAT-ACTIVITY-VIEW",'oracle'=>"../b14237/dynviews_2088.htm",));echo"</thead>\n";}echo"<tr".odd().">".(support("kill")?"<td>".checkbox("kill[]",$J[$x=="sql"?"Id":"pid"],0):"");foreach($J
|
|||
|
as$y=>$X)echo"<td>".(($x=="sql"&&$y=="Info"&&preg_match("~Query|Killed~",$J["Command"])&&$X!="")||($x=="pgsql"&&$y=="current_query"&&$X!="<IDLE>")||($x=="oracle"&&$y=="sql_text"&&$X!="")?"<code class='jush-$x'>".shorten_utf8($X,100,"</code>").' <a href="'.h(ME.($J["db"]!=""?"db=".urlencode($J["db"])."&":"")."sql=".urlencode($X)).'">'.lang(239).'</a>':nbsp($X));echo"\n";}echo'</table>
|
|||
|
',script("tableCheck();"),'<p>
|
|||
|
';if(support("kill")){echo($s+1)."/".lang(240,max_connections()),"<p><input type='submit' value='".lang(241)."'>\n";}echo'<input type="hidden" name="token" value="',$ci,'">
|
|||
|
</form>
|
|||
|
';}elseif(isset($_GET["select"])){$a=$_GET["select"];$R=table_status1($a);$w=indexes($a);$p=fields($a);$cd=column_foreign_keys($a);$bf="";if($R["Oid"]){$bf=($x=="sqlite"?"rowid":"oid");$w[]=array("type"=>"PRIMARY","columns"=>array($bf));}parse_str($_COOKIE["adminer_import"],$za);$Jg=array();$e=array();$Rh=null;foreach($p
|
|||
|
as$y=>$o){$C=$b->fieldName($o);if(isset($o["privileges"]["select"])&&$C!=""){$e[$y]=html_entity_decode(strip_tags($C),ENT_QUOTES);if(is_shortable($o))$Rh=$b->selectLengthProcess();}$Jg+=$o["privileges"];}list($L,$md)=$b->selectColumnsProcess($e,$w);$Sd=count($md)<count($L);$Z=$b->selectSearchProcess($p,$w);$rf=$b->selectOrderProcess($p,$w);$z=$b->selectLimitProcess();$hd=($L?implode(", ",$L):"*".($bf?", $bf":"")).convert_fields($e,$p,$L)."\nFROM ".table($a);$nd=($md&&$Sd?"\nGROUP BY ".implode(", ",$md):"").($rf?"\nORDER BY ".implode(", ",$rf):"");if($_GET["val"]&&is_ajax()){header("Content-Type: text/plain; charset=utf-8");foreach($_GET["val"]as$ui=>$J){$Ha=convert_field($p[key($J)]);$L=array($Ha?$Ha:idf_escape(key($J)));$Z[]=where_check($ui,$p);$I=$dc->select($a,$L,$Z,$L);if($I)echo
|
|||
|
reset($I->fetch_row());}exit;}if($_POST&&!$n){$Ui=$Z;if(!$_POST["all"]&&is_array($_POST["check"])){$gb=array();foreach($_POST["check"]as$db)$gb[]=where_check($db,$p);$Ui[]="((".implode(") OR (",$gb)."))";}$Ui=($Ui?"\nWHERE ".implode(" AND ",$Ui):"");$ag=$wi=null;foreach($w
|
|||
|
as$v){if($v["type"]=="PRIMARY"){$ag=array_flip($v["columns"]);$wi=($L?$ag:array());break;}}foreach((array)$wi
|
|||
|
as$y=>$X){if(in_array(idf_escape($y),$L))unset($wi[$y]);}if($_POST["export"]){cookie("adminer_import","output=".urlencode($_POST["output"])."&format=".urlencode($_POST["format"]));dump_headers($a);$b->dumpTable($a,"");if(!is_array($_POST["check"])||$wi===array())$G="SELECT $hd$Ui$nd";else{$si=array();foreach($_POST["check"]as$X)$si[]="(SELECT".limit($hd,"\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$p).$nd,1).")";$G=implode(" UNION ALL ",$si);}$b->dumpData($a,"table",$G);exit;}if(!$b->selectEmailProcess($Z,$cd)){if($_POST["save"]||$_POST["delete"]){$H=true;$_a=0;$N=array();if(!$_POST["delete"]){foreach($e
|
|||
|
as$C=>$X){$X=process_input($p[$C]);if($X!==null&&($_POST["clone"]||$X!==false))$N[idf_escape($C)]=($X!==false?$X:idf_escape($C));}}if($_POST["delete"]||$N){if($_POST["clone"])$G="INTO ".table($a)." (".implode(", ",array_keys($N)).")\nSELECT ".implode(", ",$N)."\nFROM ".table($a);if($_POST["all"]||($wi===array()&&is_array($_POST["check"]))||$Sd){$H=($_POST["delete"]?$dc->delete($a,$Ui):($_POST["clone"]?queries("INSERT $G$Ui"):$dc->update($a,$N,$Ui)));$_a=$g->affected_rows;}else{foreach((array)$_POST["check"]as$X){$Qi="\nWHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($X,$p);$H=($_POST["delete"]?$dc->delete($a,$Qi,1):($_POST["clone"]?queries("INSERT".limit1($G,$Qi)):$dc->update($a,$N,$Qi)));if(!$H)break;$_a+=$g->affected_rows;}}}$Ee=lang(242,$_a);if($_POST["clone"]&&$H&&$_a==1){$ke=last_id();if($ke)$Ee=lang(161," $ke");}queries_redirect(remove_from_uri($_POST["all"]&&$_POST["delete"]?"page":""),$Ee,$H);if(!$_POST["delete"]){edit_form($a,$p,(array)$_POST["fields"],!$_POST["clone"]);page_footer();exit;}}elseif(!$_POST["import"]){if(!$_POST["val"])$n=lang(243);else{$H=true;$_a=0;foreach($_POST["val"]as$ui=>$J){$N=array();foreach($J
|
|||
|
as$y=>$X){$y=bracket_escape($y,1);$N[idf_escape($y)]=(preg_match('~char|text~',$p[$y]["type"])||$X!=""?$b->processInput($p[$y],$X):"NULL");}$H=$dc->update($a,$N," WHERE ".($Z?implode(" AND ",$Z)." AND ":"").where_check($ui,$p),!($Sd||$wi===array())," ");if(!$H)break;$_a+=$g->affected_rows;}queries_redirect(remove_from_uri(),lang(242,$_a),$H);}}elseif(!is_string($Sc=get_file("csv_file",true)))$n=upload_error($Sc);elseif(!preg_match('~~u',$Sc))$n=lang(244);else{cookie("adminer_import","output=".urlencode($za["output"])."&format=".urlencode($_POST["separator"]));$H=true;$sb=array_keys($p);preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~',$Sc,$xe);$_a=count($xe[0]);$dc->begin();$Zg=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));$K=array();foreach($xe[0]as$y=>$X){preg_match_all("~((?>\"[^\"]*\")+|[^$Zg]*)$Zg~",$X.$Zg,$ye);if(!$y&&!array_diff($ye[1],$sb)){$sb=$ye[1];$_a--;}else{$N=array();foreach($ye[1]as$s=>$nb)$N[idf_escape($sb[$s])]=($nb==""&&$p[$sb[$s]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$nb))));$K[]=$N;}}$H=(!$K||$dc->insertUpdate($a,$K,$ag));if($H)$H=$dc->commit();queries_redirect(remove_from_uri("page"),lang(245,$_a),$H);$dc->rollback();}}}$Dh=$b->tableName($R);if(is_ajax()){page_headers();ob_start();}else
|
|||
|
page_header(lang(50).": $Dh",$n);$N=null;if(isset($Jg["insert"])||!support("table")){$N="";foreach((array)$_GET["where"]as$X){if($cd[$X["col"]]&&count($cd[$X["col"]])==1&&($X["op"]=="="||(!$X["op"]&&!preg_match('~[_%]~',$X["val"]))))$N.="&set".urlencode("[".bracket_escape($X["col"])."]")."=".urlencode($X["val"]);}}$b->selectLinks($R,$N);if(!$e&&support("table"))echo"<p class='error'>".lang(246).($p?".":": ".error())."\n";else{echo"<form action='' id='form'>\n","<div style='display: none;'>";hidden_fields_get();echo(DB!=""?'<input type="hidden" name="db" value="'.h(DB).'">'.(isset($_GET["ns"])?'<input type="hidden" name="ns" value="'.h($_GET["ns"]).'">':""):"");echo'<input type="hidden" name="select" value="'.h($a).'">',"</div>\n";$b->selectColumnsPrint($L,$e);$b->selectSearchPrint($Z,$e,$w);$b->selectOrderPrint($rf,$e,$w);$b->selectLimitPrint($z);$b->selectLengthPrint($Rh);$b->selectActionPrint($w);echo"</form>\n";$E=$_GET["page"];if($E=="last"){$fd=$g->result(count_rows($a,$Z,$Sd,$md));$E=floor(max(0,$fd-1)/$z);}$Vg=$L;if(!$Vg){$Vg[]="*";if($bf)$Vg[]=$bf;}$Cb=convert_fields($e,$p,$L);if($Cb)$Vg[]=substr($Cb,2);$H=$dc->select($a,$Vg,$Z,$md,$rf,$z,$E,true);if(!$H)echo"<p class='error'>".error()."\n";else{if($x=="mssql"&&$E)$H->seek($z*$E);$sc=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$K=array();while($J=$H->fetch_assoc()){if($E&&$x=="oracle")unset($J["RNUM"]);$K[]=$J;}if($_GET["page"]!="last"&&$z!=""&&$md&&$Sd&&$x=="sql")$fd=$g->result(" SELECT FOUND_ROWS()");if(!$K)echo"<p class='message'>".lang(12)."\n";else{$Qa=$b->backwardKeys($a,$Dh);echo"<table id='table' cellspacing='0' class='nowrap checkable'>",script("mixin(qs('#table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true), onkeydown: editingKeydown});"),"<thead><tr>".(!$md&&$L?"":"<td><input type='checkbox' id='all-page' class='jsonly'>".script("qs('#all-page').onclick = partial(formCheck, /check/);","")." <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".lang(247)."</a>");$Qe=array();$jd=array();reset($L);$qg=1;foreach($K[0]as$y=>$X){if($y!=$bf){$X=$_GET["columns"][key($L)];$o=$p[$L?($X?$X["col"]:current($L)):$y];$C=($o?$b->fieldName($o,$qg):($X["fun"]?"*":$y));if($C!=""){$qg++;$Qe[$y]=$C;$d=idf_escape($y);$yd=remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($y);$Vb="&desc%5B0%5D=1";echo"<th>".script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});",""),'<a href="'.h($yd.($rf[0]==$d||$rf[0]==$y||(!$rf&&$Sd&&$md[0]==$d)?$Vb:'')).'">';echo
|
|||
|
apply_sql_function($X["fun"],$C)."</a>";echo"<span class='column hidden'>","<a href='".h($yd.$Vb)."' title='".lang(56)."' class='text'> ↓</a>";if(!$X["fun"]){echo'<a href="#fieldset-search" title="'.lang(53).'" class="text jsonly"> =</a>',script("qsl('a').onclick = partial(selectSearch, '".js_escape($y)."');");}echo"</span>";}$jd[$y]=$X["fun"];next($L);}}$qe=array();if($_GET["modify"]){foreach($K
|
|||
|
as$J){foreach($J
|
|||
|
as$y=>$X)$qe[$y]=max($qe[$y],min(40,strlen(utf8_decode($X))));}}echo($Qa?"<th>".lang(248):"")."</thead>\n";if(is_ajax()){if($z%2==1&&$E%2==1)odd();ob_end_clean();}foreach($b->rowDescriptions($K,$cd)as$Pe=>$J){$ti=unique_array($K[$Pe],$w);if(!$ti){$ti=array();foreach($K[$Pe]as$y=>$X){if(!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~',$y))$ti[$y]=$X;}}$ui="";foreach($ti
|
|||
|
as$y=>$X){if(($x=="sql"||$x=="pgsql")&&preg_match('~char|text|enum|set~',$p[$y]["type"])&&strlen($X)>64){$y=(strpos($y,'(')?$y:idf_escape($y));$y="MD5(".($x!='sql'||preg_match("~^utf8~",$p[$y]["collation"])?$y:"CONVERT($y USING ".charset($g).")").")";$X=md5($X);}$ui.="&".($X!==null?urlencode("where[".bracket_escape($y)."]")."=".urlencode($X):"null%5B%5D=".urlencode($y));}echo"<tr".odd().">".(!$md&&$L?"":"<td>".checkbox("check[]",substr($ui,1),in_array(substr($ui,1),(array)$_POST["check"]),"","this.form['all'].checked = false; formUncheck('all-page');").($Sd||information_schema(DB)?"":" <a href='".h(ME."edit=".urlencode($a).$ui)."'>".lang(249)."</a>"));foreach($J
|
|||
|
as$y=>$X){if(isset($Qe[$y])){$o=$p[$y];if($X!=""&&(!isset($sc[$y])||$sc[$y]!=""))$sc[$y]=(is_mail($X)?$Qe[$y]:"");$_="";if(preg_match('~blob|bytea|raw|file~',$o["type"])&&$X!="")$_=ME.'download='.urlencode($a).'&field='.urlencode($y).$ui;if(!$_&&$X!==null){foreach((array)$cd[$y]as$q){if(count($cd[$y])==1||end($q["source"])==$y){$_="";foreach($q["source"]as$s=>$lh)$_.=where_link($s,$q["target"][$s],$K[$Pe][$lh]);$_=($q["db"]!=""?preg_replace('~([?&]db=)[^&]+~','\\1'.urlencode($q["db"]),ME):ME).'select='.urlencode($q["table"]).$_;if($q["ns"])$_=preg_replace('~([?&]ns=)[^&]+~','\\1'.urlencode($q["ns"]),$_);if(count($q["source"])==1)break;}}}if($y=="COUNT(*)"){$_=ME."select=".urlencode($a);$s=0;foreach((array)$_GET["where"]as$W){if(!array_key_exists($W["col"],$ti))$_.=where_link($s++,$W["col"],$W["val"],$W["op"]);}foreach($ti
|
|||
|
as$Yd=>$W)$_.=where_link($s++,$Yd,$W);}$X=select_value($X,$_,$o,$Rh);$t=h("val[$ui][".bracket_escape($y)."]");$Y=$_POST["val"][$ui][bracket_escape($y)];$nc=!is_array($J[$y])&&is_utf8($X)&&$K[$Pe][$y]==$J[$y]&&!$jd[$y];$Qh=preg_match('~text|lob~',$o["type"]);if(($_GET["modify"]&&$nc)||$Y!==null){$pd=h($Y!==null?$Y:$J[$y]);echo"<td>".($Qh?"<textarea name='$t' cols='30' rows='".(substr_count($J[$y],"\n")+1)."'>$pd</textarea>":"<input name='$t' value='$pd' size='$qe[$y]'>");}else{$ue=strpos($X,"<i>...</i>");echo"<td id='$t'>$X</td>",script("qsl('td').onclick = partialArg(selectClick, ".($ue?2:($Qh?1:0)).($nc?"":", '".h(lang(250))."'").");","");}}}if($Qa)echo"<td>";$b->backwardKeysPrint($Qa,$K[$Pe]);echo"</tr>\n";}if(is_ajax())exit;echo"</table>\n";}if(($K||$E)&&!is_ajax()){$Bc=true;if($_GET["page"]!="last"){if($z=="")$fd=count($K);elseif($x!="sql"||!$Sd){$fd=($Sd?false:found_rows($R,$Z));if($fd<max(1e4,2*($E+1)*$z))$fd=reset(slow_query(count_rows($a,$Z,$Sd,$md)));else$Bc=false;}}if($z!=""&&($fd===false||$fd>$z||$E)){echo"<p class='pages'>";$_e=($fd===false?$E+(count($K)>=$z?2:1):floor(($fd-1)/$z));if($x!="simpledb"){echo'<a href="'.h(remove_from_uri("page")).'">'.lang(251)."</a>:",script("qsl('a').onclick = function () { pageClick(this.href, +prompt('".lang(251)."', '".($E+1)."')); return false; };"),pagination(0,$E).($E>5?" ...":"");for($s=max(1,$E-4);$s<min($_e,$E+5);$s++)echo
|
|||
|
pagination($s,$E);if($_e>0){echo($E+5<$_e?" ...":""),($Bc&&$fd!==false?pagination($_e,$E):" <a href='".h(remove_from_uri("page")."&page=last")."' title='~$_e'>".lang(252)."</a>");}echo(($fd===false?count($K)+1:$fd-$E*$z)>$z?' <a href="'.h(remove_from_uri("page")."&page=".($E+1)).'" class="loadmore">'.lang(253).'</a>'.script("qsl('a').onclick = partial(selectLoadMore, ".(+$z).", '".lang(254)."...');",""):'');}else{echo
|
|||
|
lang(251).":",pagination(0,$E).($E>1?" ...":""),($E?pagination($E,$E):""),($_e>$E?pagination($E+1,$E).($_e>$E+1?" ...":""):"");}}echo"<p class='count'>\n",($fd!==false?"(".($Bc?"":"~ ").lang(143,$fd).") ":"");$ac=($Bc?"":"~ ").$fd;echo
|
|||
|
checkbox("all",1,0,lang(255),"var checked = formChecked(this, /check/); selectCount('selected', this.checked ? '$ac' : checked); selectCount('selected2', this.checked || !checked ? '$ac' : checked);")."\n";if($b->selectCommandPrint()){echo'<fieldset',($_GET["modify"]?'':' class="jsonly"'),'><legend>',lang(247),'</legend><div>
|
|||
|
<input type="submit" value="',lang(14),'"',($_GET["modify"]?'':' title="'.lang(243).'"'),'>
|
|||
|
</div></fieldset>
|
|||
|
<fieldset><legend>',lang(119),' <span id="selected"></span></legend><div>
|
|||
|
<input type="submit" name="edit" value="',lang(10),'">
|
|||
|
<input type="submit" name="clone" value="',lang(239),'">
|
|||
|
<input type="submit" name="delete" value="',lang(18),'">',confirm(),'</div></fieldset>
|
|||
|
';}$dd=$b->dumpFormat();foreach((array)$_GET["columns"]as$d){if($d["fun"]){unset($dd['sql']);break;}}if($dd){print_fieldset("export",lang(70)." <span id='selected2'></span>");$Bf=$b->dumpOutput();echo($Bf?html_select("output",$Bf,$za["output"])." ":""),html_select("format",$dd,$za["format"])," <input type='submit' name='export' value='".lang(70)."'>\n","</div></fieldset>\n";}echo(!$md&&$L?"":script("tableCheck();"));}if($b->selectImportPrint()){print_fieldset("import",lang(69),!$K);echo"<input type='file' name='csv_file'> ",html_select("separator",array("csv"=>"CSV,","csv;"=>"CSV;","tsv"=>"TSV"),$za["format"],1);echo" <input type='submit' name='import' value='".lang(69)."'>","</div></fieldset>\n";}$b->selectEmailPrint(array_filter($sc,'strlen'),$e);echo"<p><input type='hidden' name='token' value='$ci'></p>\n","</form>\n";}}if(is_ajax()){ob_end_clean();exit;}}elseif(isset($_GET["variables"])){$O=isset($_GET["status"]);page_header($O?lang(111):lang(110));$Ji=($O?show_status():show_variables());if(!$Ji)echo"<p class='message'>".lang(12)."\n";else{echo"<table cellspacing='0'>\n";foreach($Ji
|
|||
|
as$y=>$X){echo"<tr>","<th><code class='jush-".$x.($O?"status":"set")."'>".h($y)."</code>","<td>".nbsp($X);}echo"</table>\n";}}elseif(isset($_GET["script"])){header("Content-Type: text/javascript; charset=utf-8");if($_GET["script"]=="db"){$Ah=array("Data_length"=>0,"Index_length"=>0,"Data_free"=>0);foreach(table_status()as$C=>$R){json_row("Comment-$C",nbsp($R["Comment"]));if(!is_view($R)){foreach(array("Engine","Collation")as$y)json_row("$y-$C",nbsp($R[$y]));foreach($Ah+array("Auto_increment"=>0,"Rows"=>0)as$y=>$X){if($R[$y]!=""){$X=format_number($R[$y]);json_row("$y-$C",($y=="Rows"&&$X&&$R["Engine"]==($ph=="pgsql"?"table":"InnoDB")?"~ $X":$X));if(isset($Ah[$y]))$Ah[$y]+=($R["Engine"]!="InnoDB"||$y!="Data_free"?$R[$y]:0);}elseif(array_key_exists($y,$R))json_row("$y-$C");}}}foreach($Ah
|
|||
|
as$y=>$X)json_row("sum-$y",format_number($X));json_row("");}elseif($_GET["script"]=="kill")$g->query("KILL ".number($_POST["kill"]));elseif($_GET["script"]=="version"){$gd=file_open_lock(get_temp_dir()."/adminer.version");if($gd)file_write_unlock($gd,serialize(array("signature"=>$_POST["signature"],"version"=>$_POST["version"])));}else{foreach(count_tables($b->databases())as$m=>$X){json_row("tables-$m",$X);json_row("size-$m",db_size($m));}json_row("");}exit;}else{$Jh=array_merge((array)$_POST["tables"],(array)$_POST["views"]);if($Jh&&!$n&&!$_POST["search"]){$H=true;$Ee="";if($x=="sql"&&$_POST["tables"]&&count($_POST["tables"])>1&&($_POST["drop"]||$_POST["truncate"]||$_POST["copy"]))queries("SET foreign_key_checks = 0");if($_POST["truncate"]){if($_POST["tables"])$H=truncate_tables($_POST["tables"]);$Ee=lang(256);}elseif($_POST["move"]){$H=move_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Ee=lang(257);}elseif($_POST["copy"]){$H=copy_tables((array)$_POST["tables"],(array)$_POST["views"],$_POST["target"]);$Ee=lang(258);}elseif($_POST["drop"]){if($_POST["views"])$H=drop_views($_POST["views"]);if($H&&$_POST["tables"])$H=drop_tables($_POST["tables"]);$Ee=lang(259);}elseif($x!="sql"){$H=($x=="sqlite"?queries("VACUUM"):apply_queries("VACUUM".($_POST["optimize"]?"":" ANALYZE"),$_POST["tables"]));$Ee=lang(260);}elseif(!$_POST["tables"])$Ee=lang(9);elseif($H=queries(($_POST["optimize"]?"OPTIMIZE":($_POST["check"]?"CHECK":($_POST["repair"]?"REPAIR":"ANALYZE")))." TABLE ".implode(", ",array_map('idf_escape',$_POST["tables"])))){while($J=$H->fetch_assoc())$Ee.="<b>".h($J["Table"])."</b>: ".h($J["Msg_text"])."<br>";}queries_redirect(substr(ME,0,-1),$Ee,$H);}page_header(($_GET["ns"]==""?lang(35).": ".h(DB):lang(73).": ".h($_GET["ns"])),$n,true);if($b->homepage()){if($_GET["ns"]!==""){echo"<h3 id='tables-views'>".lang(261)."</h3>\n";$Ih=tables_list();if(!$Ih)echo"<p class='message'>".lang(9)."\n";else{echo"<form action='' method='post'>\n";if(support("table")){echo"<fieldset><legend>".lang(262)." <span id='selected2'></span></legend><div>","<input type='search' name='query' value='".h($_POST["query"])."'>",script("qsl('input').onkeydown = partialArg(bodyKeydown, 'search');","")," <input type='submit' name='search' value='".lang(53)."'>\n","</div></fieldset>\n";if($_POST["search"]&&$_POST["query"]!="")search_tables();}$bc=doc_link(array('sql'=>'show-table-status.html'));echo"<table cellspacing='0' class='nowrap checkable'>\n",script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"),'<thead><tr class="wrap">','<td><input id="check-all" type="checkbox" class="jsonly">'.script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);",""),'<th>'.lang(124),'<td>'.lang(263).doc_link(array('sql'=>'storage-engines.html')),'<td>'.lang(115).doc_link(array('sql'=>'charset-mysql.html')),'<td>'.lang(264).$bc,'<td>'.lang(265).$bc,'<td>'.lang(266).$bc,'<td>'.lang(48).doc_link(array('sql'=>'example-auto-increment.html')),'<td>'.lang(267).$bc,(support("comment")?'<td>'.lang(47).$bc:''),"</thead>\n";$S=0;foreach($Ih
|
|||
|
as$C=>$T){$Mi=($T!==null&&!preg_match('~table~i',$T));$t=h("Table-".$C);echo'<tr'.odd().'><td>'.checkbox(($Mi?"views[]":"tables[]"),$C,in_array($C,$Jh,true),"","formUncheck('check-all');","",$t),'<th>'.(support("table")||support("indexes")?"<a href='".h(ME)."table=".urlencode($C)."' title='".lang(40)."' id='$t'>".h($C).'</a>':h($C));if($Mi){echo'<td colspan="6"><a href="'.h(ME)."view=".urlencode($C).'" title="'.lang(41).'">'.(preg_match('~materialized~i',$T)?lang(122):lang(123)).'</a>','<td align="right"><a href="'.h(ME)."select=".urlencode($C).'" title="'.lang(39).'">?</a>';}else{foreach(array("Engine"=>array(),"Collation"=>array(),"Data_length"=>array("create",lang(42)),"Index_length"=>array("indexes",lang(126)),"Data_free"=>array("edit",lang(43)),"Auto_increment"=>array("auto_increment=1&create",lang(42)),"Rows"=>array("select",lang(39)),)as$y=>$_){$t=" id='$y-".h($C)."'";echo($_?"<td align='right'>".(support("table")||$y=="Rows"||(support("indexes")&&$y!="Data_length")?"<a href='".h(ME."$_[0]=").urlencode($C)."'$t title='$_[1]'>?</a>":"<span$t>?</span>"):"<td id='$y-".h($C)."'> ");}$S++;}echo(support("comment")?"<td id='Comment-".h($C)."'> ":"");}echo"<tr><td> <th>".lang(240,count($Ih)),"<td>".nbsp($x=="sql"?$g->result("SELECT @@storage_engine"):""),"<td>".nbsp(db_collation(DB,collations()));foreach(array("Data_length","Index_length","Data_free")as$y)echo"<td align='right' id='sum-$y'> ";echo"</table>\n";if(!information_schema(DB)){$Gi="<input type='submit' value='".lang(268)."'> ".on_help("'VACUUM'");$nf="<input type='submit' name='optimize' value='".lang(269)."'> ".on_help($x=="sql"?"'OPTIMIZE TABLE'":"'VACUUM OPTIMIZE'");echo"<fieldset><legend>".lang(119)." <span id='selected'></span></legend><div>".($x=="sqlite"?$Gi:($x=="pgsql"?$Gi.$nf:($x=="sql"?"<input type='submit' value='".lang(270)."'> ".on_help("'ANALYZE TABLE'").$nf."<input type='submit' name='check' value='".lang(271)."'> ".on_help("'CHECK TABLE'")."<input type='submit' name='repair' value='".lang(272)."'> ".on_help("'REPAIR TABLE'"):"")))."<input type='submit' name='truncate' value='".lang(273)."'> ".on_help($x=="sqlite"?"'DELETE'":"'TRUNCATE".($x=="pgsql"?"'":" TABLE'")).confirm()."<input type='submit' name='drop' value='".lang(120)."'>".on_help("'DROP TABLE'").confirm()."\n";$l=(support("scheme")?$b->schemas():$b->databases());if(count($l)!=1&&$x!="sqlite"){$m=(isset($_POST["target"])?$_POST["target"]:(support("scheme")?$_GET["ns"]:DB));echo"<p>".lang(274).": ",($l?html_select("target",$l,$m):'<input name="target" value="'.h($m).'" autocapitalize="off">')," <input type='submit' name='move' value='".lang(275)."'>",(support("copy")?" <input type='submit' name='copy' value='".lang(276)."'>":""),"\n";}echo"<input type='hidden' name='all' value=''>";echo
|
|||
|
script("qsl('input').onclick = function () { selectCount('selected', formChecked(this, /^(tables|views)\[/));".(support("table")?" selectCount('selected2', formChecked(this, /^tables\[/) || $S);":"")." }"),"<input type='hidden' name='token' value='$ci'>\n","</div></fieldset>\n";}echo"</form>\n",script("tableCheck();");}echo'<p class="links"><a href="'.h(ME).'create=">'.lang(71)."</a>\n",(support("view")?'<a href="'.h(ME).'view=">'.lang(197)."</a>\n":"");if(support("routine")){echo"<h3 id='routines'>".lang(136)."</h3>\n";$Ng=routines();if($Ng){echo"<table cellspacing='0'>\n",'<thead><tr><th>'.lang(176).'<td>'.lang(46).'<td>'.lang(214)."<td> </thead>\n";odd('');foreach($Ng
|
|||
|
as$J){echo'<tr'.odd().'>','<th><a href="'.h(ME).($J["ROUTINE_TYPE"]!="PROCEDURE"?'callf=':'call=').urlencode($J["ROUTINE_NAME"]).'">'.h($J["ROUTINE_NAME"]).'</a>','<td>'.h($J["ROUTINE_TYPE"]),'<td>'.h($J["DTD_IDENTIFIER"]),'<td><a href="'.h(ME).($J["ROUTINE_TYPE"]!="PROCEDURE"?'function=':'procedure=').urlencode($J["ROUTINE_NAME"]).'">'.lang(129)."</a>";}echo"</table>\n";}echo'<p class="links">'.(support("procedure")?'<a href="'.h(ME).'procedure=">'.lang(213).'</a>':'').'<a href="'.h(ME).'function=">'.lang(212)."</a>\n";}if(support("sequence")){echo"<h3 id='sequences'>".lang(277)."</h3>\n";$bh=get_vals("SELECT sequence_name FROM information_schema.sequences WHERE sequence_schema = current_schema() ORDER BY sequence_name");if($bh){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(176)."</thead>\n";odd('');foreach($bh
|
|||
|
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(219)."</a>\n";}if(support("type")){echo"<h3 id='user-types'>".lang(24)."</h3>\n";$Ei=types();if($Ei){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(176)."</thead>\n";odd('');foreach($Ei
|
|||
|
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(223)."</a>\n";}if(support("event")){echo"<h3 id='events'>".lang(137)."</h3>\n";$K=get_rows("SHOW EVENTS");if($K){echo"<table cellspacing='0'>\n","<thead><tr><th>".lang(176)."<td>".lang(278)."<td>".lang(203)."<td>".lang(204)."<td></thead>\n";foreach($K
|
|||
|
as$J){echo"<tr>","<th>".h($J["Name"]),"<td>".($J["Execute at"]?lang(279)."<td>".$J["Execute at"]:lang(205)." ".$J["Interval value"]." ".$J["Interval field"]."<td>$J[Starts]"),"<td>$J[Ends]",'<td><a href="'.h(ME).'event='.urlencode($J["Name"]).'">'.lang(129).'</a>';}echo"</table>\n";$_c=$g->result("SELECT @@event_scheduler");if($_c&&$_c!="ON")echo"<p class='error'><code class='jush-sqlset'>event_scheduler</code>: ".h($_c)."\n";}echo'<p class="links"><a href="'.h(ME).'event=">'.lang(202)."</a>\n";}if($Ih)echo
|
|||
|
script("ajaxSetHtml('".js_escape(ME)."script=db');");}}}page_footer();
|