From 71a1df03db139ed01e7eb3baddc266a4a0777c79 Mon Sep 17 00:00:00 2001 From: kjmtsh Date: Wed, 5 Feb 2014 19:29:23 +0000 Subject: [PATCH] Fixed some bugs and added more features. git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@852178 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- db.php | 8 + functions-5-2.php | 48 +- functions.php | 48 +- js/sqlite.js | 1 + languages/sqlite-integration-ja.mo | Bin 49138 -> 45120 bytes languages/sqlite-integration-ja.po | 86 +- languages/sqlite-integration.pot | 1586 +++++++++++++++------------- pdodb.class.php | 27 +- pdoengine.class.php | 214 ++-- query.class.php | 187 ++-- query_alter.class.php | 132 +-- query_create.class.php | 74 +- readme-ja.txt | 6 +- readme.txt | 6 +- schema.php | 15 +- sqlite-integration.php | 96 +- styles/blue.css | 2 + styles/coffee.css | 2 + styles/ectoplasm.css | 2 + styles/light.css | 2 + styles/midnight.css | 2 + styles/ocean.css | 2 + styles/style.css | 9 +- styles/style.min.css | 2 +- styles/sunrise.css | 2 + utilities/database_maintenance.php | 11 +- utilities/documentation.php | 4 +- utilities/patch.php | 68 +- utilities/plugin_lists.json | 697 +++++++++++- utilities/utility.php | 90 +- 30 files changed, 2343 insertions(+), 1086 deletions(-) diff --git a/db.php b/db.php index d38a3ba..67df850 100644 --- a/db.php +++ b/db.php @@ -18,9 +18,17 @@ if (!defined('ABSPATH')) { // Oh, you are not WordPress! * USE_MYSQL is a directive for using MySQL for database. * If you want to change the database from SQLite to MySQL or from MySQL to SQLite, * the line below in the wp-config.php will enable you to use MySQL. + * * * define('USE_MYSQL', true); * + * + * If you want to use SQLite, the line below will do. Or simply removing the line will + * be enough. + * + * + * define('USE_MYSQL', false); + * */ if (defined('USE_MYSQL') && USE_MYSQL === true) return; diff --git a/functions-5-2.php b/functions-5-2.php index 5e2fe84..8d5f2a5 100644 --- a/functions-5-2.php +++ b/functions-5-2.php @@ -82,6 +82,9 @@ class PDOSQLiteUDFS { 'inet_aton' => 'inet_aton', 'datediff' => 'datediff', 'locate' => 'locate', + 'utc_date' => 'utc_date', + 'utc_time' => 'utc_time', + 'utc_timestamp' => 'utc_timestamp', 'version' => 'version' ); /** @@ -224,7 +227,8 @@ class PDOSQLiteUDFS { /** * Method to emulate MySQL SUBSTRING() function. * - * This function rewrites the function name to SQLite compatible substr(). + * This function rewrites the function name to SQLite compatible substr(), + * which can manipulate UTF-8 characters. * * @param string $text * @param integer $pos representing the start point. @@ -667,17 +671,45 @@ class PDOSQLiteUDFS { } } /** - * Method to return MySQL version. - * - * This function only returns WordPress $required_mysql_version, because it is - * meaningless for SQLite database. + * Method to return GMT date in the string format. * * @param none - * @return string representing the version number + * @return string formatted GMT date 'dddd-mm-dd' + */ + public function utc_date() { + return gmdate('Y-m-d', time()); + } + /** + * Method to return GMT time in the string format. + * + * @param none + * @return string formatted GMT time '00:00:00' + */ + public function utc_time() { + return gmdate('H:i:s', time()); + } + /** + * Method to return GMT time stamp in the string format. + * + * @param none + * @return string formatted GMT timestamp 'yyyy-mm-dd 00:00:00' + */ + public function utc_timestamp() { + return gmdate('Y-m-d H:i:s', time()); + } + /** + * Method to return MySQL version. + * + * This function only returns the current newest version number of MySQL, + * because it is meaningless for SQLite database. + * + * @param none + * @return string representing the version number: major_version.minor_version */ public function version() { - global $required_mysql_version; - return $required_mysql_version; +// global $required_mysql_version; +// return $required_mysql_version; + return '5.5'; } } ?> \ No newline at end of file diff --git a/functions.php b/functions.php index 58d8445..7dd6247 100644 --- a/functions.php +++ b/functions.php @@ -84,6 +84,9 @@ class PDOSQLiteUDFS { 'inet_aton' => 'inet_aton', 'datediff' => 'datediff', 'locate' => 'locate', + 'utc_date' => 'utc_date', + 'utc_time' => 'utc_time', + 'utc_timestamp' => 'utc_timestamp', 'version' => 'version' ); /** @@ -225,7 +228,8 @@ class PDOSQLiteUDFS { /** * Method to emulate MySQL SUBSTRING() function. * - * This function rewrites the function name to SQLite compatible substr(). + * This function rewrites the function name to SQLite compatible substr(), + * which can manipulate UTF-8 characters. * * @param string $text * @param integer $pos representing the start point. @@ -640,17 +644,45 @@ class PDOSQLiteUDFS { } } /** - * Method to return MySQL version. - * - * This function only returns WordPress $required_mysql_version, because it is - * meaningless for SQLite database. + * Method to return GMT date in the string format. * * @param none - * @return string representing the version number + * @return string formatted GMT date 'dddd-mm-dd' + */ + public function utc_date() { + return gmdate('Y-m-d', time()); + } + /** + * Method to return GMT time in the string format. + * + * @param none + * @return string formatted GMT time '00:00:00' + */ + public function utc_time() { + return gmdate('H:i:s', time()); + } + /** + * Method to return GMT time stamp in the string format. + * + * @param none + * @return string formatted GMT timestamp 'yyyy-mm-dd 00:00:00' + */ + public function utc_timestamp() { + return gmdate('Y-m-d H:i:s', time()); + } + /** + * Method to return MySQL version. + * + * This function only returns the current newest version number of MySQL, + * because it is meaningless for SQLite database. + * + * @param none + * @return string representing the version number: major_version.minor_version */ public function version() { - global $required_mysql_version; - return $required_mysql_version; +// global $required_mysql_version; +// return $required_mysql_version; + return '5.5'; } } ?> \ No newline at end of file diff --git a/js/sqlite.js b/js/sqlite.js index 5fc8ffe..40dc4ce 100644 --- a/js/sqlite.js +++ b/js/sqlite.js @@ -3,6 +3,7 @@ * * This script is only included on the documentation and utility page. * + * @package SQLite Integration * @author Kojima Toshiyasu */ jQuery(document).ready(function($) { diff --git a/languages/sqlite-integration-ja.mo b/languages/sqlite-integration-ja.mo index 7ecb4fc42149e60ed2e1283f5ce80a143e3548ac..231a9be89397d86e335e17f3ced500479d9ff335 100644 GIT binary patch delta 7265 zcmZvg34ByVwudVL0t&K(unNf~VGEFiT>$~vWCjlB?}NT)k2VMp$S zEyyB)up_i0q7V_c85b1C4QCX&A%f^Aj-xzhe7x^;T|}N!zx?~FQ}tFt)W) zcf%~02M@!0VB)PxO@MxQFMJ)2g}1Vr9xw-r0~=rixD_&_+7AupS8q~b(dr@;4==-d zFsiLmH^H0XDHsQPveIfO4!20q11Ca>Ofr-SZi7wXaJzj9l=risjQ=Q<@q@5kfXWgo z{HeWsbb@a~8Q@3Q71lHK1ic}PQ$rztYC0c8T?ODxI93K_A)DJpLaQpFOc=K9lTadg z3W~!?iS+G2r3V%9=zhp{s)u1u=!fxeCnPB94JeLP!;bI@Oo9n~bb-SlJ}VdO23J5C z_eGnpLh1hwlzF~PBK{Dwi56bxEFcwxparktnfKnu^`jv(;bd2jv6tHI`lZ4pM!wcAn?88>< z`YdZQ_P!LQ4#3)}ObDNaUf3~>1cn=6HrxXx0!{H++S@>;P${qpoE)Iih)NC=kLN(~ za5t<2k3oshNt>sjy#JYPUxKoiKihU428qUQ0wq`CplnHZDC10kwc#`ZhscOE>&2RwrQAiF1 z)K9vi>i1$_cwj(Im^urk1&)Gs<@`^NR5+hdCUQYp$toyWybrz)&%pNNz}~)GKJa};liVrorybY~CA53t zGI$VfgM<3(3+o(|tsBqsy>L3L8(^T*ROE&_bBA8hmoOIlTiaFx^##%Z%1T?nTVZ>+ zg#LFziO5@nlp+t+_fWDsVX!`?W8i(*k3#;`8+?f4b?+qppHhjZG7nyXyJ6uFr8dFD zp@<1izzNvZ!??S#`wZuH!~SlBPSW0Y>5%q^5`hVjt3lld<=D-E9qG3bHpD(TQZMxM zNa8Om{hWpvco|A^U4dQUO{0{ekLm-(o(l<<+6j3@RYO@xx6zuzU|Z~|unn98S&J%z z6LH{U_yl%xx;}oD=>fgRFVMhtsTwGuGRAU5;B43#egKo_#xa3W1)YlZZCyp*lXZ>u-k)5mB3%&pJ0&iEr!h>;x2((;1-xSoiSm9 z8A>gb^S_CTbnNgjPQYDICi*vwhYcM%0x3|k+5zPlErZSAMktXv1f}0eI4Mf0kKnhk zONKr*EuH$J>HsAP(_kYx|AQhG&ZYgrbelP_9WQ$9=YN9ao2r0=;kPgarex`_?FXSe zFM;Ct+mNe5U4oKBiP?H9(&2a(&QVV{RF@G9H_V{-M%Dq#=oqfqwv z8z@;`=MkN>iLgKR9C$knLviFAI0)9y(>XQ<%9q?i7?9-poXQv&o3FnE9)jXP7EFc( zHrGN4`3Wd1`xthC4GWaI1NMUwk=an5SHMy5Gbj;j?_xq$o(X0AYB%w}O2Z|$KF^mP z)uHU=(V>43-pY$lKpAK~6o=122mP9RSuOS)A79njm*F_LYc`SMYw+hnoz%&Xam(`F zoA4+se_SW+J3taz4Tti4CzSJj2udz| z4CQqEXtQ?E9tVnJ@lY1f14<+VBkdO+hy7?+06W1dC(v5ajMqRd58nb%Fl1>VT5%&q0aQ zyEZ?BGQr`yk@LTj$|rPO1HXpu zW!!df>T;cYzrfeAo3GFp%im!Pc8^thpxbSx!{)S4hq48Jn+srf>@t{!Bd^1u*gvi2 z9$CXhNb$S6i zHz@T5?~f|yDD%AYQ##Tsp=`xQ7?317M5RA`35sVw!%{l--=rgOl5ohLeF0@9KiGEC z7X7?0l&kw5m<}tTjPpGl0efxL7funBBz_-?1K)2Y{_Uv5Jgv`rXDH`+46GZ?T@L?@ z{Z@s}fwJwKZ|wch0sjLt;Pf5(2h1yQAoh?-{YxkS#i9LhS`<-&^RVyVrQ1K+Mf}M( zmAG4bSP2jD;#K%E?T7a26?*san;v^56bHNPXYb%P*aiLo?}cp-=ws!9a&hf|vcOkh zBUlZ^p&udBNdD_RWU-NdNJ!hK@*#1ZvZF3{sf=CDTDr$k8 z=uVW0@GzCnvnH6o&se*y7b6e<6(In*Y(s(wJSIw=(z zkmOBi^)8zi;UH9l9!IUv zal{FWl>2SI2H&;og5pU0snkauQEl`+dIg%|B9NSYh@jk5_B_q&u;7tXQMXgJnD_4OhF6KSExBUf%YOP z1;`Vr>Hn(hO8qEGx7!B7z{h;FMmtdglF|n7gupDPbo-?yc zqEVRZ%P|}-!{PNgJ-OaIBiCzWdE5ntFUM*4y-ts}lacGna(fCKzFfB})fjDL=4QG& z`HT!1!zd{7I`gxPBBzf>(Cs&}+Wwy0W_&v+|t|uhVFd@AMf3 zP9x9dE=)DkrgaXVj(fFEy-atZE8p$NG&i_7@XwOTotf7k``m6L-{Hx28a}uE*nX(rHL@HGl$mNwaC^PE zGZ|BSv)?ovKA$5a@5T1u#`8SVmN;d7=QYVVIW4|RMayt`AQTH!X`>eg;)6gpf! znekdY3`b;K^X;?_-R<=nGyOiF?8XEgQN0&#m+gVWM;~8qfipGSyJu`v6W446(r4qxIRGdQ@Z z*=k6eIzETb?+qUs@l8~svtX9nR~30YTqc; z81E)(MTWy8sTbZks#bKZG=@GnGR}N%%)aoD-tkf4htgxBqf>jB8RPPX%McRc43E>{ za}uo795zdG!H&dzu0Onjw;4ItJxUF~HLgokeaT^$;q-Xip77=I6Y7VjO#LJ(U==U3 zN`h9X(kdyjLI-M&ly%$XJb!)_t}U~IAuGf@+RaLNLEKp^js%x{ zwRwBQg>oyn(h6>|f@RDc?lx^hy=GQPu@%D8uvM~8{4K%LwdUKIdExDuPeqxvvKN?_ zOAK?1zm9n-+tKjG;Dl3hZmDYyaW`*ue({ov>nqa!I9hnJdqyquJkrmo@ zEo^&g%8yvVg;=l3tGK1v?wQ6m1z+v1&cFrPdg7ygIWTPyr*Vb>`0 zT>secT}7c<;j8oZ)iHNu8nJ(jkJ(~=-~ZP9T~10uj~m@0&#Ep4kJK#LWXYtSG%tk0Q&CS-dd($fbK}xvvv_+`^VMBn zhnFwDJ=&}~QqNp>utE6c-2);Q%)j@ZY<2xUxgj*6)n>zKiKgF^5Us1>CNrTXAmvh| z2-2$wIyP_#uI{S4`c~Z4b=6(VUJ}AqmG`#3_jtemId_tfb-(w%@7>RTe&?LI_niOv zw{!5dFPeOFtx4pw z7;oCeFpA)ASPYZ98b%Aa0m@W1JPQxOHgHil!)R?75yMMk76W1UD0~A>foa_hBLgmn zv*AzRQrM%1Va$PR;DhiZm=1^bG>jv#7~T&1up3d}0oWEUfTD;6naU`HChHrUXs~JH zjQheXuoeBc;d}6Ba5y_X*js6Ae0Z~-_zNf&xeR52|9~A~lRkR93uK4J04NI&gEzo& zurHhn`$T9wN@E}_gEGPMa0q-8$^zd&HYMuHe?~93e z_#;S$8h>$_e5YaDLq8P~1LVJM7%Slgey|~#W@Ox@cd!iNc4H$HMV^O}ZdGpo9k>4x zlvua~@ru#qZo^0XvSHhNXo6EhhujKz>8lw4|P@>m?@5A<^Sr`-l2EGJa5^-G^ zuew(&@F5ga{swMg$Ld0L35x6Hj3ZFt5*UI%hrfqY#^de?6OWu=7%wvL*hIsa zN&mJJ9!3S9Qukd^Hr_a@C_cjz4e**Ec(J}-7iv=cR7{NZI2`VSBjEe6J#4;E=XVz7V721@Ua0LBRkW4c^haM&xS#itMCdvA6?}rC7tgm<%WIqX3HN9FpvkD$!++XxN$ z@M|~(_S&GMb}Ez?=0aKEAxK6UE8O3I1tqv@pu|L*jXJneT;2s+F+LTFqI02a#DZes z$KBr}l{D^V;4Bp1T!k`m&nNLC91rEgJunqM2j798LwWDiCVi#42vg`MZPxD(hO+Q@ z*bZjEwlE7)n~Va;ITbP9rIEov@)m9K94I@FxLgBoqrVZ#f>m%NbYO2{quW->GQ7hk zW-#>`s*!A@`A)4sDwO%g!(YNFP%5DLlws^=ed8Pr3BrYp{s1nAZ^FBFbH!%jYfz&3 z-o5NZxR1<$GxzI>(++U{(;o$8$FCpM{18g1u7zTOYcAUz(i`dnheeuDGHJ}>g_0vW z3*Lj`l5R)!Eq5+lLVpt!3w#B;vS8<9I*L<|bFpN+7XBSRcS3eXTArks@m~5V$~FDL z&uSNJf#TAAFd{+n0*!UNSOsMVQ!2HF3!(JOp;%}id;p$oDaW* z60~5I)HGYA9*+2^7oRbV2WMFlj1TxLz8@uBo=r$GBK}W2KcMkbM1pKTG8+;9UqT*7x*@xe&4@f1 z8Y+$7b=yCKC2qSlyaj0{_WvV|Z;*?~6Nvb82|_X$gn_z1R>C_Gc|JiTHmaq=b0d<6 z3_yruRo#9F<@p@>HPQvyiO91QIjdUSnpj^Qy%XWn$nV@A9&!04tVPDVeF?tyh&VB*1BjaEDH=l%vdG9p{tc1GLOw;VAZ17! zWD$~hR?(2clXzCr_yQqI)oJ$?ybT$PG<@En^BIyZ>z|-85=ll9&v_b66CIbs8}$Fs zpgo9o4DmJ?lN^`2Fv}h5?Q)&VeApG4Bm3{~4&LK3fhjazc01dk2MN0UmM)LDoaE9E zJ0ev`J9q3OC@0@kWFzuEatu+A*nbC7inKybBk~MHmLt8S!!trd-TPM4zKV20j=JL& z(1#Sb{c<=M`3W+^9UB8bM7kqqkUog=ze(dbvKPrg4k68v?T9>kkh@e%*LAn4E}tPf z(-Q+Ov*NG!{d>}l z-$_q@@cso4vW0AGg?+C7OnbV(#FRiFmyZ|BOgA&UVJqKL5VEHad^au6v)nTMfv_32LSZYL zrr$CHIj%9YJX+%drEw@N-Z3S)X^J+qJEqK96l6|i*X+!+g1iE?m7#Wrz8&ogqnbzj z1H)!fAhA|Uv9C_z);hhqqbe-@rO-Mqt{)Fv@3ZkSQti2v&a(+vT*TGH9H}L2ZCmx z$ZrO{p`~$iNZV$Spy~7Ya|=DW%5}0eu~r!MGmG(5fhWkmi3$vq9Wsl&;XIQ)W?96n zm6n@kPWP~5D};L|5j`{{&K}J3c!!#Pi?`8x@^$foVnO26=SvM+E5Z@h@C4b5IKZ@W zaxBtgx#cT%ZK&;cy^?DE)Oy`gwQhulwrF-hjG{s(956GnjW^^eCkd_-!{^6_nUYC#|r4yEc46AvZw*qp0hFz3h% z;wrI*%roJ-PxJRguBsi9ihhfP!azYw=SL`z-ykEU+6*;4eqKQ* zOKGFkV?c+JB(ocRjaN!D<3E_#KdGy(N}&QP%bVlPsw+?Nrnk3h8lN^YyM_Jb=*Z35 z>TiF&~m1s}} zkh-WBtyeMyzxXUqC_L0Gq%@Q2!ECSJLuCnBL5cW~6(*Tm~%@kDh6_8&$_BpnOtl6Jw9)^*v$9l=5a=O#6ktZ09(x`u&0Hk zfM!~HTv;YO4*dv2*Fwq`^;KGqNh+e8brvNw+e?3j?Dl;-MbxZa?IWrb`#L`Nkd$y=lYNZ&0Y zq-2^o0rxRk9&zfyR20*o7%f!HMPY@w+;vtWYsJ=yJkaLET%ktxGBU!RF#o?SLv9)M zu~v7#$hE?YLlG5Ui@pAwK*O6x;_4x#EGHPqmt1g@Bs)m(5TQAeKWXMH4xWJDN2E54 zvP{mg`m|KaF#~l;esFy@jmXHgZ|>V7qBgFMJrz)iK&Aq_xufm?`9z^yAQD?wHc{s@ zK`7xO=KGe*nwPA?xJBx4;Z#^ErCnu!%*EZUE&Y5B3OP{H;$MvUeUkn4*psaZV2{6; zv$)v4Fz$AH_qgHlw&VXS#i)aAPCOdFGAXHv{rmfu#`jGgm=ynDN_v|vOvG1{2)Llf z%30+4yu~q;2is(d-s}B!3(f#ghqhedD zH=lB1C3SkZKg6~=v6D{e_np$s>hB3BcGxLJkDV-RKW_K2UtJP1W6wIJhn&(eUaPPcM2}4h-=wpExhIOJRl;v(0pED#g$sAa}!AxRgW@RQ!iebei za$)NKf4B$ROV)O3jbql=o*J!O17|co!5FI9yS}=NHBMER5?K64 zbk`Zv~_dB8fxwz!zou)#?kYYme&0X>5Oqfr*sa z|Ig(c6U#JH|JS>>3TC1@k?M`oPzO_Vjs4}ZZmsHa+%7BY(S?X2FR5S>#&!7@@BO_i zNp_#e>UiL(yPI@S*9|Fei835N82PBFo#XFdpIdxmGs$85foHnfW1nbkKU3O1K6};K z8|>i+lI^7%PY;qXQ_(91{O5XJS+l;JbqNi-_qJ|Q2L>IhuGn9D09&Knb#A0?pu%u< z0#sb8D!0uOod;^~)oj}1MAx|)DD@8K6XGPQo?(|g>_C@z%9Cf4Z2#{5c8|?n?GXo( zTM@y!SlU}2>txS8)-j??DS=yeB;fX%O`9)Ov4HHf?glMyCM;feY$VFfZf4+Oz&q+d zlCwh&1`d(Uj5VC^x=*8N#Me=YHR`M!KRcXKRWYS3%E2X}M-ti_b)mEio*WQS>r`HT zkwt*CQb_4Z9yBvQB)P)Eyc-`Z}o>#y5#rp7p+ zPdl+njx48?N^|PlPbBOcBT@()qFmd_Js<1?`+JOLiCt>vETj$zH>H%fWLsEKxAncH zzFbS(*(p!9ZLg9DdnU@7{nJ%lo8hT7_7hKbk4ViS5jU#h9o1Ju*_Jwq{>7zT-Px7G zcz#XIiT$;u=T(iWt3}rx7H;-MD-)W?njlH~U1Yr5DKhuZcQBkh!e zP=6k8sJn^S6Sj4ol$g6g&Z`#^@hJ1HS2MU}QI%T`KHS0{%lXOnE$h`ax}kdQIg&^@ zcc&9uE4D3(+0!?h@%fwgH?dc*?P#al7i{0Qd+j#cGUF$=t!Y9v9nBA&?6o_u#82*? z*~I?a-Z$c-_pMKgf4;wS`)TT0#FQ)~xAn&VCeX!KDaSUbOee3D9#;o58FyV6+gB@R F{tvAOsKNjM diff --git a/languages/sqlite-integration-ja.po b/languages/sqlite-integration-ja.po index 3abc30a..ce3592a 100644 --- a/languages/sqlite-integration-ja.po +++ b/languages/sqlite-integration-ja.po @@ -129,12 +129,11 @@ msgstr "パッチ" #: utilities/documentation.php:32 msgid "" -"This is a brief documentation about this plugin. For more details, see also " -"the Plugin " -"Page." +"This is a brief documentation about this plugin. For more details, see also the " +"SQLite Integration page." msgstr "" "このプラグインについての短いドキュメントです。詳しくは、プラグインのページをご覧ください。" +"sqlite-integration/\">SQLite Integration のページをご覧ください。" #: utilities/documentation.php:35 msgid "" @@ -266,12 +265,12 @@ msgstr "" msgid "" "Some plugins do work fine if you rewrite MySQL functions. I made some patch " "files and Patch Utility. See also the SQLite Integration page for " -"more details." +"\"http://dogwood.skr.jp/wordpress/sqlite-integration/#plugin-compat\">SQLite Integration" +" Page for more details." msgstr "" "MySQLの関数を書き換えると動作するプラグインがあります。いくつかはパッチファイルと、" -"パッチをあてるページを作りました。" -"プラグインのページもご覧ください。" +"パッチをあてるページを作りました。" +"SQLite Integration のページもご覧ください。" #: utilities/documentation.php:74 msgid "" @@ -429,13 +428,40 @@ msgstr "エラー! ファイル%sは削除されていません。" msgid "Error!: patches directory is not accessible." msgstr "エラー! パッチ・ディレクトリにアクセスできません。" +msgid "Unable to create a patch directory." +msgstr "パッチ・ディレクトリを作成できませんでした。" + +msgid "Unable to create a .htaccess file." +msgstr ".htaccess ファイルを作成できませんでした。" + +msgid "Invalid operation." +msgstr "不正な操作です。" + +msgid "File is too large to upload." +msgstr "ファイルサイズが制限を越えています。" + +msgid "File upload is not complete." +msgstr "ファイルアップロードは完了しませんでした。" + +msgid "File is not uploaded." +msgstr "ファイルはアップロードされませんでした。" + +msgid "Temporary directory is not writable." +msgstr "テンポラリ・ディレクトリに書込みできません。" + +msgid "File cannot be written on the disk." +msgstr "ファイルをディスクに書き込めません。" + +msgid "Unknown error." +msgstr "不明なエラーです。" + #: utilities/patch.php:142 -msgid "File is uploaded" +msgid "File is successfully uploaded." msgstr "ファイルをアップロードしました" #: utilities/patch.php:146 -msgid "File is not uploaded" -msgstr "ファイルはアップロードされていません" +msgid "File upload failed. Possible file upload attack." +msgstr "アップロードに失敗しました。不正なファイルです。" #: utilities/patch.php:150 msgid "File is not selected" @@ -630,9 +656,11 @@ msgstr "ファイルを選択" #: utilities/patch.php:286 msgid "" "Select file from your computer. If the file name is the same as existent " -"file, this operation will override it." +"file, this operation will override it. You can't upload the file whose " +"size is over 500kB." msgstr "" "あなたのコンピュータにあるファイルを選択します。ファイル名がすでに存在する場合は、それを上書きします。" +"500kB を越えるサイズのファイルはアップロードできません。" #: utilities/patch.php:288 msgid "Upload" @@ -705,6 +733,16 @@ msgstr "たぶん可" msgid "Checked" msgstr "チェック済" +msgid "Checked*" +msgstr "チェック済*" + +msgid "" +"\"Checked*\" with an asterisk is from the users' information. " +"I didn't check myself yet. If you found any malfunctioning, please let me know." +msgstr "" +"「チェック済*」のようにアステリスクのついたものは、ユーザからの情報にもとづいたものです。" +"私自身はチェックしていません。もし、不具合があるようでしたら、お知らせください。" + #: utilities/utility.php:257 utilities/utility.php:263 msgid "Not Checked" msgstr "未確認" @@ -968,12 +1006,18 @@ msgstr "データベースの最適化、エラーログ、初期化ファイル #: utilities/utility.php:695 msgid "Please select backup file(s)." -msgstr "データベースを最適化する" +msgstr "バックアップファイルを選択してください。" #: utilities/utility.php:704 msgid "Error! Please remove file(s) manyally." msgstr "エラー! 手動でファイルを削除してください。" +msgid "Please select backup file." +msgstr "バックアップファイルを選択してください。" + +msgid "Please select one file at a time." +msgstr "複数ファイルは選択できません。" + #: utilities/utility.php:718 msgid "Database Optimization, Error Log, Init File" msgstr "データベース最適化、エラー・ログ、初期化ファイル" @@ -1025,9 +1069,16 @@ msgid "" msgstr "" "バックアップファイルを削除したい場合は、ファイルをチェックして削除ボタンをクリックしてください。複数ファイルを選択できます。" +msgid "" +"If you want to download a file, check the file name and click the Download button." +" Please check one file at a time." +msgstr "" +"バックアップファイルをダウンロードしたい場合は、ファイルをチェックしてダウンロードボタンをクリックしてください。" +"1ファイルのみ選択できます。" + #: utilities/utility.php:748 -msgid "Delete" -msgstr "削除" +msgid "Delete/Download" +msgstr "削除/ダウンロード" #: utilities/utility.php:749 msgid "Backup Files" @@ -1051,6 +1102,11 @@ msgid "" msgstr "" "バックアップファイルを削除します。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。" +msgid "" +"Are you sure to download backup file?\\n\\nClick [Cancel] to stop, [OK] to continue." +msgstr "" +"バックアップファイルをダウンロードします。\\n\\n中止する場合は[Cancel]を、続ける場合は[OK]をクリックしてください。" + #: utilities/utility.php:768 msgid "SQLite Integration Error Log" msgstr "SQLite Integrationのエラーログ" diff --git a/languages/sqlite-integration.pot b/languages/sqlite-integration.pot index 5e229dd..3345b1c 100644 --- a/languages/sqlite-integration.pot +++ b/languages/sqlite-integration.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-03 14:31+0900\n" +"POT-Creation-Date: 2014-02-06 01:39+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,749 +17,121 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: trunk/install.php:40 +#: sqlite-integration.php:205 sqlite-integration.php:235 +msgid "SQLite Integration" +msgstr "" + +#: install.php:47 msgid "" "Note that password carefully! It is a random password that was generated just for you." msgstr "" -#: trunk/install.php:45 +#: install.php:52 msgid "Your chosen password." msgstr "" -#: trunk/install.php:56 +#: install.php:63 msgid "The password you chose during the install." msgstr "" -#: trunk/pdodb.class.php:96 +#: pdodb.class.php:127 #, php-format msgid "WordPress database error %1$s for query %2$s made by %3$s" msgstr "" -#: trunk/pdodb.class.php:98 +#: pdodb.class.php:129 #, php-format msgid "WordPress database error %1$s for query %2$s" msgstr "" -#: trunk/pdodb.class.php:136 +#: pdodb.class.php:185 #, php-format msgid "" "

Error establlishing a database connection

We have been unable to " "connect to the specified database.
The error message received was %s" msgstr "" -#: trunk/pdoengine.class.php:82 trunk/pdoengine.class.php:98 -msgid "Database connection error!
" -msgstr "" - -#: trunk/pdoengine.class.php:83 trunk/pdoengine.class.php:99 -#, php-format -msgid "Error message is: %s" -msgstr "" - -#: trunk/pdoengine.class.php:156 +#: pdoengine.class.php:291 #, php-format msgid "" "

Unknown query type

Sorry, we cannot determine the type of query " "that is requested.

The query is %s

" msgstr "" -#: trunk/pdoengine.class.php:315 -#, php-format -msgid "Problem preparing the PDO SQL Statement. Error was: %s" -msgstr "" - -#: trunk/pdoengine.class.php:372 -#, php-format -msgid "Error while executing query! Error message was: %s" -msgstr "" - -#: trunk/pdoengine.class.php:426 -msgid "The query is too big to parse properly" -msgstr "" - -#: trunk/pdoengine.class.php:635 -#, php-format -msgid "Problem in creating table or index. Error was: %s" -msgstr "" - -#: trunk/pdoengine.class.php:678 -#, php-format -msgid "Problem in executing alter query. Error was: %s" -msgstr "" - -#: trunk/sqlite-integration.php:158 trunk/sqlite-integration.php:181 -msgid "SQLite Integration" -msgstr "" - -#: trunk/utilities/documentation.php:16 trunk/utilities/documentation.php:18 -#: trunk/utilities/patch.php:161 trunk/utilities/patch.php:163 -#: trunk/utilities/utility.php:450 trunk/utilities/utility.php:452 -#: trunk/utilities/utility.php:636 trunk/utilities/utility.php:638 -msgid "You are not allowed to access this page!" -msgstr "" - -#: trunk/utilities/documentation.php:23 trunk/utilities/documentation.php:30 -#: trunk/utilities/patch.php:221 trunk/utilities/utility.php:422 -#: trunk/utilities/utility.php:457 trunk/utilities/utility.php:711 -msgid "Documentation" -msgstr "" - -#: trunk/utilities/documentation.php:24 trunk/utilities/patch.php:222 -#: trunk/utilities/utility.php:426 trunk/utilities/utility.php:458 -#: trunk/utilities/utility.php:712 -msgid "System Info" -msgstr "" - -#: trunk/utilities/documentation.php:25 trunk/utilities/patch.php:223 -#: trunk/utilities/utility.php:430 trunk/utilities/utility.php:459 -#: trunk/utilities/utility.php:713 -msgid "Miscellaneous" -msgstr "" - -#: trunk/utilities/documentation.php:26 trunk/utilities/patch.php:224 -#: trunk/utilities/utility.php:434 trunk/utilities/utility.php:460 -#: trunk/utilities/utility.php:714 -msgid "Patch Utility" -msgstr "" - -#: trunk/utilities/documentation.php:32 -msgid "" -"This is a brief documentation about this plugin. For more details, see also " -"the Plugin " -"Page." -msgstr "" - -#: trunk/utilities/documentation.php:35 -msgid "" -"Please don't forget: WordPress DOES NOT OFFICIALLY SUPPORT any database " -"other than MySQL. So if you ask about this plugin in the Forum, it's not " -"unlikely that you won't get no answers at all." -msgstr "" - -#: trunk/utilities/documentation.php:38 -msgid "Features" -msgstr "" - -#: trunk/utilities/documentation.php:40 -msgid "" -"This plugin is a successor to PDO for WordPress, which enabled WordPress to use " -"SQLite for its database. But PDO for WordPress doesn't seem to be maintained " -"any more only to be outdated. SQLite Integration makes use of the basic " -"ideas and framework of PDO for WordPress, adds some new features and updates " -"it to be able to work with the newest version of WordPress(3.6)." -msgstr "" - -#: trunk/utilities/documentation.php:43 -msgid "" -"SQLite Web Page says — SQLite " -"is a "software library that implements selfcontained, serverless, zero-" -"configuration, transactional SQL database engine". It is "a good " -"choice for small to medium size websites". It's small and portable, and " -"you don't need any database server system." -msgstr "" - -#: trunk/utilities/documentation.php:46 -msgid "" -"Unfortunately enough, WordPress only supports MySQL. Consequently it doesn't " -"provide any APIs for SQLite. So if you want to create a website using " -"WordPress without a database server, you've got to write a kind of wrapper " -"program yourself to use SQLite. This is the way SQLite Integration goes." -msgstr "" - -#: trunk/utilities/documentation.php:49 -msgid "SQLite Integration does the work as follows:" -msgstr "" - -#: trunk/utilities/documentation.php:52 -msgid "Intercepts SQL statement for MySQL from WordPress" -msgstr "" - -#: trunk/utilities/documentation.php:53 -msgid "Rewrites it as SQLite can execute" -msgstr "" - -#: trunk/utilities/documentation.php:54 -msgid "Gives it to SQLite" -msgstr "" - -#: trunk/utilities/documentation.php:55 -msgid "Gets the results from SQLite" -msgstr "" - -#: trunk/utilities/documentation.php:56 -msgid "Format the results as MySQL returns, if necessary" -msgstr "" - -#: trunk/utilities/documentation.php:57 -msgid "Gives back the results to WordPress" -msgstr "" - -#: trunk/utilities/documentation.php:60 -msgid "" -"WordPress doesn't know what has happened in the background and will be happy " -"with it." -msgstr "" - -#: trunk/utilities/documentation.php:63 -msgid "Limitations" -msgstr "" - -#: trunk/utilities/documentation.php:65 -msgid "" -"SQLite Integration uses SQLite, so the limitations of SQLite is, as it is, " -"those of SQLite Integration. MySQL is far from a simple SQL engine and has " -"many extended features and functionalities. WordPress uses some of them. " -"Among those are some SQLite doesn't implement. For those features that " -"WordPress uses, I made them work with SQLite Integration. But for others " -"that some plugins are using, SQLite Integration can't manipulate. So..." -msgstr "" - -#: trunk/utilities/documentation.php:68 -msgid "There are some plugins that you can't use in any way.
" -msgstr "" - -#: trunk/utilities/documentation.php:69 -msgid "" -"Some plugins can't be activated or work properly. See the "Plugin " -"Compatibility/Incompatibility" section." -msgstr "" - -#: trunk/utilities/documentation.php:70 -msgid "" -"There are some plugins that you can't use without rewriting some codes in " -"them.
" -msgstr "" - -#: trunk/utilities/documentation.php:71 -#, php-format -msgid "" -"Some plugins do work fine if you rewrite MySQL functions. I made some patch " -"files and Patch Utility. See also the Plugin Page for " -"more details." -msgstr "" - -#: trunk/utilities/documentation.php:74 -msgid "" -"And there may be other problems I overlooked. If you find malfunctionality, " -"please let me know at the Support Forum." -msgstr "" - -#: trunk/utilities/documentation.php:76 -msgid "User Defined Functions" -msgstr "" - -#: trunk/utilities/documentation.php:78 -msgid "" -"SQLite Integration replaces some functions of MySQL with the user defined " -"functions built in PHP PDO library. But some of the functions are " -"meaningless in SQLite database: e.g. get_lock() or release_lock(). When " -"SQLite Integration meets those functions, it does nothing but prevent the " -"error." -msgstr "" - -#: trunk/utilities/documentation.php:81 -msgid "" -"If you want SQLite Integration to execute more functions, you can add the " -"definition in the file sqlite-integration/functions.php (functions-5-2.php " -"is for PHP 5.2 or lesser)." -msgstr "" - -#: trunk/utilities/documentation.php:84 -msgid "Database Administration and Maintenance" -msgstr "" - -#: trunk/utilities/documentation.php:86 -msgid "" -"SQLite Integration doesn't contain database maintenace functionality, " -"because there are some other free or proprietary softwares that give you " -"such functionalities. For example, these are among free softwares:" -msgstr "" - -#: trunk/utilities/documentation.php:89 -msgid "my recommendation" -msgstr "" - -#: trunk/utilities/documentation.php:90 -msgid "unfortunately seems not to maintained..." -msgstr "" - -#: trunk/utilities/documentation.php:93 -msgid "" -"I'm not sure if future release may have some of the database maintenance " -"functionality." -msgstr "" - -#: trunk/utilities/documentation.php:99 -msgid "Plugin Compatibility/Incompatibility" -msgstr "" - -#: trunk/utilities/documentation.php:101 -msgid "" -"WordPress without its plugins is a king without people. Of course, you need " -"plugins, I know." -msgstr "" - -#: trunk/utilities/documentation.php:104 -#, php-format -msgid "" -"Most of the plugins will work fine with this plugin. But there are some that " -"you need to rewrite some codes in them, and there are others that you can't " -"use with this plugin. This is the list of the problematic plugins (far from " -"complete). You can see informations about your installed plugins in the System Info page. To see more details, please " -"visit the Plugin Page." -msgstr "" - -#: trunk/utilities/documentation.php:110 -msgid "Plugins Name" -msgstr "" - -#: trunk/utilities/documentation.php:111 -msgid "Compatibility" -msgstr "" - -#: trunk/utilities/documentation.php:112 -msgid "Reasons" -msgstr "" - -#: trunk/utilities/documentation.php:126 trunk/utilities/utility.php:239 -#: trunk/utilities/utility.php:241 +#: utility.php:294 utility.php:296 documentation.php:134 msgid "Needs Patch" msgstr "" -#: trunk/utilities/documentation.php:128 trunk/utilities/utility.php:245 +#: utility.php:300 documentation.php:136 msgid "Probably No" msgstr "" -#: trunk/utilities/documentation.php:130 trunk/utilities/utility.php:251 -msgid "No" -msgstr "" - -#: trunk/utilities/documentation.php:140 -msgid "Caching Plugins" -msgstr "" - -#: trunk/utilities/documentation.php:142 -msgid "" -"Some plugins that give you cache functinality might cause problems. It is " -"because they try to create the db.php file in wp-content directory, which " -"file SQLite Integration is using." -msgstr "" - -#: trunk/utilities/documentation.php:145 -msgid "" -"If those plugins overwrite the db.php file, SQLite Integration doesn't work. " -"My recommendation is not to use caching plugins. " -"Even so, if you want a caching plugin, you could try WP Super Cache, which " -"doesn't use db.php file. But no warranty, try at your own risk." -msgstr "" - -#: trunk/utilities/documentation.php:148 -msgid "I have not tested none of those caching plugins." -msgstr "" - -#: trunk/utilities/documentation.php:150 -msgid "MySQL specific functions" -msgstr "" - -#: trunk/utilities/documentation.php:152 -msgid "" -"Some plugins don't use WordPress database functions such as dbDelta(), and " -"use PHP native MySQL functions when they create and manage tables in the " -"database. But PHP doesn't permit redefining of the native functions (at " -"least, under ordinary server setting). So SQLite Integration can't intercept " -"and rewrite those functions." -msgstr "" - -#: trunk/utilities/documentation.php:155 -msgid "For example, you can see these codes in Google XML Sitemaps." -msgstr "" - -#: trunk/utilities/documentation.php:161 -msgid "or in Camera Slideshow" -msgstr "" - -#: trunk/utilities/documentation.php:167 -msgid "" -"Such functions as mysql_get_server_info() or mysql_query() are from the " -"MySQL driver of PHP. Not only some plugins but WordPress uses them, but " -"SQLite Integration has no way to rewrite or redefine them. If the plugin you " -"want to use has those functions in it, it won't work or give the error " -"messages." -msgstr "" - -#: trunk/utilities/documentation.php:170 -msgid "" -"So, you have to rewrite them for SQLite Integration can execute. The two " -"example above can be rewritten like this:" -msgstr "" - -#: trunk/utilities/documentation.php:179 -msgid "" -"As for those functions in WordPress, I overrode the WordPress functions " -"themselves that contains such MySQL functions as mysql_query() or " -"mysql_real_escape_string()." -msgstr "" - -#: trunk/utilities/documentation.php:181 -msgid "FULLTEXT index" -msgstr "" - -#: trunk/utilities/documentation.php:183 -msgid "" -"Some plugins use FULLTEXT index of MySQL. Of course SQLite does have the " -"functionality named "full-text search". But it is not correlated " -"with that of MySQL. In fact it is not an "index" and requires " -"another new table for that. And it has a different syntax. So you can't use " -"the plugins which uses FULLTEXT index" -msgstr "" - -#: trunk/utilities/documentation.php:186 -msgid "" -"If your language is not written by separating words with spaces, e.g. " -"Japanese, Chinese or Thai, neither FULLTEXT index nor full-text search work " -"effectively. Even if your language is space-separating-words one, you don't " -"have to be disappointed. Whatever languages you use, you can use WordPress Related Posts or Related Posts or others. They are working fine " -"with SQLite Integration!" -msgstr "" - -#: trunk/utilities/patch.php:55 -msgid "Patch command is not found" -msgstr "" - -#: trunk/utilities/patch.php:58 -msgid "Patch command is not executable" -msgstr "" - -#: trunk/utilities/patch.php:75 -msgid "Patch file name is invalid" -msgstr "" - -#: trunk/utilities/patch.php:79 -msgid "Patch file version does not match with that of your plugin." -msgstr "" - -#: trunk/utilities/patch.php:88 -msgid "Error! Plugin directory is not accessible." -msgstr "" - -#: trunk/utilities/patch.php:91 -msgid "is patched successfully." -msgstr "" - -#: trunk/utilities/patch.php:96 -#, php-format -msgid "Error! Messages: %s" -msgstr "" - -#: trunk/utilities/patch.php:120 -#, php-format -msgid "File %s is deleted." -msgstr "" - -#: trunk/utilities/patch.php:122 -#, php-format -msgid "Error! File %s is not deleted." -msgstr "" - -#: trunk/utilities/patch.php:126 -msgid "Error!: patches directory is not accessible." -msgstr "" - -#: trunk/utilities/patch.php:142 -msgid "File is uploaded" -msgstr "" - -#: trunk/utilities/patch.php:146 -msgid "File is not uploaded" -msgstr "" - -#: trunk/utilities/patch.php:150 -msgid "File is not selected" -msgstr "" - -#: trunk/utilities/patch.php:168 trunk/utilities/patch.php:170 -#: trunk/utilities/patch.php:190 trunk/utilities/patch.php:192 -#: trunk/utilities/patch.php:212 trunk/utilities/patch.php:214 -msgid "You are not allowed to do this operation!" -msgstr "" - -#: trunk/utilities/patch.php:174 trunk/utilities/patch.php:196 -msgid "Please select patch file(s)" -msgstr "" - -#: trunk/utilities/patch.php:183 -msgid "None of the patches is applied!" -msgstr "" - -#: trunk/utilities/patch.php:205 -msgid "Error! Please remove files manually" -msgstr "" - -#: trunk/utilities/patch.php:228 -msgid "Patch Files Upload and Apply" -msgstr "" - -#: trunk/utilities/patch.php:229 -msgid "What you can do in this page" -msgstr "" - -#: trunk/utilities/patch.php:231 -msgid "" -"I made patch files for some plugins that are incompatible with SQLite " -"Integration and need rewriting. And I wrote in the Plugin Page about how to apply a " -"patch file to the plugin. But the command line interface sometimes " -"embarrasses some people, especially newbies." -msgstr "" - -#: trunk/utilities/patch.php:234 -msgid "" -"In this page, you can upload patch files and apply them automatically. But " -"there are some requirements." -msgstr "" - -#: trunk/utilities/patch.php:237 -msgid "" -"Think before you leap. Is the plugin to which you are going to apply patch " -"really necessary for your site? Did you search in the Plugin Directory for the substitutes?" -msgstr "" - -#: trunk/utilities/patch.php:238 -msgid "" -"Your PHP script has the permission to create a directory and write a file in " -"it." -msgstr "" - -#: trunk/utilities/patch.php:239 -msgid "Your PHP scripts can execute exec() function on the server." -msgstr "" - -#: trunk/utilities/patch.php:240 -msgid "" -"Your PHP script can execute "patch" shell command.(Script will " -"check if it is executable or not.)" -msgstr "" - -#: trunk/utilities/patch.php:243 -msgid "" -"If uploading fails, it' very likely that application will fail. When you try " -"uploading with FTP client, the patch files must be put into the directory wp-" -"content/uploads/patches/. When constant UPLOADS is defined, script follows " -"it." -msgstr "" - -#: trunk/utilities/patch.php:246 -msgid "" -"You can create your patch file yourself. When you create one, please test it " -"on your local server first and check if it works fine without PHP error or " -"notice ( set error_reporting(E_ALL) ). If you use this utility, name your " -"patch file as follows:" -msgstr "" - -#: trunk/utilities/patch.php:249 -msgid "Use the file name beginning with the plugin directory name." -msgstr "" - -#: trunk/utilities/patch.php:250 -msgid "Use the plugin version number after the directory name with underscore." -msgstr "" - -#: trunk/utilities/patch.php:251 -msgid "Use the suffix .patch." -msgstr "" - -#: trunk/utilities/patch.php:252 -msgid "Use diff command options "-Naur"." -msgstr "" - -#: trunk/utilities/patch.php:255 -msgid "" -"For example, the patch file for the plugin "Debug Bar" is "" -"debug-bar_0.8.patch". Script interprets "debug-bar" as the " -"target directory and "0.8" as the target version. If the version " -"number doesn't match with the target, script shows the error message and " -"skip applying the patch file. And script will reject any other file name." -msgstr "" - -#: trunk/utilities/patch.php:258 -msgid "How to install, patch and activate plugins" -msgstr "" - -#: trunk/utilities/patch.php:260 -msgid "Install the plugin (not yet activate it)" -msgstr "" - -#: trunk/utilities/patch.php:261 -msgid "Upload the patch file (if any) to the server and ppply it in this page" -msgstr "" - -#: trunk/utilities/patch.php:262 -msgid "Back to the installed plugin page and activate it" -msgstr "" - -#: trunk/utilities/patch.php:264 -msgid "How to upgrade plugins" -msgstr "" - -#: trunk/utilities/patch.php:266 -msgid "When upgrading the plugin, it will be safer to follow next steps." -msgstr "" - -#: trunk/utilities/patch.php:269 -msgid "Deactivate the plugin" -msgstr "" - -#: trunk/utilities/patch.php:270 -msgid "Upgrade the plugin" -msgstr "" - -#: trunk/utilities/patch.php:271 -msgid "Upload the patch file (if any) and apply it" -msgstr "" - -#: trunk/utilities/patch.php:272 -msgid "Reactivate the plugin" -msgstr "" - -#: trunk/utilities/patch.php:274 -msgid "" -"If there isn't a patch file to match with the newest version of the plugin, " -"it won't work properly. Please wait for somebody to make one or rewrite the " -"codes checking the patch file for the previous version (it's not so " -"difficult a matter, I guess, for almost all the cases, you'll have only to " -"replace the MySQL functions with the WordPress built-in functions)." -msgstr "" - -#: trunk/utilities/patch.php:275 -msgid "Upload and Apply" -msgstr "" - -#: trunk/utilities/patch.php:279 -msgid "File Select" -msgstr "" - -#: trunk/utilities/patch.php:286 -msgid "" -"Select file from your computer. If the file name is the same as existent " -"file, this operation will override it." -msgstr "" - -#: trunk/utilities/patch.php:288 -msgid "Upload" -msgstr "" - -#: trunk/utilities/patch.php:293 -msgid "Patch files uploaded" -msgstr "" - -#: trunk/utilities/patch.php:300 -msgid "" -"Select the file(s) you want to apply to the plugin(s) or you want to delete. " -"You can select multiple files." -msgstr "" - -#: trunk/utilities/patch.php:304 -msgid "Apply/Hold" -msgstr "" - -#: trunk/utilities/patch.php:305 -msgid "Patch files to apply" -msgstr "" - -#: trunk/utilities/patch.php:321 -msgid "Apply patch" -msgstr "" - -#: trunk/utilities/patch.php:321 -msgid "" -"Are you sure to apply patch files?\\n\\nClick [Cancel] to stop,[OK] to " -"continue." -msgstr "" - -#: trunk/utilities/patch.php:322 trunk/utilities/utility.php:765 -msgid "Delete file" -msgstr "" - -#: trunk/utilities/patch.php:322 -msgid "" -"Are you sure to delete patch files?\\n\\nClick [Cancel] to stop,[OK] to " -"continue." -msgstr "" - -#: trunk/utilities/patch.php:333 -msgid "Caution about your patch file(s)" -msgstr "" - -#: trunk/utilities/patch.php:337 -msgid "" -"If you don't know where it comes from or who created it, I strongly " -"recommend that you should see and check the contents of the file. If a " -"person who created it secretly inserted a malicious codes, it will be " -"executed by the plugin and may damage your site or your server, for which " -"damage I don't incur any liability. If you don't understand well, you'd " -"better use the substitute plugins. Take your own risk, please." -msgstr "" - -#: trunk/utilities/utility.php:248 +#: utility.php:303 msgid "Probably Yes" msgstr "" -#: trunk/utilities/utility.php:254 +#: utility.php:306 documentation.php:138 +msgid "No" +msgstr "" + +#: utility.php:310 +msgid "Checked*" +msgstr "" + +#: utility.php:312 msgid "Checked" msgstr "" -#: trunk/utilities/utility.php:257 trunk/utilities/utility.php:263 +#: utility.php:316 utility.php:322 msgid "Not Checked" msgstr "" -#: trunk/utilities/utility.php:268 +#: utility.php:327 msgid "Sitewide Active" msgstr "" -#: trunk/utilities/utility.php:271 +#: utility.php:330 msgid "Active" msgstr "" -#: trunk/utilities/utility.php:274 +#: utility.php:333 msgid "Inactive" msgstr "" -#: trunk/utilities/utility.php:391 +#: utility.php:434 utility.php:444 +msgid " was created." +msgstr "" + +#: utility.php:436 utility.php:446 +msgid " was not created." +msgstr "" + +#: utility.php:472 #, php-format msgid "File %s was deleted." msgstr "" -#: trunk/utilities/utility.php:393 +#: utility.php:474 msgid "Error! File was not deleted." msgstr "" -#: trunk/utilities/utility.php:404 +#: utility.php:534 msgid "Welcome to SQLite Integration" msgstr "" -#: trunk/utilities/utility.php:406 +#: utility.php:536 msgid "Thank you for using SQLite Integration plugin!" msgstr "" -#: trunk/utilities/utility.php:409 +#: utility.php:539 msgid "" "You read this message, which means you have succeeded in installing " "WordPress with this plugin SQLite Integration. Congratulations and enjoy " "your Blogging!" msgstr "" -#: trunk/utilities/utility.php:412 +#: utility.php:542 msgid "" "You don't have to set any special settings. In fact there are no other " "settings. You can write articles or pages and customize you WordPress in an " @@ -768,7 +140,7 @@ msgid "" "about this plugin and your SQLite database below." msgstr "" -#: trunk/utilities/utility.php:414 +#: utility.php:544 msgid "" "Deactivation makes this documents and utilities disappear from the " "dashboard, but it doesn't affect the functionality of the SQLite " @@ -776,117 +148,153 @@ msgid "" "directory (if exists) and wp-content/db.php file altogether." msgstr "" -#: trunk/utilities/utility.php:417 +#: utility.php:547 msgid "Title" msgstr "" -#: trunk/utilities/utility.php:418 +#: utility.php:548 msgid "Contents" msgstr "" -#: trunk/utilities/utility.php:423 +#: utility.php:552 utility.php:590 utility.php:867 +#: database_maintenance.php:453 documentation.php:30 documentation.php:38 +#: patch.php:296 +msgid "Documentation" +msgstr "" + +#: utility.php:553 msgid "You can read documentation about this plugin and plugin compatibility." msgstr "" -#: trunk/utilities/utility.php:427 +#: utility.php:556 utility.php:591 utility.php:868 +#: database_maintenance.php:454 documentation.php:31 patch.php:297 +msgid "System Info" +msgstr "" + +#: utility.php:557 msgid "You can see database and system information." msgstr "" -#: trunk/utilities/utility.php:431 +#: utility.php:560 utility.php:592 utility.php:869 +#: database_maintenance.php:455 documentation.php:32 patch.php:298 +msgid "Miscellaneous" +msgstr "" + +#: utility.php:561 msgid "" "You can see the error log and edit db.php file (if necessary) and optimize " "your database." msgstr "" -#: trunk/utilities/utility.php:435 +#: utility.php:564 utility.php:593 utility.php:870 +#: database_maintenance.php:456 documentation.php:33 patch.php:299 +msgid "Patch Utility" +msgstr "" + +#: utility.php:565 msgid "You can upload patch files and apply them to the incompatible plugins." msgstr "" -#: trunk/utilities/utility.php:464 +#: utility.php:568 utility.php:594 utility.php:871 +#: database_maintenance.php:457 documentation.php:34 patch.php:300 +msgid "Maintenance" +msgstr "" + +#: utility.php:569 +msgid "You can check your database and fix it if needed." +msgstr "" + +#: utility.php:583 utility.php:585 utility.php:774 utility.php:776 +#: database_maintenance.php:446 database_maintenance.php:448 +#: documentation.php:23 documentation.php:25 patch.php:236 patch.php:238 +msgid "You are not allowed to access this page!" +msgstr "" + +#: utility.php:598 msgid "System Information" msgstr "" -#: trunk/utilities/utility.php:465 +#: utility.php:599 msgid "PHP Informations" msgstr "" -#: trunk/utilities/utility.php:470 trunk/utilities/utility.php:506 +#: utility.php:604 utility.php:640 msgid "Items" msgstr "" -#: trunk/utilities/utility.php:471 +#: utility.php:605 msgid "Description" msgstr "" -#: trunk/utilities/utility.php:476 +#: utility.php:610 msgid "WordPress Version" msgstr "" -#: trunk/utilities/utility.php:480 +#: utility.php:614 msgid "PHP Version" msgstr "" -#: trunk/utilities/utility.php:484 +#: utility.php:618 msgid "PDO Support" msgstr "" -#: trunk/utilities/utility.php:488 +#: utility.php:622 msgid "PDO Drivers" msgstr "" -#: trunk/utilities/utility.php:492 +#: utility.php:626 msgid "PDO Driver for SQLite 3.x" msgstr "" -#: trunk/utilities/utility.php:496 +#: utility.php:630 msgid "SQLite Library Version" msgstr "" -#: trunk/utilities/utility.php:502 +#: utility.php:636 msgid "Your Database Status" msgstr "" -#: trunk/utilities/utility.php:507 +#: utility.php:641 msgid "Status" msgstr "" -#: trunk/utilities/utility.php:513 +#: utility.php:647 msgid "Database Size" msgstr "" -#: trunk/utilities/utility.php:517 +#: utility.php:651 msgid "Page Size" msgstr "" -#: trunk/utilities/utility.php:521 +#: utility.php:655 msgid "Total Number of Pages" msgstr "" -#: trunk/utilities/utility.php:525 +#: utility.php:659 msgid "Unused Page" msgstr "" -#: trunk/utilities/utility.php:529 +#: utility.php:663 msgid "Integrity Check" msgstr "" -#: trunk/utilities/utility.php:533 +#: utility.php:667 msgid "Encoding" msgstr "" -#: trunk/utilities/utility.php:537 +#: utility.php:671 msgid "Collations" msgstr "" -#: trunk/utilities/utility.php:549 +#: utility.php:683 msgid "Compile Options" msgstr "" -#: trunk/utilities/utility.php:563 +#: utility.php:697 msgid "Database Tables and Indexes" msgstr "" -#: trunk/utilities/utility.php:565 +#: utility.php:699 msgid "" "Table names in brown are required by WordPress, and those in blue are " "created by some plugins. The table sqlite_sequence is not a WordPress table " @@ -896,172 +304,206 @@ msgid "" "g. SQLiteManager)." msgstr "" -#: trunk/utilities/utility.php:570 +#: utility.php:704 msgid "Table Name" msgstr "" -#: trunk/utilities/utility.php:571 +#: utility.php:705 msgid "System/User" msgstr "" -#: trunk/utilities/utility.php:572 +#: utility.php:706 msgid "Index ( Column )" msgstr "" -#: trunk/utilities/utility.php:610 +#: utility.php:744 msgid "Plugin Info" msgstr "" -#: trunk/utilities/utility.php:612 +#: utility.php:746 msgid "This table shows plugins you have installed and their compatibility." msgstr "" -#: trunk/utilities/utility.php:617 +#: utility.php:751 msgid "Installed Plugins" msgstr "" -#: trunk/utilities/utility.php:618 +#: utility.php:752 msgid "Active/Inactive" msgstr "" -#: trunk/utilities/utility.php:619 +#: utility.php:753 msgid "Compatible" msgstr "" -#: trunk/utilities/utility.php:643 +#: utility.php:761 +msgid "" +"\"Checked*\" with an asterisk is from the users' information. I didn't check " +"myself yet. If you found any malfunctioning, please let me know." +msgstr "" + +#: utility.php:781 msgid "Log cleared" msgstr "" -#: trunk/utilities/utility.php:646 +#: utility.php:784 msgid "Log not cleared" msgstr "" -#: trunk/utilities/utility.php:658 +#: utility.php:796 msgid "db.php was saved" msgstr "" -#: trunk/utilities/utility.php:661 +#: utility.php:799 msgid "Error! db.php couldn't be saved" msgstr "" -#: trunk/utilities/utility.php:672 +#: utility.php:810 #, php-format msgid "" "Optimization finished. Before optimization: %1$s, After optimization: %2$s." msgstr "" -#: trunk/utilities/utility.php:675 +#: utility.php:813 msgid "Optimization failed" msgstr "" -#: trunk/utilities/utility.php:683 +#: utility.php:821 msgid "Couldn't find your database file." msgstr "" -#: trunk/utilities/utility.php:695 +#: utility.php:833 msgid "Please select backup file(s)." msgstr "" -#: trunk/utilities/utility.php:704 +#: utility.php:842 msgid "Error! Please remove file(s) manyally." msgstr "" -#: trunk/utilities/utility.php:718 +#: utility.php:853 +msgid "Please select backup file." +msgstr "" + +#: utility.php:856 +msgid "Please select one file at a time." +msgstr "" + +#: utility.php:875 msgid "Database Optimization, Error Log, Init File" msgstr "" -#: trunk/utilities/utility.php:719 +#: utility.php:876 msgid "Optimize You Database" msgstr "" -#: trunk/utilities/utility.php:721 +#: utility.php:878 msgid "" "This button sends "vacuum" command to your SQLite database. That " "command reclaims space after data has been deleted." msgstr "" -#: trunk/utilities/utility.php:729 +#: utility.php:886 msgid "Optimize" msgstr "" -#: trunk/utilities/utility.php:729 +#: utility.php:886 msgid "" "Are you sure to optimize your database?\\n\\nClick [Cancel] to stop, [OK] to " "continue." msgstr "" -#: trunk/utilities/utility.php:732 +#: utility.php:889 msgid "Create or Delete backup file(s)" msgstr "" -#: trunk/utilities/utility.php:734 +#: utility.php:891 msgid "" "Click the backup button below if you want to create a current snapshot of " "your database file. The backup file is named ‘DB_FILE_NAME.yyyymmdd." -"zip’ if PHP zip extension is loaded ‘DB_FILE_NAME.yyyymmdd." -"back’ if not loaded, and is put in the same directory that the database " -"is in." +"zip’ if PHP zip extension is loaded or ‘DB_FILE_NAME.yyyymmdd." +"back’ if not loaded, and is put in the same directory that the " +"database is in." msgstr "" -#: trunk/utilities/utility.php:737 +#: utility.php:894 msgid "" "If you want to delete the file(s), check the file name and click the Delete " "button. You can check multiple files." msgstr "" -#: trunk/utilities/utility.php:748 -msgid "Delete" +#: utility.php:897 +msgid "" +"If you want to download a file, check the file name and click the Download " +"button. Please check one file at a time." msgstr "" -#: trunk/utilities/utility.php:749 +#: utility.php:908 +msgid "Delete/Download" +msgstr "" + +#: utility.php:909 msgid "Backup Files" msgstr "" -#: trunk/utilities/utility.php:764 +#: utility.php:924 msgid "Backup" msgstr "" -#: trunk/utilities/utility.php:764 +#: utility.php:924 msgid "" "Are you sure to make a backup file?\\n\\nClick [Cancel] to stop, [OK] to " "continue." msgstr "" -#: trunk/utilities/utility.php:765 +#: utility.php:925 patch.php:399 +msgid "Delete file" +msgstr "" + +#: utility.php:925 msgid "" "Are you sure to delete backup file(s)?\\n\\nClick [Cancel] to stop, [OK] to " "continue." msgstr "" -#: trunk/utilities/utility.php:768 +#: utility.php:926 +msgid "Download" +msgstr "" + +#: utility.php:926 +msgid "" +"Are you sure to download backup file?\\n\\nClick [Cancel] to stop, [OK] to " +"continue." +msgstr "" + +#: utility.php:929 msgid "SQLite Integration Error Log" msgstr "" -#: trunk/utilities/utility.php:770 +#: utility.php:931 msgid "" "This is the contents of SQLite Integration error log file(default: wp-" "content/database/debug.txt). If you want to clear this file, click the Clear " "Log button." msgstr "" -#: trunk/utilities/utility.php:780 +#: utility.php:941 msgid "No error messages are found" msgstr "" -#: trunk/utilities/utility.php:788 +#: utility.php:949 msgid "Clear Log" msgstr "" -#: trunk/utilities/utility.php:788 +#: utility.php:949 msgid "" "Are you sure to clear Log?\\n\\nClick [Cancel] to stop, [OK] to continue." msgstr "" -#: trunk/utilities/utility.php:792 +#: utility.php:953 msgid "Edit Initial File (wp-content/db.php)" msgstr "" -#: trunk/utilities/utility.php:794 +#: utility.php:955 msgid "" "When you go "Plugins » Edit Plugin" page, you can edit " "plugin source file. But you can't see this file there because it is not in " @@ -1070,12 +512,672 @@ msgid "" "well, please don't edit this file." msgstr "" -#: trunk/utilities/utility.php:804 +#: utility.php:965 msgid "Save" msgstr "" -#: trunk/utilities/utility.php:804 +#: utility.php:965 msgid "" "Are you sure to save this file?\\n\\nClick [Cancel] to stop, [OK] to " "continue." msgstr "" + +#: database_maintenance.php:344 +msgid "Can't create backup file." +msgstr "" + +#: database_maintenance.php:363 +msgid "Failed: " +msgstr "" + +#: database_maintenance.php:368 database_maintenance.php:561 +msgid "Your database is OK. You don't have to restore it." +msgstr "" + +#: database_maintenance.php:372 +msgid "Your database restoration is successfully finished!" +msgstr "" + +#: database_maintenance.php:391 +msgid "Table name is not selected." +msgstr "" + +#: database_maintenance.php:394 +msgid "There's no such table." +msgstr "" + +#: database_maintenance.php:461 +msgid "Database Maintenace" +msgstr "" + +#: database_maintenance.php:462 +msgid "Important Notice" +msgstr "" + +#: database_maintenance.php:464 +msgid "" +"When you installed WordPress 3.5.x with SQLite Integration and upgraded to " +"3.6, your database might not function as expected." +msgstr "" + +#: database_maintenance.php:465 +msgid "" +"This page provide you the database sanity check utility and the restore " +"utility." +msgstr "" + +#: database_maintenance.php:468 +msgid "" +"Click \"Sanity Check\" button first, and see if you need to fix database or " +"not. If needed, click \"Fix Database\" button. Afterward you may go to " +"Miscellaneous page and optimize database (this is not required)." +msgstr "" + +#: database_maintenance.php:471 +msgid "" +"Fix Database procedure will create a database backup file each time the " +"button clicked. The backup file is named with \"maintenance-backup\", so you " +"can remove it if you don't need it. Please go to Miscellaneous page and " +"check if there is one." +msgstr "" + +#: database_maintenance.php:474 +msgid "" +"If you installed WordPress 3.6 (not upgraded), you don't have to restore the " +"database." +msgstr "" + +#: database_maintenance.php:483 +msgid "Sanity Check" +msgstr "" + +#: database_maintenance.php:483 +msgid "" +"Are you sure to check the database? This will take some time.\\n\\nClick " +"[Cancel] to stop, [OK] to continue." +msgstr "" + +#: database_maintenance.php:484 +msgid "Fix database" +msgstr "" + +#: database_maintenance.php:484 +msgid "" +"Are you sure to do fix the database? This will take some time.\\n\\nClick " +"[Cancel] to stop, [OK] to continue." +msgstr "" + +#: database_maintenance.php:488 +msgid "Columns Information" +msgstr "" + +#: database_maintenance.php:490 +msgid "" +"Select a table name and click \"Display Columns\" button, and you'll see the " +"column property of that table. This information is for debug use." +msgstr "" + +#: database_maintenance.php:501 +msgid "Table Name: " +msgstr "" + +#: database_maintenance.php:507 +msgid "Display Columns" +msgstr "" + +#: database_maintenance.php:507 +msgid "" +"Display columns in the selected table.\\n\\nClick [Cancel] to stop, [OK] to " +"continue." +msgstr "" + +#: database_maintenance.php:517 database_maintenance.php:519 +#: database_maintenance.php:543 database_maintenance.php:545 +#: database_maintenance.php:571 database_maintenance.php:573 patch.php:243 +#: patch.php:245 patch.php:265 patch.php:267 patch.php:287 patch.php:289 +msgid "You are not allowed to do this operation!" +msgstr "" + +#: database_maintenance.php:523 database_maintenance.php:533 +msgid "Results" +msgstr "" + +#: database_maintenance.php:549 database_maintenance.php:560 +msgid "Checked Results" +msgstr "" + +#: database_maintenance.php:554 +msgid " needs restoring." +msgstr "" + +#: database_maintenance.php:577 +#, php-format +msgid "Columns In %s" +msgstr "" + +#: database_maintenance.php:578 +msgid "Column" +msgstr "" + +#: database_maintenance.php:579 +msgid "Type" +msgstr "" + +#: database_maintenance.php:580 +msgid "Null" +msgstr "" + +#: database_maintenance.php:581 +msgid "Default" +msgstr "" + +#: database_maintenance.php:598 +msgid "Columns Info" +msgstr "" + +#: documentation.php:40 +msgid "" +"This is a brief documentation about this plugin. For more details, see also " +"the SQLite " +"Integration page." +msgstr "" + +#: documentation.php:43 +msgid "" +"Please don't forget: WordPress DOES NOT OFFICIALLY SUPPORT any database " +"other than MySQL. So if you ask about this plugin in the Forum, it's not " +"unlikely that you won't get no answers at all." +msgstr "" + +#: documentation.php:46 +msgid "Features" +msgstr "" + +#: documentation.php:48 +msgid "" +"This plugin is a successor to PDO for WordPress, which enabled WordPress to use " +"SQLite for its database. But PDO for WordPress doesn't seem to be maintained " +"any more only to be outdated. SQLite Integration makes use of the basic " +"ideas and framework of PDO for WordPress, adds some new features and updates " +"it to be able to work with the newest version of WordPress(3.8.1)." +msgstr "" + +#: documentation.php:51 +msgid "" +"SQLite Web Page says — SQLite " +"is a "software library that implements selfcontained, serverless, zero-" +"configuration, transactional SQL database engine". It is "a good " +"choice for small to medium size websites". It's small and portable, and " +"you don't need any database server system." +msgstr "" + +#: documentation.php:54 +msgid "" +"Unfortunately enough, WordPress only supports MySQL. Consequently it doesn't " +"provide any APIs for SQLite. So if you want to create a website using " +"WordPress without a database server, you've got to write a kind of wrapper " +"program yourself to use SQLite. This is the way SQLite Integration goes." +msgstr "" + +#: documentation.php:57 +msgid "SQLite Integration does the work as follows:" +msgstr "" + +#: documentation.php:60 +msgid "Intercepts SQL statement for MySQL from WordPress" +msgstr "" + +#: documentation.php:61 +msgid "Rewrites it as SQLite can execute" +msgstr "" + +#: documentation.php:62 +msgid "Gives it to SQLite" +msgstr "" + +#: documentation.php:63 +msgid "Gets the results from SQLite" +msgstr "" + +#: documentation.php:64 +msgid "Format the results as MySQL returns, if necessary" +msgstr "" + +#: documentation.php:65 +msgid "Gives back the results to WordPress" +msgstr "" + +#: documentation.php:68 +msgid "" +"WordPress doesn't know what has happened in the background and will be happy " +"with it." +msgstr "" + +#: documentation.php:71 +msgid "Limitations" +msgstr "" + +#: documentation.php:73 +msgid "" +"SQLite Integration uses SQLite, so the limitations of SQLite is, as it is, " +"those of SQLite Integration. MySQL is far from a simple SQL engine and has " +"many extended features and functionalities. WordPress uses some of them. " +"Among those are some SQLite doesn't implement. For those features that " +"WordPress uses, I made them work with SQLite Integration. But for others " +"that some plugins are using, SQLite Integration can't manipulate. So..." +msgstr "" + +#: documentation.php:76 +msgid "There are some plugins that you can't use. No way around.
" +msgstr "" + +#: documentation.php:77 +msgid "" +"Some plugins can't be activated or work properly. See the "Plugin " +"Compatibility/Incompatibility" section." +msgstr "" + +#: documentation.php:78 +msgid "" +"There are some plugins that you can't use without rewriting some codes in " +"them.
" +msgstr "" + +#: documentation.php:79 +#, php-format +msgid "" +"Some plugins do work fine if you rewrite MySQL functions. I made some patch " +"files and Patch Utility. See also the SQLite " +"Integration Page for more details." +msgstr "" + +#: documentation.php:82 +msgid "" +"And there may be other problems I overlooked. If you find malfunctionality, " +"please let me know at the Support Forum." +msgstr "" + +#: documentation.php:84 +msgid "User Defined Functions" +msgstr "" + +#: documentation.php:86 +msgid "" +"SQLite Integration replaces some functions of MySQL with the user defined " +"functions built in PHP PDO library. But some of the functions are " +"meaningless in SQLite database: e.g. get_lock() or release_lock(). When " +"SQLite Integration meets those functions, it does nothing but prevent the " +"error." +msgstr "" + +#: documentation.php:89 +msgid "" +"If you want SQLite Integration to execute more functions, you can add the " +"definition in the file sqlite-integration/functions.php (functions-5-2.php " +"is for PHP 5.2 or lesser)." +msgstr "" + +#: documentation.php:92 +msgid "Database Administration and Maintenance" +msgstr "" + +#: documentation.php:94 +msgid "" +"SQLite Integration doesn't contain database maintenace functionality, " +"because there are some other free or proprietary softwares that give you " +"such functionalities. For example, these are among free softwares:" +msgstr "" + +#: documentation.php:97 +msgid "my recommendation" +msgstr "" + +#: documentation.php:98 +msgid "unfortunately seems not to maintained..." +msgstr "" + +#: documentation.php:101 +msgid "" +"I'm not sure if future release may have some of the database maintenance " +"functionality." +msgstr "" + +#: documentation.php:107 +msgid "Plugin Compatibility/Incompatibility" +msgstr "" + +#: documentation.php:109 +msgid "" +"WordPress without its plugins is a king without people. Of course, you need " +"plugins, I know." +msgstr "" + +#: documentation.php:112 +#, php-format +msgid "" +"This is the list of the problematic plugins (far from complete). You can see " +"informations about your installed plugins in the System Info page. To see more details, please visit the Plugin Page." +msgstr "" + +#: documentation.php:118 +msgid "Plugins Name" +msgstr "" + +#: documentation.php:119 +msgid "Compatibility" +msgstr "" + +#: documentation.php:120 +msgid "Reasons" +msgstr "" + +#: patch.php:67 +msgid "Patch command is not found" +msgstr "" + +#: patch.php:70 +msgid "Patch command is not executable" +msgstr "" + +#: patch.php:87 +msgid "Patch file name is invalid" +msgstr "" + +#: patch.php:91 +msgid "Patch file version does not match with that of your plugin." +msgstr "" + +#: patch.php:100 +msgid "Error! Plugin directory is not accessible." +msgstr "" + +#: patch.php:103 +msgid "is patched successfully." +msgstr "" + +#: patch.php:108 +#, php-format +msgid "Error! Messages: %s" +msgstr "" + +#: patch.php:136 +#, php-format +msgid "File %s is deleted." +msgstr "" + +#: patch.php:138 +#, php-format +msgid "Error! File %s is not deleted." +msgstr "" + +#: patch.php:142 +msgid "Error!: patches directory is not accessible." +msgstr "" + +#: patch.php:163 +msgid "Unable to create a patch directory." +msgstr "" + +#: patch.php:171 +msgid "Unable to create a .htaccess file." +msgstr "" + +#: patch.php:179 +msgid "Invalid operation." +msgstr "" + +#: patch.php:185 +msgid "File is too large to upload." +msgstr "" + +#: patch.php:189 +msgid "File upload is not complete." +msgstr "" + +#: patch.php:193 +msgid "File is not uploaded." +msgstr "" + +#: patch.php:197 +msgid "Temporary directory is not writable." +msgstr "" + +#: patch.php:201 +msgid "File cannot be written on the disk." +msgstr "" + +#: patch.php:205 +msgid "Unknown error." +msgstr "" + +#: patch.php:213 +msgid "File is successfully uploaded." +msgstr "" + +#: patch.php:217 +msgid "File upload failed. Possible file upload attack." +msgstr "" + +#: patch.php:222 +msgid "File is not selected" +msgstr "" + +#: patch.php:249 patch.php:271 +msgid "Please select patch file(s)" +msgstr "" + +#: patch.php:258 +msgid "None of the patches is applied!" +msgstr "" + +#: patch.php:280 +msgid "Error! Please remove files manually" +msgstr "" + +#: patch.php:304 +msgid "Patch Files Upload and Apply" +msgstr "" + +#: patch.php:305 +msgid "What you can do in this page" +msgstr "" + +#: patch.php:307 +msgid "" +"I made patch files for some plugins that are incompatible with SQLite " +"Integration and need rewriting. And I wrote in the Plugin Page about how to apply a " +"patch file to the plugin. But the command line interface sometimes " +"embarrasses some people, especially newbies." +msgstr "" + +#: patch.php:310 +msgid "" +"In this page, you can upload patch files and apply them automatically. But " +"there are some requirements." +msgstr "" + +#: patch.php:313 +msgid "" +"Think before you leap. Is the plugin to which you are going to apply patch " +"really necessary for your site? Did you search in the Plugin Directory for the substitutes?" +msgstr "" + +#: patch.php:314 +msgid "" +"Your PHP script has the permission to create a directory and write a file in " +"it." +msgstr "" + +#: patch.php:315 +msgid "Your PHP scripts can execute exec() function on the server." +msgstr "" + +#: patch.php:316 +msgid "" +"Your PHP script can execute "patch" shell command.(Script will " +"check if it is executable or not.)" +msgstr "" + +#: patch.php:319 +msgid "" +"If uploading fails, it' very likely that application will fail. When you try " +"uploading with FTP client, the patch files must be put into the directory wp-" +"content/uploads/patches/. When constant UPLOADS is defined, script follows " +"it." +msgstr "" + +#: patch.php:322 +msgid "" +"You can create your patch file yourself. When you create one, please test it " +"on your local server first and check if it works fine without PHP error or " +"notice ( set error_reporting(E_ALL) ). If you use this utility, name your " +"patch file as follows:" +msgstr "" + +#: patch.php:325 +msgid "Use the file name beginning with the plugin directory name." +msgstr "" + +#: patch.php:326 +msgid "Use the plugin version number after the directory name with underscore." +msgstr "" + +#: patch.php:327 +msgid "Use the suffix .patch." +msgstr "" + +#: patch.php:328 +msgid "Use diff command options "-Naur"." +msgstr "" + +#: patch.php:331 +msgid "" +"For example, the patch file for the plugin "Debug Bar" is "" +"debug-bar_0.8.patch". Script interprets "debug-bar" as the " +"target directory and "0.8" as the target version. If the version " +"number doesn't match with the target, script shows the error message and " +"skip applying the patch file. And script will reject any other file name." +msgstr "" + +#: patch.php:334 +msgid "How to install, patch and activate plugins" +msgstr "" + +#: patch.php:336 +msgid "Install the plugin (not yet activate it)" +msgstr "" + +#: patch.php:337 +msgid "Upload the patch file (if any) to the server and ppply it in this page" +msgstr "" + +#: patch.php:338 +msgid "Back to the installed plugin page and activate it" +msgstr "" + +#: patch.php:340 +msgid "How to upgrade plugins" +msgstr "" + +#: patch.php:342 +msgid "When upgrading the plugin, it will be safer to follow next steps." +msgstr "" + +#: patch.php:345 +msgid "Deactivate the plugin" +msgstr "" + +#: patch.php:346 +msgid "Upgrade the plugin" +msgstr "" + +#: patch.php:347 +msgid "Upload the patch file (if any) and apply it" +msgstr "" + +#: patch.php:348 +msgid "Reactivate the plugin" +msgstr "" + +#: patch.php:350 +msgid "" +"If there isn't a patch file to match with the newest version of the plugin, " +"it won't work properly. Please wait for somebody to make one or rewrite the " +"codes checking the patch file for the previous version (it's not so " +"difficult a matter, I guess, for almost all the cases, you'll have only to " +"replace the MySQL functions with the WordPress built-in functions)." +msgstr "" + +#: patch.php:351 +msgid "Upload and Apply" +msgstr "" + +#: patch.php:355 +msgid "File Select" +msgstr "" + +#: patch.php:363 +msgid "" +"Select file from your computer. If the file name is the same as existent " +"file, this operation will override it. You can't upload the file whose size " +"is over 500kB." +msgstr "" + +#: patch.php:365 +msgid "Upload" +msgstr "" + +#: patch.php:370 +msgid "Patch files uploaded" +msgstr "" + +#: patch.php:377 +msgid "" +"Select the file(s) you want to apply to the plugin(s) or you want to delete. " +"You can select multiple files." +msgstr "" + +#: patch.php:381 +msgid "Apply/Hold" +msgstr "" + +#: patch.php:382 +msgid "Patch files to apply" +msgstr "" + +#: patch.php:398 +msgid "Apply patch" +msgstr "" + +#: patch.php:398 +msgid "" +"Are you sure to apply patch files?\\n\\nClick [Cancel] to stop,[OK] to " +"continue." +msgstr "" + +#: patch.php:399 +msgid "" +"Are you sure to delete patch files?\\n\\nClick [Cancel] to stop,[OK] to " +"continue." +msgstr "" + +#: patch.php:410 +msgid "Caution about your patch file(s)" +msgstr "" + +#: patch.php:414 +msgid "" +"If you don't know where it comes from or who created it, I strongly " +"recommend that you should see and check the contents of the file. If a " +"person who created it secretly inserted a malicious codes, it will be " +"executed by the plugin and may damage your site or your server, for which " +"damage I don't incur any liability. If you don't understand well, you'd " +"better use the substitute plugins. Take your own risk, please." +msgstr "" diff --git a/pdodb.class.php b/pdodb.class.php index 465d5ed..4058a9b 100644 --- a/pdodb.class.php +++ b/pdodb.class.php @@ -149,7 +149,22 @@ class PDODB extends wpdb { "; } } - + /** + * Method to flush cached data. + * + * This overrides wpdb::flush(). This is not necessarily overridden, because + * $result will never be resource. + * + * @see wpdb::flush + */ + function flush() { + $this->last_result = array(); + $this->col_info = null; + $this->last_query = null; + $this->rows_affected = $this->num_rows = 0; + $this->last_error = ''; + $this->result = null; + } /** * Method to do the database connection. * @@ -234,8 +249,9 @@ class PDODB extends wpdb { * This overrides wpdb::load_col_info(), which uses a mysql function. * * @see wpdb::load_col_info() + * @access protected */ - function load_col_info() { + protected function load_col_info() { if ($this->col_info) return; $this->col_info = $this->dbh->get_columns(); @@ -266,13 +282,14 @@ class PDODB extends wpdb { * * This overrides wpdb::db_version() to avoid using MySQL function. * It returns mysql version number, but it means nothing for SQLite. - * So it return the required mysql version. + * So it return the newest mysql version. * * @see wpdb::db_version() */ function db_version() { - global $required_mysql_version; - return $required_mysql_version; +// global $required_mysql_version; +// return $required_mysql_version; + return '5.5'; } } diff --git a/pdoengine.class.php b/pdoengine.class.php index fd574b4..f636b4f 100644 --- a/pdoengine.class.php +++ b/pdoengine.class.php @@ -110,18 +110,44 @@ class PDOEngine extends PDO { */ private $affected_rows; /** - * Class variable to store the queried column names. + * Class variable to store the queried column info. * * @var array */ - private $column_names; + private $column_data; + /** + * Variable to emulate MySQL affected row. + * + * @var integer + */ private $num_rows; + /** + * Return value from query(). + * + * Each query has its own return value. + * + * @var mixed + */ private $return_value; + /** + * Variable to determine which insert query to use. + * + * Whether VALUES clause in the INSERT query can take multiple values or not + * depends on the version of SQLite library. We check the version and set + * this varable to true or false. + * + * @var boolean + */ private $can_insert_multiple_rows = false; + /** + * + * @var integer + */ private $param_num; /** * Varible to check if there is an active transaction. * @var boolean + * @access protected */ protected $has_active_transaction = false; @@ -144,7 +170,7 @@ class PDOEngine extends PDO { } /** - * Function to initialize database. + * Function to initialize database, executed in the contructor. * * It checks if there's a database directory and database file, creates the tables, * and binds the user defined function to the pdo object. @@ -152,7 +178,7 @@ class PDOEngine extends PDO { * @return boolean */ private function init() { - $dsn = 'sqlite:' . FQDB; + $dsn = 'sqlite:' . FQDB; $result = $this->prepare_directory(); if (!$result) return false; if (is_file(FQDB)) { @@ -167,9 +193,9 @@ class PDOEngine extends PDO { array( // PDO options PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION )); - $statement = $this->pdo->query("SELECT COUNT(*) FROM sqlite_master WHERE type='table'"); + $statement = $this->pdo->query("SELECT COUNT(*) FROM sqlite_master WHERE type='table'"); $number_of_tables = $statement->fetchColumn(0); - $statement = null; + $statement = null; if ($number_of_tables == 0) { $this->make_sqlite_tables(); } @@ -180,7 +206,7 @@ class PDOEngine extends PDO { if ($status == 5 || $status == 6) { $locked = true; } else { - $message = 'Database connection error!
'; + $message = 'Database connection error!
'; $message .= sprintf("Error message is: %s", $err->getMessage()); $this->set_error(__LINE__, __FUNCTION__, $message); return false; @@ -196,7 +222,7 @@ class PDOEngine extends PDO { try { $this->pdo = new PDO($dsn, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); } catch (PDOException $err) { - $message = 'Database initialization error!
'; + $message = 'Database initialization error!
'; $message .= sprintf("Error message is: %s", $err->getMessage()); $this->set_error(__LINE__, __FUNCTION__, $message); return false; @@ -259,7 +285,7 @@ class PDOEngine extends PDO { public function query($query) { $this->flush(); - $this->queries[] = "Raw query:\t$query"; + $this->queries[] = "Raw query:\n$query"; $res = $this->determine_query_type($query); if (!$res) { $bailoutString = sprintf(__("

Unknown query type

Sorry, we cannot determine the type of query that is requested.

The query is %s

", 'sqlite-integration'), $query); @@ -268,14 +294,14 @@ class PDOEngine extends PDO { switch (strtolower($this->query_type)) { case 'foundrows': $_column = array('FOUND_ROWS()' => ''); - $column = array(); + $column = array(); if (!is_null($this->found_rows_result)) { $this->num_rows = count($this->found_rows_result); foreach ($this->found_rows_result[0] as $key => $value) { $_column['FOUND_ROWS()'] = $value; } - $column[] = new ObjectArray($_column); - $this->results = $column; + $column[] = new ObjectArray($_column); + $this->results = $column; $this->found_rows_result = null; } break; @@ -300,9 +326,9 @@ class PDOEngine extends PDO { case 'drop_index': $pattern = '/^\\s*(DROP\\s*INDEX\\s*.*?)\\s*ON\\s*(.*)/im'; if (preg_match($pattern, $query, $match)) { - $drop_query = 'ALTER TABLE ' . trim($match[2]) . ' ' . trim($match[1]); - $this->query_type = 'alter'; - $result = $this->execute_alter_query($drop_query); + $drop_query = 'ALTER TABLE ' . trim($match[2]) . ' ' . trim($match[1]); + $this->query_type = 'alter'; + $result = $this->execute_alter_query($drop_query); $this->return_value = $result; } else { $this->return_value = false; @@ -311,7 +337,7 @@ class PDOEngine extends PDO { default: $engine = $this->prepare_engine($this->query_type); $this->rewritten_query = $engine->rewrite_query($query, $this->query_type); - $this->queries[] = "Rewritten: $this->rewritten_query"; + $this->queries[] = "Rewritten:\n$this->rewritten_query"; $this->extract_variables(); $statement = $this->prepare_query(); $this->execute_query($statement); @@ -346,10 +372,58 @@ class PDOEngine extends PDO { /** * Function to return the queried column names. * - * @return string + * These data are meaningless for SQLite. So they are dummy emulating + * MySQL columns data. + * + * @return array of the object */ public function get_columns() { - return $this->column_names; + if (!empty($this->results)) { + $primary_key = array( + 'meta_id', 'comment_ID', 'link_ID', 'option_id', + 'blog_id', 'option_name', 'ID', 'term_id', 'object_id', + 'term_taxonomy_id', 'umeta_id', 'id'); + $unique_key = array('term_id', 'taxonomy', 'slug'); + $data = array( + 'name' => '', // column name + 'table' => '', // table name + 'max_length' => 0, // max length of the column + 'not_null' => 1, // 1 if not null + 'primary_key' => 0, // 1 if column has primary key + 'unique_key' => 0, // 1 if column has unique key + 'multiple_key' => 0, // 1 if column doesn't have unique key + 'numeric' => 0, // 1 if column has numeric value + 'blob' => 0, // 1 if column is blob + 'type' => '', // type of the column + 'unsigned' => 0, // 1 if column is unsigned integer + 'zerofill' => 0 // 1 if column is zero-filled + ); + if (preg_match("/\s*FROM\s*(.*)?\s*/i", $this->rewritten_query, $match)) { + $table_name = trim($match[1]); + } else { + $table_name = ''; + } + foreach ($this->results[0] as $key => $value) { + $data['name'] = $key; + $data['table'] = $table_name; + if (in_array($key, $primary_key)) { + $data['primary_key'] = 1; + } elseif (in_array($key, $unique_key)) { + $data['unique_key'] = 1; + } else { + $data['multiple_key'] = 1; + } + $this->column_data[] = new ObjectArray($data); + $data['name'] = ''; + $data['table'] = ''; + $data['primary_key'] = 0; + $data['unique_key'] = 0; + $data['multiple_key'] = 0; + } + return $this->column_data; + } else { + return null; + } } /** * Function to return the queried result data. @@ -382,7 +456,7 @@ class PDOEngine extends PDO { */ public function get_error_message(){ if (count($this->error_messages) === 0){ - $this->is_error = false; + $this->is_error = false; $this->error_messages = array(); return ''; } @@ -429,7 +503,7 @@ class PDOEngine extends PDO { $this->_results = null; $this->last_insert_id = null; $this->affected_rows = null; - $this->column_names = array(); + $this->column_data = array(); $this->num_rows = null; $this->return_value = null; $this->extracted_variables = array(); @@ -466,15 +540,15 @@ class PDOEngine extends PDO { * @return PDOStatement */ private function prepare_query(){ - $this->queries[] = 'Prepare: ' . $this->prepared_query; - $reason = 0; - $message = ''; - $statement = null; + $this->queries[] = "Prepare:\n" . $this->prepared_query; + $reason = 0; + $message = ''; + $statement = null; do { try { $statement = $this->pdo->prepare($this->prepared_query); } catch (PDOException $err) { - $reason = $err->getCode(); + $reason = $err->getCode(); $message = $err->getMessage(); } } while (5 == $reason || 6 == $reason); @@ -496,12 +570,12 @@ class PDOEngine extends PDO { * @return boolean */ private function execute_query($statement) { - $reason = 0; + $reason = 0; $message = ''; if (!is_object($statement)) return false; if (count($this->extracted_variables) > 0) { - $this->queries[] = 'Executing: ' . var_export($this->extracted_variables, true); + $this->queries[] = "Executing:\n" . var_export($this->extracted_variables, true); do { if ($this->query_type == 'update' || $this->query_type == 'replace') { try { @@ -509,7 +583,7 @@ class PDOEngine extends PDO { $statement->execute($this->extracted_variables); $this->commit(); } catch (PDOException $err) { - $reason = $err->getCode(); + $reason = $err->getCode(); $message = $err->getMessage(); $this->rollBack(); } @@ -517,7 +591,7 @@ class PDOEngine extends PDO { try { $statement->execute($this->extracted_variables); } catch (PDOException $err) { - $reason = $err->getCode(); + $reason = $err->getCode(); $message = $err->getMessage(); } } @@ -531,7 +605,7 @@ class PDOEngine extends PDO { $statement->execute(); $this->commit(); } catch (PDOException $err) { - $reason = $err->getCode(); + $reason = $err->getCode(); $message = $err->getMessage(); $this->rollBack(); } @@ -539,7 +613,7 @@ class PDOEngine extends PDO { try { $statement->execute(); } catch (PDOException $err) { - $reason = $err->getCode(); + $reason = $err->getCode(); $message = $err->getMessage(); } } @@ -558,8 +632,8 @@ class PDOEngine extends PDO { case 'update': case 'replace': $this->last_insert_id = $this->pdo->lastInsertId(); - $this->affected_rows = $statement->rowCount(); - $this->return_value = $this->affected_rows; + $this->affected_rows = $statement->rowCount(); + $this->return_value = $this->affected_rows; break; case 'select': case 'show': @@ -570,12 +644,12 @@ class PDOEngine extends PDO { case 'check': case 'analyze': // case "foundrows": - $this->num_rows = count($this->_results); + $this->num_rows = count($this->_results); $this->return_value = $this->num_rows; break; case 'delete': $this->affected_rows = $statement->rowCount(); - $this->return_value = $this->affected_rows; + $this->return_value = $this->affected_rows; break; case 'alter': case 'drop': @@ -606,7 +680,7 @@ class PDOEngine extends PDO { //long queries can really kill this $pattern = '/(? 10000000) { $message = 'The query is too big to parse properly'; @@ -621,7 +695,7 @@ class PDOEngine extends PDO { //reset the pcre.backtrack_limist ini_set('pcre.backtrack_limit', $_limit); - $this->queries[]= 'With Placeholders: ' . $query; + $this->queries[] = "With Placeholders:\n" . $query; $this->prepared_query = $query; } /** @@ -699,11 +773,11 @@ class PDOEngine extends PDO { * @param string $query */ private function execute_insert_query_new($query) { - $engine = $this->prepare_engine($this->query_type); + $engine = $this->prepare_engine($this->query_type); $this->rewritten_query = $engine->rewrite_query($query, $this->query_type); - $this->queries[] = 'Rewritten: ' . $this->rewritten_query; + $this->queries[] = "Rewritten:\n" . $this->rewritten_query; $this->extract_variables(); - $statement = $this->prepare_query(); + $statement = $this->prepare_query(); $this->execute_query($statement); } /** @@ -717,11 +791,11 @@ class PDOEngine extends PDO { private function execute_insert_query($query) { global $wpdb; $multi_insert = false; - $statement = null; - $engine = $this->prepare_engine($this->query_type); + $statement = null; + $engine = $this->prepare_engine($this->query_type); if (preg_match('/(INSERT.*?VALUES\\s*)(\(.*\))/imsx', $query, $matched)) { $query_prefix = $matched[1]; - $values_data = $matched[2]; + $values_data = $matched[2]; if (stripos($values_data, 'ON DUPLICATE KEY') !== false) { $exploded_parts = $values_data; } elseif (stripos($query_prefix, "INSERT INTO $wpdb->comments") !== false) { @@ -742,9 +816,9 @@ class PDOEngine extends PDO { } else { $suffix = ')'; } - $query_string = $query_prefix . ' ' . $value . $suffix; - $this->rewritten_query = $engine->rewrite_query($query_string, $this->query_type); - $this->queries[] = 'Rewritten: ' . $this->rewritten_query; + $query_string = $query_prefix . ' ' . $value . $suffix; + $this->rewritten_query = $engine->rewrite_query($query_string, $this->query_type); + $this->queries[] = "Rewritten:\n" . $this->rewritten_query; $this->extracted_variables = array(); $this->extract_variables(); if ($first) { @@ -757,7 +831,7 @@ class PDOEngine extends PDO { } } else { $this->rewritten_query = $engine->rewrite_query($query, $this->query_type); - $this->queries[] = 'Rewritten: ' . $this->rewritten_query; + $this->queries[] = "Rewritten:\n" . $this->rewritten_query; $this->extract_variables(); $statement = $this->prepare_query(); $this->execute_query($statement); @@ -813,22 +887,22 @@ class PDOEngine extends PDO { * @return boolean */ private function execute_create_query($query) { - $engine = $this->prepare_engine($this->query_type); + $engine = $this->prepare_engine($this->query_type); $rewritten_query = $engine->rewrite_query($query); - $reason = 0; - $message = ''; + $reason = 0; + $message = ''; // $queries = explode(";", $this->rewritten_query); try { $this->beginTransaction(); foreach ($rewritten_query as $single_query) { - $this->queries[] = "Executing:\t" . $single_query; - $single_query = trim($single_query); + $this->queries[] = "Executing:\n" . $single_query; + $single_query = trim($single_query); if (empty($single_query)) continue; $this->pdo->exec($single_query); } $this->commit(); } catch (PDOException $err) { - $reason = $err->getCode(); + $reason = $err->getCode(); $message = $err->getMessage(); if (5 == $reason || 6 == $reason) { $this->commit(); @@ -850,10 +924,10 @@ class PDOEngine extends PDO { * @return boolean */ private function execute_alter_query($query) { - $engine = $this->prepare_engine($this->query_type); - $reason = 0; - $message = ''; - $re_query = ''; + $engine = $this->prepare_engine($this->query_type); + $reason = 0; + $message = ''; + $re_query = ''; $rewritten_query = $engine->rewrite_query($query, $this->query_type); if (is_array($rewritten_query) && array_key_exists('recursion', $rewritten_query)) { $re_query = $rewritten_query['recursion']; @@ -863,19 +937,19 @@ class PDOEngine extends PDO { $this->beginTransaction(); if (is_array($rewritten_query)) { foreach ($rewritten_query as $single_query) { - $this->queries[] = "Executing:\t" . $single_query; - $single_query = trim($single_query); + $this->queries[] = "Executing:\n" . $single_query; + $single_query = trim($single_query); if (empty($single_query)) continue; $this->pdo->exec($single_query); } } else { - $this->queries[] = "Executing:\t" . $rewritten_query; + $this->queries[] = "Executing:\n" . $rewritten_query; $rewritten_query = trim($rewritten_query); $this->pdo->exec($rewritten_query); } $this->commit(); } catch (PDOException $err) { - $reason = $err->getCode(); + $reason = $err->getCode(); $message = $err->getMessage(); if (5 == $reason || 6 == $reason) { $this->commit(); @@ -906,7 +980,7 @@ class PDOEngine extends PDO { */ private function show_variables_workaround($query) { $dummy_data = array('Variable_name' => '', 'Value' => null); - $pattern = '/SHOW\\s*VARIABLES\\s*LIKE\\s*(.*)?$/im'; + $pattern = '/SHOW\\s*VARIABLES\\s*LIKE\\s*(.*)?$/im'; if (preg_match($pattern, $query, $match)) { $value = str_replace("'", '', $match[1]); $dummy_data['Variable_name'] = trim($value); @@ -917,9 +991,9 @@ class PDOEngine extends PDO { $dummy_data['Value'] = ''; } } - $_results[] = new ObjectArray($dummy_data); - $this->results = $_results; - $this->num_rows = count($this->results); + $_results[] = new ObjectArray($dummy_data); + $this->results = $_results; + $this->num_rows = count($this->results); $this->return_value = $this->num_rows; return true; } @@ -952,9 +1026,9 @@ class PDOEngine extends PDO { */ private function set_error ($line, $function, $message){ global $wpdb; - $this->errors[] = array("line"=>$line, "function"=>$function); + $this->errors[] = array("line"=>$line, "function"=>$function); $this->error_messages[] = $message; - $this->is_error = true; + $this->is_error = true; if ($wpdb->suppress_errors) return false; if (!$wpdb->show_errors) return false; file_put_contents (FQDBDIR .'debug.txt', "Line $line, Function: $function, Message: $message \n", FILE_APPEND); @@ -1005,7 +1079,7 @@ class PDOEngine extends PDO { $_columns['Null'] = $row->notnull ? "NO" : "YES"; $_columns['Key'] = $row->pk ? "PRI" : ""; $_columns['Default'] = $row->dflt_value; - $_results[] = new ObjectArray($_columns); + $_results[] = new ObjectArray($_columns); } } $this->results = $_results; @@ -1081,7 +1155,7 @@ class PDOEngine extends PDO { $_columns['Null'] = 'NO'; $_columns['Index_type'] = 'BTREE'; $_columns['Comment'] = ''; - $_results[] = new ObjectArray($_columns); + $_results[] = new ObjectArray($_columns); } if (stripos($this->queries[0], 'WHERE') !== false) { preg_match('/WHERE\\s*(.*)$/im', $this->queries[0], $match); @@ -1122,7 +1196,7 @@ class PDOEngine extends PDO { 'Msg_text' => 'Table is already up to date' ); } - $_results[] = new ObjectArray($_columns); + $_results[] = new ObjectArray($_columns); $this->results = $_results; } /** diff --git a/query.class.php b/query.class.php index cd2899f..c5d81ab 100644 --- a/query.class.php +++ b/query.class.php @@ -37,68 +37,68 @@ class PDOSQLiteDriver { $this->_query = $query; switch ($this->query_type) { case 'truncate': - $this->_handle_truncate_query(); + $this->handle_truncate_query(); break; case 'alter': - $this->_handle_alter_query(); + $this->handle_alter_query(); break; case 'create': - $this->_handle_create_query(); + $this->handle_create_query(); break; case 'describe': case 'desc': - $this->_handle_describe_query(); + $this->handle_describe_query(); break; case 'show': - $this->_handle_show_query(); + $this->handle_show_query(); break; case 'showcolumns': - $this->_handle_show_columns_query(); + $this->handle_show_columns_query(); break; case 'showindex': - $this->_handle_show_index(); + $this->handle_show_index(); break; case 'select': - $this->_strip_backticks(); - $this->_handle_sql_count(); - $this->_rewrite_date_sub(); - $this->_delete_index_hints(); - $this->_rewrite_regexp(); - $this->_rewrite_boolean(); - $this->_fix_date_quoting(); - $this->_rewrite_between(); + $this->strip_backticks(); + $this->handle_sql_count(); + $this->rewrite_date_sub(); + $this->delete_index_hints(); + $this->rewrite_regexp(); + $this->rewrite_boolean(); + $this->fix_date_quoting(); + $this->rewrite_between(); break; case 'insert': - $this->_safe_strip_backticks(); - $this->_execute_duplicate_key_update(); - $this->_rewrite_insert_ignore(); - $this->_rewrite_regexp(); - $this->_fix_date_quoting(); + $this->safe_strip_backticks(); + $this->execute_duplicate_key_update(); + $this->rewrite_insert_ignore(); + $this->rewrite_regexp(); + $this->fix_date_quoting(); break; case 'update': - $this->_safe_strip_backticks(); - $this->_rewrite_update_ignore(); + $this->safe_strip_backticks(); + $this->rewrite_update_ignore(); // $this->_rewrite_date_sub(); - $this->_rewrite_limit_usage(); - $this->_rewrite_order_by_usage(); - $this->_rewrite_regexp(); - $this->_rewrite_between(); + $this->rewrite_limit_usage(); + $this->rewrite_order_by_usage(); + $this->rewrite_regexp(); + $this->rewrite_between(); break; case 'delete': - $this->_strip_backticks(); - $this->_rewrite_limit_usage(); - $this->_rewrite_order_by_usage(); - $this->_rewrite_date_sub(); - $this->_rewrite_regexp(); - $this->_delete_workaround(); + $this->strip_backticks(); + $this->rewrite_limit_usage(); + $this->rewrite_order_by_usage(); + $this->rewrite_date_sub(); + $this->rewrite_regexp(); + $this->delete_workaround(); break; case 'replace': - $this->_safe_strip_backticks(); - $this->_rewrite_date_sub(); - $this->_rewrite_regexp(); + $this->safe_strip_backticks(); + $this->rewrite_date_sub(); + $this->rewrite_regexp(); break; case 'optimize': - $this->_rewrite_optimize(); + $this->rewrite_optimize(); break; case 'pragma': break; @@ -106,7 +106,7 @@ class PDOSQLiteDriver { if (defined(WP_DEBUG) && WP_DEBUG) { break; } else { - $this->_return_true(); + $this->return_true(); break; } } @@ -118,9 +118,9 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_show_query(){ + private function handle_show_query(){ $table_name = ''; - $pattern = '/^\\s*SHOW\\s*TABLES\\s*.*?(LIKE\\s*(.*))$/im'; + $pattern = '/^\\s*SHOW\\s*TABLES\\s*.*?(LIKE\\s*(.*))$/im'; if (preg_match($pattern, $this->_query, $matches)) { $table_name = str_replace(array("'", ';'), '', $matches[2]); } @@ -139,7 +139,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _strip_backticks(){ + private function strip_backticks(){ $this->_query = str_replace('`', '', $this->_query); } /** @@ -150,10 +150,10 @@ class PDOSQLiteDriver { * * @access private */ - private function _safe_strip_backticks() { + private function safe_strip_backticks() { $query_string = ''; - $tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE); - $literal = false; + $tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE); + $literal = false; $query_string = ''; foreach ($tokens as $token) { if ($token == "'") { @@ -188,16 +188,15 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_sql_count(){ + private function handle_sql_count(){ if (stripos($this->_query, 'SELECT SQL_CALC_FOUND_ROWS') !== false){ global $wpdb; // first strip the code. this is the end of rewriting process - $this->_query = str_ireplace('SQL_CALC_FOUND_ROWS', '', $this->_query); + $this->_query = str_ireplace('SQL_CALC_FOUND_ROWS', '', $this->_query); // we make the data for next SELECE FOUND_ROWS() statement $unlimited_query = preg_replace('/\\bLIMIT\\s*.*/imsx', '', $this->_query); -// $unlimited_query = preg_replace('/\\bFALSE\\s*.*/imsx', '0', $unlimited_query); $unlimited_query = preg_replace('/\\bGROUP\\s*BY\\s*.*/imsx', '', $unlimited_query); - $unlimited_query = $this->__transform_to_count($unlimited_query); + $unlimited_query = $this->_transform_to_count($unlimited_query); $_wpdb = new PDODB(); $result = $_wpdb->query($unlimited_query); $wpdb->dbh->found_rows_result = $_wpdb->last_result; @@ -213,7 +212,7 @@ class PDOSQLiteDriver { * @return string the transformed query * @access private */ - private function __transform_to_count($query){ + private function _transform_to_count($query){ $pattern = '/^\\s*SELECT\\s*(DISTINCT|)?.*?FROM\b/isx'; $_query = preg_replace($pattern, 'SELECT \\1 COUNT(*) FROM ', $query); return $_query; @@ -223,7 +222,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_insert_ignore(){ + private function rewrite_insert_ignore(){ $this->_query = str_ireplace('INSERT IGNORE', 'INSERT OR IGNORE ', $this->_query); } /** @@ -231,7 +230,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_update_ignore(){ + private function rewrite_update_ignore(){ $this->_query = str_ireplace('UPDATE IGNORE', 'UPDATE OR IGNORE ', $this->_query); } /** @@ -242,11 +241,11 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_date_add(){ + private function rewrite_date_add(){ //(date,interval expression unit) $pattern = '/\\s*date_add\\s*\(([^,]*),([^\)]*)\)/imsx'; if (preg_match($pattern, $this->_query, $matches)) { - $expression = "'".trim($matches[2])."'"; + $expression = "'".trim($matches[2])."'"; $this->_query = preg_replace($pattern, " date_add($matches[1], $expression) ", $this->_query); } } @@ -258,11 +257,11 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_date_sub(){ + private function rewrite_date_sub(){ //(date,interval expression unit) $pattern = '/\\s*date_sub\\s*\(([^,]*),([^\)]*)\)/imsx'; if (preg_match($pattern, $this->_query, $matches)) { - $expression = "'".trim($matches[2])."'"; + $expression = "'".trim($matches[2])."'"; $this->_query = preg_replace($pattern, " date_sub($matches[1], $expression) ", $this->_query); } } @@ -274,7 +273,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_create_query(){ + private function handle_create_query(){ require_once PDODIR . 'query_create.class.php'; $engine = new CreateQuery(); $this->_query = $engine->rewrite_query($this->_query); @@ -289,7 +288,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_alter_query(){ + private function handle_alter_query(){ require_once PDODIR . 'query_alter.class.php'; $engine = new AlterQuery(); $this->_query = $engine->rewrite_query($this->_query, 'alter'); @@ -304,7 +303,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_describe_query(){ + private function handle_describe_query(){ // $this->_query = "select 1=1"; $pattern = '/^\\s*(DESCRIBE|DESC)\\s*(.*)/i'; if (preg_match($pattern, $this->_query, $match)) { @@ -323,7 +322,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_limit_usage(){ + private function rewrite_limit_usage(){ $_wpdb = new PDODB(); $options = $_wpdb->get_results('PRAGMA compile_options'); foreach ($options as $opt) { @@ -342,7 +341,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_order_by_usage() { + private function rewrite_order_by_usage() { $_wpdb = new PDODB(); $options = $_wpdb->get_results('PRAGMA compile_options'); foreach ($options as $opt) { @@ -357,7 +356,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_truncate_query(){ + private function handle_truncate_query(){ $pattern = '/TRUNCATE TABLE (.*)/im'; $this->_query = preg_replace($pattern, 'DELETE FROM $1', $this->_query); } @@ -369,7 +368,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_optimize(){ + private function rewrite_optimize(){ $this->_query ="VACUUM"; } /** @@ -384,7 +383,7 @@ class PDOSQLiteDriver { * @return void * @access private */ - private function _rewrite_badly_formed_dates(){ + private function rewrite_badly_formed_dates(){ $pattern = '/([12]\d{3,}-\d{2}-)(\d )/ims'; $this->_query = preg_replace($pattern, '${1}0$2', $this->_query); } @@ -394,7 +393,7 @@ class PDOSQLiteDriver { * @return void * @access private */ - private function _delete_index_hints(){ + private function delete_index_hints(){ $pattern = '/\\s*(use|ignore|force)\\s+index\\s*\(.*?\)/i'; $this->_query = preg_replace($pattern, '', $this->_query); } @@ -412,9 +411,9 @@ class PDOSQLiteDriver { * @return void * @access private */ - private function _fix_date_quoting() { + private function fix_date_quoting() { $pattern = '/(month|year|second|day|minute|hour|dayofmonth)\\s*\((.*?)\)\\s*=\\s*["\']?(\d{1,4})[\'"]?\\s*/im'; - $this->_query = preg_replace_callback($pattern, array($this, '__fix_date_quoting'), $this->_query); + $this->_query = preg_replace_callback($pattern, array($this, '_fix_date_quoting'), $this->_query); } /** * Call back method to rewrite date string. @@ -423,7 +422,7 @@ class PDOSQLiteDriver { * @return string * @access private */ - private function __fix_date_quoting($match) { + private function _fix_date_quoting($match) { $fixed_val = "{$match[1]}({$match[2]})='" . intval($match[3]) . "' "; return $fixed_val; } @@ -435,7 +434,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_regexp(){ + private function rewrite_regexp(){ $pattern = '/\s([^\s]*)\s*regexp\s*(\'.*?\')/im'; $this->_query = preg_replace($pattern, ' regexpp(\1, \2)', $this->_query); } @@ -446,7 +445,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_boolean() { + private function rewrite_boolean() { $query = str_ireplace('TRUE', "1", $this->_query); $query = str_ireplace('FALSE', "0", $query); $this->_query = $query; @@ -456,16 +455,16 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_show_columns_query() { + private function handle_show_columns_query() { $pattern_like = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?\\s*LIKE\\s*(.*)?/i'; - $pattern = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?/i'; + $pattern = '/^\\s*SHOW\\s*(COLUMNS|FIELDS)\\s*FROM\\s*(.*)?/i'; if (preg_match($pattern_like, $this->_query, $matches)) { - $table_name = str_replace("'", "", trim($matches[2])); - $column_name = str_replace("'", "", trim($matches[3])); + $table_name = str_replace("'", "", trim($matches[2])); + $column_name = str_replace("'", "", trim($matches[3])); $query_string = "SELECT sql FROM sqlite_master WHERE tbl_name='$table_name' AND sql LIKE '%$column_name%'"; $this->_query = $query_string; } elseif (preg_match($pattern, $this->_query, $matches)) { - $table_name = $matches[2]; + $table_name = $matches[2]; $query_string = preg_replace($pattern, "PRAGMA table_info($table_name)", $this->_query); $this->_query = $query_string; } @@ -477,11 +476,11 @@ class PDOSQLiteDriver { * * @access private */ - private function _handle_show_index() { + private function handle_show_index() { $pattern = '/^\\s*SHOW\\s*(?:INDEX|INDEXES|KEYS)\\s*FROM\\s*(\\w+)?/im'; if (preg_match($pattern, $this->_query, $match)) { - $table_name = preg_replace("/[\';]/", '', $match[1]); - $table_name = trim($table_name); + $table_name = preg_replace("/[\';]/", '', $match[1]); + $table_name = trim($table_name); $this->_query = "SELECT * FROM sqlite_master WHERE tbl_name='$table_name'"; } } @@ -494,8 +493,8 @@ class PDOSQLiteDriver { * @return void * @access private */ - private function _execute_duplicate_key_update() { - $update = false; + private function execute_duplicate_key_update() { + $update = false; $unique_keys_for_cond = array(); $unique_keys_for_check = array(); $pattern = '/^\\s*INSERT\\s*INTO\\s*(\\w+)?\\s*(.*)\\s*ON\\s*DUPLICATE\\s*KEY\\s*UPDATE\\s*(.*)$/ims'; @@ -521,14 +520,14 @@ class PDOSQLiteDriver { $unique_keys_for_check = array_map('trim', $unique_keys_for_check); } else { // Without unique key or primary key, UPDATE statement will affect all the rows! - $query = 'INSERT INTO '.$table_name.' '.$insert_data; + $query = 'INSERT INTO '.$table_name.' '.$insert_data; $this->_query = $query; $_wpdb = null; return; } // data check if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/ims', $insert_data, $match_1)) { - $col_array = explode(',', $match_1[1]); + $col_array = explode(',', $match_1[1]); $ins_data_array = explode(',', $match_1[2]); foreach ($col_array as $col) { $val = trim(array_shift($ins_data_array)); @@ -539,7 +538,7 @@ class PDOSQLiteDriver { foreach ($unique_keys_for_cond as $unique_key) { if (strpos($unique_key, ',') !== false) { $unique_key_array = explode(',', $unique_key); - $counter = count($unique_key_array); + $counter = count($unique_key_array); for ($i = 0; $i < $counter; ++$i) { $col = trim($unique_key_array[$i]); if (isset($ins_data_assoc[$col]) && $i == $counter - 1) { @@ -560,9 +559,9 @@ class PDOSQLiteDriver { } } } - $condition = rtrim($condition, ' OR '); + $condition = rtrim($condition, ' OR '); $test_query = "SELECT * FROM {$table_name} WHERE {$condition}"; - $results = $_wpdb->query($test_query); + $results = $_wpdb->query($test_query); $_wpdb = null; if ($results == 0) { $this->_query = 'INSERT INTO '.$table_name.' '.$insert_data; @@ -572,7 +571,7 @@ class PDOSQLiteDriver { if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_2)) { $col_array = explode(',', $match_2[1]); $ins_array = explode(',', $match_2[2]); - $count = count($col_array); + $count = count($col_array); for ($i = 0; $i < $count; $i++) { $col = trim($col_array[$i]); $val = trim($ins_array[$i]); @@ -582,17 +581,17 @@ class PDOSQLiteDriver { // change col = data, col = data to array(col=>data, col=>data) // some plugins have semi-colon at the end of the query $update_data = rtrim($update_data, ';'); - $tmp_array = explode(',', $update_data); + $tmp_array = explode(',', $update_data); foreach ($tmp_array as $pair) { list($col, $value) = explode('=', $pair); - $col = trim($col); + $col = trim($col); $value = trim($value); $update_array_assoc[$col] = $value; } // change array(col=>values(col)) to array(col=>data) foreach ($update_array_assoc as $key => &$value) { if (preg_match('/^VALUES\\s*\((.*)\)$/im', $value, $match_3)) { - $col = trim($match_3[1]); + $col = trim($match_3[1]); $value = $ins_array_assoc[$col]; } } @@ -610,8 +609,8 @@ class PDOSQLiteDriver { } } $update_strings = rtrim($update_strings, ','); - $unique_where = array_unique($where_array, SORT_REGULAR); - $where_string = ' WHERE ' . implode(' AND ', $unique_where); + $unique_where = array_unique($where_array, SORT_REGULAR); + $where_string = ' WHERE ' . implode(' AND ', $unique_where); // $where_string = ' WHERE ' . rtrim($where_string, ','); $update_query = 'UPDATE ' . $table_name . ' SET ' . $update_strings . $where_string; $this->_query = $update_query; @@ -633,7 +632,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _rewrite_between() { + private function rewrite_between() { $pattern = '/\\s*(\\w+)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s]*)?\\s*/ims'; if (preg_match($pattern, $this->_query, $match)) { $column_name = trim($match[1]); @@ -641,7 +640,7 @@ class PDOSQLiteDriver { $max_value = trim($match[3]); $max_value = rtrim($max_value); $tokens = preg_split("/(''|')/s", $this->_query, -1, PREG_SPLIT_DELIM_CAPTURE); - $literal = false; + $literal = false; $rewriting = false; foreach ($tokens as $token) { if ($token == "'") { @@ -674,10 +673,10 @@ class PDOSQLiteDriver { * * @access private */ - private function _delete_workaround() { + private function delete_workaround() { global $wpdb; // $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (option_name) WHERE o2.option_id > o1.option_id"; - $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2"; + $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2"; $rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)"; if (stripos($this->_query, $pattern) !== false) { $this->_query = $rewritten; @@ -692,7 +691,7 @@ class PDOSQLiteDriver { * * @access private */ - private function _return_true() { + private function return_true() { $this->_query = 'SELECT 1=1'; } } diff --git a/query_alter.class.php b/query_alter.class.php index c784651..933183c 100644 --- a/query_alter.class.php +++ b/query_alter.class.php @@ -27,10 +27,10 @@ class AlterQuery { } $query = str_replace('`', '', $query); if (preg_match('/^\\s*(ALTER\\s*TABLE)\\s*(\\w+)?\\s*/ims', $query, $match)) { - $tmp_query = array(); - $tokens = array(); + $tmp_query = array(); + $tokens = array(); $re_command = ''; - $command = str_ireplace($match[0], '', $query); + $command = str_ireplace($match[0], '', $query); $tmp_tokens['query_type'] = trim($match[1]); $tmp_tokens['table_name'] = trim($match[2]); // $command_array = $this->split_multiple($command); @@ -38,7 +38,7 @@ class AlterQuery { $single_command = array_shift($command_array); if (!empty($command_array)) { - $re_command = 'ALTER TABLE ' . $tmp_tokens['table_name'] . ' '; + $re_command = 'ALTER TABLE ' . $tmp_tokens['table_name'] . ' '; $re_command .= implode(',', $command_array); } $command_tokens = $this->command_tokenizer($single_command); @@ -105,17 +105,17 @@ class AlterQuery { if (in_array(strtolower($match_2), array('fulltext', 'constraint', 'foreign'))) { break; } elseif (stripos('column', $match_2) !== false) { - $tokens['command'] = $match_1.' '.$match_2; + $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = $match_3; - $tokens['column_def'] = trim($the_rest); + $tokens['column_def'] = trim($the_rest); } elseif (stripos('primary', $match_2) !== false) { - $tokens['command'] = $match_1.' '.$match_2.' '.$match_3; + $tokens['command'] = $match_1.' '.$match_2.' '.$match_3; $tokens['column_name'] = $the_rest; } elseif (stripos('unique', $match_2) !== false) { list($index_name, $col_name) = preg_split('/[\(\)]/s', trim($the_rest), -1, PREG_SPLIT_DELIM_CAPTURE); - $tokens['unique'] = true; - $tokens['command'] = $match_1.' '.$match_3; - $tokens['index_name'] = trim($index_name); + $tokens['unique'] = true; + $tokens['command'] = $match_1.' '.$match_3; + $tokens['index_name'] = trim($index_name); $tokens['column_name'] = '('.trim($col_name).')'; } elseif (in_array(strtolower($match_2), array('index', 'key'))) { $tokens['command'] = $match_1.' '.$match_2; @@ -126,65 +126,65 @@ class AlterQuery { } $tokens['column_name'] = trim($the_rest); } else { - $tokens['command'] = $match_1.' COLUMN'; + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; - $tokens['column_def'] = $match_3.' '.$the_rest; + $tokens['column_def'] = $match_3.' '.$the_rest; } break; case 'drop': if (stripos('column', $match_2) !== false) { - $tokens['command'] = $match_1.' '.$match_2; + $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = trim($match_3); } elseif (stripos('primary', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2.' '.$match_3; } elseif (in_array(strtolower($match_2), array('index', 'key'))) { - $tokens['command'] = $match_1.' '.$match_2; + $tokens['command'] = $match_1.' '.$match_2; $tokens['index_name'] = $match_3; } elseif (stripos('primary', $match_2) !== false) { $tokens['command'] = $match_1.' '.$match_2.' '.$match_3; } else { - $tokens['command'] = $match_1.' COLUMN'; + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; } break; case 'rename': if (stripos('to', $match_2) !== false) { - $tokens['command'] = $match_1.' '.$match_2; + $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = $match_3; } else { - $tokens['command'] = $match_1.' TO'; + $tokens['command'] = $match_1.' TO'; $tokens['column_name'] = $match_2; } break; case 'modify': if (stripos('column', $match_2) !== false) { - $tokens['command'] = $match_1.' '.$match_2; + $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = $match_3; - $tokens['column_def'] = trim($the_rest); + $tokens['column_def'] = trim($the_rest); } else { - $tokens['command'] = $match_1.' COLUMN'; + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; - $tokens['column_def'] = $match_3.' '.trim($the_rest); + $tokens['column_def'] = $match_3.' '.trim($the_rest); } break; case 'change': $the_rest = trim($the_rest); if (stripos('column', $match_2) !== false) { - $tokens['command'] = $match_1.' '.$match_2; + $tokens['command'] = $match_1.' '.$match_2; $tokens['old_column'] = $match_3; - list($new_col) = explode(' ', $the_rest); - $tmp_col = preg_replace('/\(.+?\)/im', '', $new_col); + list($new_col) = explode(' ', $the_rest); + $tmp_col = preg_replace('/\(.+?\)/im', '', $new_col); if (array_key_exists(strtolower($tmp_col), $this->array_types)) { $tokens['column_def'] = $the_rest; } else { $tokens['new_column'] = $new_col; - $col_def = str_replace($new_col, '', $the_rest); + $col_def = str_replace($new_col, '', $the_rest); $tokens['column_def'] = trim($col_def); } } else { - $tokens['command'] = $match_1.' column'; + $tokens['command'] = $match_1.' column'; $tokens['old_column'] = $match_2; - $tmp_col = preg_replace('/\(.+?\)/im', '', $match_3); + $tmp_col = preg_replace('/\(.+?\)/im', '', $match_3); if (array_key_exists(strtolower($tmp_col), $this->array_types)) { $tokens['column_def'] = $match_3 . ' ' . $the_rest; } else { @@ -195,23 +195,23 @@ class AlterQuery { break; case 'alter': if (stripos('column', $match_2) !== false) { - $tokens['command'] = $match_1.' '.$match_2; + $tokens['command'] = $match_1.' '.$match_2; $tokens['column_name'] = $match_3; - list($set_or_drop) = explode(' ', $the_rest); + list($set_or_drop) = explode(' ', $the_rest); if (stripos('set', $set_or_drop) !== false) { $tokens['default_command'] = 'SET DEFAULT'; - $default_value = str_ireplace('set default', '', $the_rest); - $tokens['default_value'] = trim($default_value); + $default_value = str_ireplace('set default', '', $the_rest); + $tokens['default_value'] = trim($default_value); } else { $tokens['default_command'] = 'DROP DEFAULT'; } } else { - $tokens['command'] = $match_1.' COLUMN'; + $tokens['command'] = $match_1.' COLUMN'; $tokens['column_name'] = $match_2; if (stripos('set', $match_3) !== false) { $tokens['default_command'] = 'SET DEFAULT'; - $default_value = str_ireplace('default', '', $the_rest); - $tokens['default_value'] = trim($default_value); + $default_value = str_ireplace('default', '', $the_rest); + $tokens['default_value'] = trim($default_value); } else { $tokens['default_command'] = 'DROP DEFAULT'; } @@ -233,10 +233,10 @@ class AlterQuery { * @return multitype:string unknown Ambigous */ private function split_multiple($command) { - $out = true; - $command_array = array(); + $out = true; + $command_array = array(); $command_string = ''; - $tokens = preg_split('/\b/s', $command, -1, PREG_SPLIT_DELIM_CAPTURE); + $tokens = preg_split('/\b/s', $command, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($tokens as $token) { switch (trim($token)) { case ';': @@ -251,13 +251,13 @@ class AlterQuery { break; case '),': $command_array[] = $command_string; - $command_string = ''; + $command_string = ''; $out = true; break; case ',': if ($out) { $command_array[] = $command_string; - $command_string = ''; + $command_string = ''; } else { $command_string .= $token; } @@ -305,8 +305,8 @@ class AlterQuery { */ private function handle_add_primary_key($queries) { $tokenized_query = $queries; - $tbl_name = $tokenized_query['table_name']; - $temp_table = 'temp_'.$tokenized_query['table_name']; + $tbl_name = $tokenized_query['table_name']; + $temp_table = 'temp_'.$tokenized_query['table_name']; $_wpdb = new PDODB(); $query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='$tbl_name'"); $_wpdb = null; @@ -335,7 +335,7 @@ class AlterQuery { */ private function handle_drop_primary_key($queries) { $tokenized_query = $queries; - $temp_table = 'temp_'.$tokenized_query['table_name']; + $temp_table = 'temp_'.$tokenized_query['table_name']; $_wpdb = new PDODB(); $query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'"); $_wpdb = null; @@ -343,18 +343,18 @@ class AlterQuery { $index_queries[$i] = $query_obj[$i]->sql; } $table_query = array_shift($index_queries); - $pattern1 = '/^\\s*PRIMARY\\s*KEY\\s*\(.*\)/im'; - $pattern2 = '/^\\s*.*(PRIMARY\\s*KEY\\s*(:?AUTOINCREMENT|))\\s*(?!\()/im'; + $pattern1 = '/^\\s*PRIMARY\\s*KEY\\s*\(.*\)/im'; + $pattern2 = '/^\\s*.*(PRIMARY\\s*KEY\\s*(:?AUTOINCREMENT|))\\s*(?!\()/im'; if (preg_match($pattern1, $table_query, $match)) { $table_query = str_replace($match[0], '', $table_query); } elseif (preg_match($pattern2, $table_query, $match)) { $table_query = str_replace($match[1], '', $table_query); } $table_query = str_replace($tokenized_query['table_name'], $temp_table, $table_query); - $query[] = $table_query; - $query[] = "INSERT INTO $temp_table SELECT * FROM {$tokenized_query['table_name']}"; - $query[] = "DROP TABLE IF EXISTS {$tokenized_query['table_name']}"; - $query[] = "ALTER TABLE $temp_table RENAME TO {$tokenized_query['table_name']}"; + $query[] = $table_query; + $query[] = "INSERT INTO $temp_table SELECT * FROM {$tokenized_query['table_name']}"; + $query[] = "DROP TABLE IF EXISTS {$tokenized_query['table_name']}"; + $query[] = "ALTER TABLE $temp_table RENAME TO {$tokenized_query['table_name']}"; foreach ($index_queries as $index) { $query[] = $index; } @@ -369,8 +369,8 @@ class AlterQuery { */ private function handle_modify_command($queries) { $tokenized_query = $queries; - $temp_table = 'temp_'.$tokenized_query['table_name']; - $column_def = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['column_def']); + $temp_table = 'temp_'.$tokenized_query['table_name']; + $column_def = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['column_def']); $_wpdb = new PDODB(); $query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'"); $_wpdb = null; @@ -406,11 +406,11 @@ class AlterQuery { * @return string|array of string */ private function handle_change_command($queries) { - $col_check = false; - $old_fields = ''; - $new_fields = ''; + $col_check = false; + $old_fields = ''; + $new_fields = ''; $tokenized_query = $queries; - $temp_table = 'temp_'.$tokenized_query['table_name']; + $temp_table = 'temp_'.$tokenized_query['table_name']; if (isset($tokenized_query['new_column'])) { $column_name = $tokenized_query['new_column']; } else { @@ -429,7 +429,7 @@ class AlterQuery { } $old_fields = rtrim($old_fields, ','); $new_fields = str_ireplace($tokenized_query['old_column'], $column_name, $old_fields); - $query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'"); + $query_obj = $_wpdb->get_results("SELECT sql FROM sqlite_master WHERE tbl_name='{$tokenized_query['table_name']}'"); $_wpdb = null; for ($i = 0; $i < count($query_obj); $i++) { $index_queries[$i] = $query_obj[$i]->sql; @@ -467,7 +467,7 @@ class AlterQuery { */ private function handle_alter_command($queries) { $tokenized_query = $queries; - $temp_table = 'temp_'.$tokenized_query['table_name']; + $temp_table = 'temp_'.$tokenized_query['table_name']; if (isset($tokenized_query['default_value'])) { $def_value = $this->convert_field_types($tokenized_query['column_name'], $tokenized_query['default_value']); $def_value = 'DEFAULT '.$def_value; @@ -485,12 +485,12 @@ class AlterQuery { return 'SELECT 1=1'; } if (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?(DEFAULT\\s*.*)[,)]/im", $create_query, $match)) { - $col_name = trim($match[1]); - $col_def = trim($match[2]); - $col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def); + $col_name = trim($match[1]); + $col_def = trim($match[2]); + $col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def); $checked_col_def = $this->convert_field_types($col_name, $col_def); - $old_default = trim($match[3]); - $pattern = "/$col_name\\s*$col_def_esc\\s*$old_default/im"; + $old_default = trim($match[3]); + $pattern = "/$col_name\\s*$col_def_esc\\s*$old_default/im"; if (is_null($def_value)) { $replacement = $col_name . ' ' . $checked_col_def; } else { @@ -499,11 +499,11 @@ class AlterQuery { $create_query = preg_replace($pattern, $replacement, $create_query); $create_query = str_ireplace($tokenized_query['table_name'], $temp_table, $create_query); } elseif (preg_match("/\\s*({$tokenized_query['column_name']})\\s*(.*)?[,)]/im", $create_query, $match)) { - $col_name = trim($match[1]); - $col_def = trim($match[2]); - $col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def); + $col_name = trim($match[1]); + $col_def = trim($match[2]); + $col_def_esc = str_replace(array('(', ')'), array('\(', '\)'), $col_def); $checked_col_def = $this->convert_field_types($col_name, $col_def); - $pattern = "/$col_name\\s*$col_def_esc/im"; + $pattern = "/$col_name\\s*$col_def_esc/im"; if (is_null($def_value)) { $replacement = $col_name . ' ' . $checked_col_def; } else { @@ -534,7 +534,7 @@ class AlterQuery { private function convert_field_types($col_name, $col_def){ $array_curtime = array('current_timestamp', 'current_time', 'current_date'); $array_reptime = array("'0000-00-00 00:00:00'", "'0000-00-00 00:00:00'", "'0000-00-00'"); - $def_string = str_replace('`', '', $col_def); + $def_string = str_replace('`', '', $col_def); foreach ($this->array_types as $o=>$r){ $pattern = "/\\b$o\\s*(\([^\)]*\)*)?\\s*/ims"; if (preg_match($pattern, $def_string)) { diff --git a/query_create.class.php b/query_create.class.php index 0ef200f..5f52e1d 100644 --- a/query_create.class.php +++ b/query_create.class.php @@ -12,10 +12,40 @@ */ class CreateQuery{ - private $_query = ''; - private $index_queries = array(); - private $_errors = array(); - private $table_name = ''; + /** + * The query string to be rewritten in this class. + * + * @var string + * @access private + */ + private $_query = ''; + /** + * The array to contain CREATE INDEX queries. + * + * @var array of strings + * @access private + */ + private $index_queries = array(); + /** + * The array to contain error messages. + * + * @var array of string + * @access private + */ + private $_errors = array(); + /** + * Variable to have the table name to be executed. + * + * @var string + * @access private + */ + private $table_name = ''; + /** + * Variable to check if the query has the primary key. + * + * @var boolean + * @access private + */ private $has_primary_key = false; /** @@ -25,7 +55,7 @@ class CreateQuery{ * @return string|array the processed (rewritten) query */ public function rewrite_query($query){ - $this->_query = $query; + $this->_query = $query; $this->_errors [] = ''; if (preg_match('/^CREATE\\s*(UNIQUE|FULLTEXT|)\\s*INDEX/ims', $this->_query, $match)) { // we manipulate CREATE INDEX query in PDOEngine.class.php @@ -60,8 +90,9 @@ class CreateQuery{ /** * Method to get table name from the query string. * - * IF NOT EXISTS is removed for the easy regular expression usage. + * 'IF NOT EXISTS' clause is removed for the easy regular expression usage. * It will be added at the end of the process. + * * @access private */ private function get_table_name(){ @@ -74,6 +105,8 @@ class CreateQuery{ /** * Method to change the MySQL field types to SQLite compatible types. * + * Order of the key value is important. Don't change it. + * * @access private */ private function rewrite_field_types(){ @@ -126,7 +159,8 @@ class CreateQuery{ /** * Method for stripping unsigned. * - * UNSIGNED INT(EGER) is converted to INTEGER here. + * SQLite doesn't have unsigned int data type. So UNSIGNED INT(EGER) is converted + * to INTEGER here. * * @access private */ @@ -178,8 +212,8 @@ class CreateQuery{ */ private function _rewrite_unique_key($matches){ $index_name = trim($matches[1]); - $col_name = trim($matches[2]); - $tbl_name = $this->table_name; + $col_name = trim($matches[2]); + $tbl_name = $this->table_name; $_wpdb = new PDODB(); $results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'"); $_wpdb = null; @@ -246,7 +280,7 @@ class CreateQuery{ */ private function _rewrite_key($matches){ $index_name = trim($matches[2]); - $col_name = trim($matches[3]); + $col_name = trim($matches[3]); if (preg_match('/\([0-9]+?\)/', $col_name, $match)) { $col_name = preg_replace_callback('/\([0-9]+?\)/', array($this, '_remove_length'), $col_name); } @@ -282,21 +316,22 @@ class CreateQuery{ * Method to assemble the main query and index queries into an array. * * It return the array of the queries to be executed separately. + * * @return array * @access private */ private function post_process(){ $mainquery = $this->_query; do{ - $count = 0; + $count = 0; $mainquery = preg_replace('/,\\s*\)/imsx',')', $mainquery, -1, $count); } while ($count > 0); do { - $count = 0; + $count = 0; $mainquery = preg_replace('/\(\\s*?,/imsx', '(', $mainquery, -1, $count); } while ($count > 0); $return_val[] = $mainquery; - $return_val = array_merge($return_val, $this->index_queries); + $return_val = array_merge($return_val, $this->index_queries); return $return_val; } /** @@ -309,14 +344,14 @@ class CreateQuery{ */ private function add_if_not_exists(){ $pattern_table = '/^\\s*CREATE\\s*(TEMP|TEMPORARY)?\\s*TABLE\\s*(IF NOT EXISTS)?\\s*/ims'; - $this->_query = preg_replace($pattern_table, 'CREATE $1 TABLE IF NOT EXISTS ', $this->_query); + $this->_query = preg_replace($pattern_table, 'CREATE $1 TABLE IF NOT EXISTS ', $this->_query); $pattern_index = '/^\\s*CREATE\\s*(UNIQUE)?\\s*INDEX\\s*(IF NOT EXISTS)?\\s*/ims'; for ($i = 0; $i < count($this->index_queries); $i++) { $this->index_queries[$i] = preg_replace($pattern_index, 'CREATE $1 INDEX IF NOT EXISTS ', $this->index_queries[$i]); } } /** - * Method to strip back ticks. + * Method to strip back quotes. * * @access private */ @@ -335,10 +370,11 @@ class CreateQuery{ * @access private */ private function rewrite_character_set(){ - $pattern_charset = '/\\b(default\\s*character\\s*set|default\\s*charset|character\\s*set)\\s*(?_query = preg_replace($patterns, '', $this->_query); + $patterns = array($pattern_charset, $pattern_collate1, $pattern_collate2); + $this->_query = preg_replace($patterns, '', $this->_query); } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/readme-ja.txt b/readme-ja.txt index 584e5ed..acb36f0 100644 --- a/readme-ja.txt +++ b/readme-ja.txt @@ -159,13 +159,17 @@ query_posts() や WP_Query() を使うときに、オプションの一部が機 == Changelog == -= 1.5.1 (2014-01-00) = += 1.5.1 (2014-02-06) = * SQL_CALC_FOUND_ROW ステートメントのバグを修正しました。メインクエリと WP_Query のページング情報に関連したものです。 * コメント本文からバッククォートが削除されるバグを修正しました。 +* バックアップファイルをローカルにダウンロードできるようにしました。 * PHP documentor で使えるように、ソースコードのドキュメントを書き直しました。 * このドキュメントを変えました。 * マイナーな変更、修正がいくつかありました。 * WordPress 3.8.1 と 3.9 alpha でインストールテストをしました。 +* プラグイン互換リストを増補しました。 +* これまで使えなかった WordPress の関数が使えるようになりました。 +* いくつかのユーザ定義関数を追加しました。 = 1.5 (2013-12-17) = * WordPress 3.8 でのインストールと動作テストをしました。 diff --git a/readme.txt b/readme.txt index df56b75..6a0390c 100644 --- a/readme.txt +++ b/readme.txt @@ -157,13 +157,17 @@ When query_posts() or WP_Query() is used, some options didn't work properly. Whe == Changelog == -= 1.5.1 (2014-01-00) = += 1.5.1 (2014-02-06) = * Fixed the bug for 'SQL_CALC_FOUND_ROW' statement. This is for the main query and WP_Query concerning paging information. * Fixed the bug that the back quote in the comments was removed. +* Added the feature to download a backup file to a local machine. * Revised all the doc strings in the sourcse code for PHP documentor. * Changed the documentation. * Fixed minor bugs and typos. * Tested to install WordPress 3.8.1 and 3.9 beta. +* Augumented the plugin compatibility list. +* Some functions in WordPress that can't be used are made to work. +* Some more user defined functions are added. = 1.5 (2013-12-17) = * Tested WordPress 3.8 installation and compatibility. diff --git a/schema.php b/schema.php index a22daed..b2f3432 100644 --- a/schema.php +++ b/schema.php @@ -14,22 +14,23 @@ if (!defined('ABSPATH')) { * Function to create tables according to the schemas of WordPress. * * This is executed only once while installation. + * * @return boolean */ function make_db_sqlite() { include_once PDODIR . 'query_create.class.php'; include_once ABSPATH . 'wp-admin/includes/schema.php'; - $index_array = array(); + $index_array = array(); // ob_end_clean(); $table_schemas = wp_get_db_schema(); - $queries = explode (";", $table_schemas); - $query_parser = new CreateQuery(); + $queries = explode (";", $table_schemas); + $query_parser = new CreateQuery(); try { $pdo = new PDO('sqlite:'.FQDB, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); } catch (PDOException $err) { $err_data = $err->errorInfo; - $message = 'Database connection error!
'; + $message = 'Database connection error!
'; $message .= sprintf("Error message is: %s", $err_data[2]); echo $message; return false; @@ -43,9 +44,9 @@ function make_db_sqlite() { continue; $rewritten_query = $query_parser->rewrite_query($query); if (is_array($rewritten_query)) { - $table_query = array_shift($rewritten_query); + $table_query = array_shift($rewritten_query); $index_queries = $rewritten_query; - $table_query = trim($table_query); + $table_query = trim($table_query); $pdo->exec($table_query); // foreach($rewritten_query as $single_query) { // $single_query = trim($single_query); @@ -83,7 +84,7 @@ function make_db_sqlite() { $pdo->commit(); } else { $pdo->rollBack(); - $message = sprintf("Error occured while creating tables or indexes...
Query was: %s
", var_export($rewritten_query, true)); + $message = sprintf("Error occured while creating tables or indexes...
Query was: %s
", var_export($rewritten_query, true)); $message .= sprintf("Error message is: %s", $err_data[2]); echo $message; return false; diff --git a/sqlite-integration.php b/sqlite-integration.php index 4c3c2bb..4ab18b8 100644 --- a/sqlite-integration.php +++ b/sqlite-integration.php @@ -36,12 +36,21 @@ if (!defined('ABSPATH')) { echo 'Thank you, but you are not allowed to access this file.'; die(); } +/* + * This will be activated after the installation is finished. + * So you can use all the functionality of WordPress. + */ $siteurl = get_option('siteurl'); +/* + * Defines basic constants. + */ define('SQLiteDir', dirname(plugin_basename(__FILE__))); define('SQLiteFilePath', dirname(__FILE__)); define('SQLiteDirName', basename(SQLiteFilePath)); define('SQLiteUrl', $siteurl . '/wp-content/plugins/' . SQLiteDir); - +/* + * Defines patch file upload directory. + */ if (defined('UPLOADS')) { define('SQLitePatchDir', UPLOADS . '/patches'); } else { @@ -51,9 +60,13 @@ if (defined('UPLOADS')) { define('SQLitePatchDir', ABSPATH . 'wp-content/uploads/patches'); } } - +/* + * Plugin compatibility file in json format. + */ define('SQLiteListFile', SQLiteFilePath . '/utilities/plugin_lists.json'); - +/* + * Instantiates utility classes. + */ if (!class_exists('SQLiteIntegrationUtils')) { require_once SQLiteFilePath . '/utilities/utility.php'; $utils = new SQLiteIntegrationUtils(); @@ -83,6 +96,8 @@ class SQLiteIntegration { * Constructor. * * This constructor does everything needed for the administration panel. + * + * @param no parameter is provided. */ function __construct() { if (function_exists('register_activation_hook')) { @@ -98,14 +113,19 @@ class SQLiteIntegration { } else { add_action('admin_menu', array($this, 'add_pages')); } + // See the docstring for download_backup_db() in utilities/utility.php + // We need this registration process. + add_action('admin_init', array('SQLiteIntegrationUtils', 'download_backup_db')); add_action('plugins_loaded', array($this, 'textdomain_init')); } /** - * Function to install on multisite or single site. + * Method to install on multisite or single site. * * There really is nothing to install for now. It is for future use... * + * @param no parameter is provided. + * @return returns null. */ function install() { global $wpdb; @@ -125,25 +145,31 @@ class SQLiteIntegration { } /** - * Function to install something. + * Method to install something. * * We have nothing to do for now. - * We show menu and documents only to the network administrator + * We show menu and documents only to the network administrator. + * + * @param no parameter is provided. + * @return no return values. */ function _install() { } /** - * Function to uninstall plugin. + * Method to uninstall plugin. * * This will remove wp-content/db.php and wp-content/patches direcotry. * If you migrate the site to the sever with MySQL, you have only to * migrate the data in the database. + * + * @param no parameter is provided. + * @return no return values. */ function uninstall() { // remove patch files and patch directory if (file_exists(SQLitePatchDir) && is_dir(SQLitePatchDir)) { - $dir_handle = opendir(SQLitePatchDir); + $dir_handle = opendir(SQLitePatchDir); while (($file_name = readdir($dir_handle)) !== false) { if ($file_name != '.' && $file_name != '..') { unlink(SQLitePatchDir.'/'.$file_name); @@ -163,21 +189,24 @@ class SQLiteIntegration { } /** - * Function to manipulate the admin panel, stylesheet and JavaScript. + * Method to manipulate the admin panel, stylesheet and JavaScript. * * We use class method to show pages and want to load style files and script * files only in our plugin documents, so we need add_submenu_page with parent * slug set to null. This means that menu items are added but hidden from the * users. + * + * @param no parameter is provided. + * @return no return values. */ function add_pages() { global $utils, $doc, $patch_utils, $maintenance; if (function_exists('add_options_page')) { - $welcome_page = add_options_page(__('SQLite Integration'), __('SQLite Integration'), 'manage_options', 'sqlite-integration', array($utils, 'welcome')); - $util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_options', 'sys-info', array($utils, 'show_utils')); - $edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_options', 'setting-file', array($utils, 'edit_db_file')); - $doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_options', 'doc', array($doc, 'show_doc')); - $patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_options', 'patch', array($patch_utils, 'show_patch_page')); + $welcome_page = add_options_page(__('SQLite Integration'), __('SQLite Integration'), 'manage_options', 'sqlite-integration', array($utils, 'welcome')); + $util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_options', 'sys-info', array($utils, 'show_utils')); + $edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_options', 'setting-file', array($utils, 'edit_db_file')); + $doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_options', 'doc', array($doc, 'show_doc')); + $patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_options', 'patch', array($patch_utils, 'show_patch_page')); $maintenance_page = add_submenu_page(null, 'DB Maintenance', 'DB Maintenance', 'manage_options', 'maintenance', array($maintenance, 'show_maintenance_page')); add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet')); add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet')); @@ -193,18 +222,21 @@ class SQLiteIntegration { } /** - * Function to manipulate network admin panel. + * Method to manipulate network admin panel. * * Capability is set to manage_network_options. + * + * @param no parameter is provided. + * @return no return values. */ function add_network_pages() { global $utils, $doc, $patch_utils, $maintenance; if (function_exists('add_options_page')) { - $welcome_page = add_submenu_page('settings.php', __('SQLite Integration'), __('SQLite Integration'), 'manage_network_options', 'sqlite-integration', array($utils, 'welcome')); - $util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_network_options', 'sys-info', array($utils, 'show_utils')); - $edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_network_options', 'setting-file', array($utils, 'edit_db_file')); - $doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_network_options', 'doc', array($doc, 'show_doc')); - $patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_network_options', 'patch', array($patch_utils, 'show_patch_page')); + $welcome_page = add_submenu_page('settings.php', __('SQLite Integration'), __('SQLite Integration'), 'manage_network_options', 'sqlite-integration', array($utils, 'welcome')); + $util_page = add_submenu_page(null, 'System Info', 'System Info', 'manage_network_options', 'sys-info', array($utils, 'show_utils')); + $edit_db = add_submenu_page(null, 'Setting File', 'Setting File', 'manage_network_options', 'setting-file', array($utils, 'edit_db_file')); + $doc_page = add_submenu_page(null, 'Documentation', 'Documentation', 'manage_network_options', 'doc', array($doc, 'show_doc')); + $patch_page = add_submenu_page(null, 'Patch Utility', 'Patch Utility', 'manage_network_options', 'patch', array($patch_utils, 'show_patch_page')); $maintenance_page = add_submenu_page(null, 'DB Maintenance', 'DB Maintenance', 'manage_network_options', 'maintenance', array($maintenance, 'show_maintenance_page')); add_action('admin_print_styles-'.$welcome_page, array($this, 'add_style_sheet')); add_action('admin_print_styles-'.$util_page, array($this, 'add_style_sheet')); @@ -220,9 +252,12 @@ class SQLiteIntegration { } /** - * Function to initialize textdomain. + * Method to initialize textdomain. * * Japanese catalog is only available. + * + * @param no parameter is provided. + * @return no return values. */ function textdomain_init() { global $utils; @@ -235,10 +270,14 @@ class SQLiteIntegration { } /** - * Function to initialize stylesheet on the admin panel. + * Method to initialize stylesheet on the admin panel. * * This determines which stylesheet to use depending on the users' choice - * of admin_color. + * of admin_color. Each stylesheet imports style.css and change the color + * of the admin dashboard. + * + * @param no parameter is provided. + * @return no return values. */ function add_style_sheet() { global $current_user; @@ -249,18 +288,23 @@ class SQLiteIntegration { } else { $stylesheet_file = $admin_color . '.min.css'; } - $style_url = SQLiteUrl . '/styles/' . $stylesheet_file; + $style_url = SQLiteUrl . '/styles/' . $stylesheet_file; $style_file = SQLiteFilePath . '/styles/' . $stylesheet_file; if (file_exists($style_file)) { wp_enqueue_style('sqlite_integration_stylesheet', $style_url); } } /** - * Function to register the JavaScript file. + * Method to register the JavaScript file. * + * To register the JavaScript file. It's only for the admin dashboard. + * It won't included in web pages. + * + * @param no parameter is provided. + * @return no return value. */ function add_sqlite_script() { - $script_url = SQLiteUrl . '/js/sqlite.min.js'; + $script_url = SQLiteUrl . '/js/sqlite.min.js'; $script_file = SQLiteFilePath . '/js/sqlite.min.js'; if (file_exists($script_file)) { wp_enqueue_script('sqlite-integration', $script_url, 'jquery'); diff --git a/styles/blue.css b/styles/blue.css index 0f05a7a..959a249 100644 --- a/styles/blue.css +++ b/styles/blue.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @import url('./style.min.css'); @CHARSET "UTF-8"; diff --git a/styles/coffee.css b/styles/coffee.css index ba10f1c..48fd937 100644 --- a/styles/coffee.css +++ b/styles/coffee.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @import url('./style.min.css'); @CHARSET "UTF-8"; diff --git a/styles/ectoplasm.css b/styles/ectoplasm.css index d6375d1..a083a90 100644 --- a/styles/ectoplasm.css +++ b/styles/ectoplasm.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @import url('./style.min.css'); @CHARSET "UTF-8"; diff --git a/styles/light.css b/styles/light.css index f2e0bc4..23508de 100644 --- a/styles/light.css +++ b/styles/light.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @import url('./style.min.css'); @CHARSET "UTF-8"; diff --git a/styles/midnight.css b/styles/midnight.css index b4fc8f9..ec9b9e7 100644 --- a/styles/midnight.css +++ b/styles/midnight.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @import url('./style.min.css'); @CHARSET "UTF-8"; diff --git a/styles/ocean.css b/styles/ocean.css index 0036a9f..7afa48c 100644 --- a/styles/ocean.css +++ b/styles/ocean.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @import url('./style.min.css'); @CHARSET "UTF-8"; diff --git a/styles/style.css b/styles/style.css index 99e509e..863ba02 100644 --- a/styles/style.css +++ b/styles/style.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @CHARSET "UTF-8"; #sqlite-admin-wrap h2, @@ -110,11 +112,14 @@ h3 { } p { text-indent: 15px; - line-height: 150%; + line-height: 160%; font-size: 11pt; margin-left: 10px; margin-right: 10px; } +li { + line-height: 130%; +} table#sys-info{ /* width: 600px; */ width: 80%; @@ -190,7 +195,7 @@ input.button-primary { } table#patch-files .item, table#backup-files .item { - width: 40px; + width: 150px; } .alert { color: rgb(255, 0, 0); diff --git a/styles/style.min.css b/styles/style.min.css index d76fe44..b1f4dd8 100644 --- a/styles/style.min.css +++ b/styles/style.min.css @@ -1 +1 @@ -@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#222;color:#fff;padding-left:5px}h3{clear:both}.navigation{display:block;margin-top:0;margin-bottom:0;min-height:20px}.navi-menu{margin-left:0}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#333;color:(255,255,255);line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#2ea2cc;color:#fff}.menu-item a{text-decoration:none;color:#fff}#sqlite-admin-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:58%;margin-top:10px;padding:5px;box-shadow:5px 5px 5px #eee;z-index:1}#wpbody-content>.single{width:95%}#sqlite-admin-side-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:35%;margin-top:10px;padding:5px 5px 5px 5px;box-shadow:5px 5px 5px #eee;z-index:1}p{text-indent:15px;line-height:150%;font-size:11pt;margin-left:10px;margin-right:10px}table#sys-info{width:80%}table#status{width:100%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}td.system{color:#900}td.user{color:#00f}td.menu-title{width:95px}table.statement{width:500px}ul.in-body-list{margin-left:20px}ol{margin-left:40px}pre.code{padding:5px 5px 5px 5px;margin-left:15px;margin-right:10px;background:#eee;white-space:pre-wrap;word-wrap:break-word;overflow:auto}tr.incompatible{background:#fbe5dd}tr.workaround{background:#d9e8ed}th.active-plugins{width:20%}th.compatible{width:30%}input.button-primary{display:block;clear:both;width:100px}.alt{background:#f7feec}.em{font-weight:bold;text-transform:capitalize}table#patch-files .item,table#backup-files .item{width:40px}.alert{color:#f00}div.alert{display:block;width:95%;text-align:center;margin:0 auto;color:#f00;text-transform:capitalize}blockquote.caution{display:block;width:95%;border:3px double #000;margin:0 auto;padding:5px}blockquote.caution>p{margin:5px;padding:0}#errorlog,#dbfile{width:100%}@media screen and (max-width:600px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}#sqlite-admin-wrap>table#sys-info{width:100%}table#sys-info th.item{width:50%}#sqlite-admin-wrap>table#status{width:100%}table#status th{width:50%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#sqlite-admin-side-wrap table#plugins-info{width:100%}th.installed-plugins{width:50%}th.active-plugins{width:20%}th.compatible{width:30%}#sqlite-admin-side-wrap>table#plugins-table{width:100%}#sqlite-admin-side-wrap>table#plugins-table th.item{width:30%}#sqlite-admin-side-wrap>table#plugins-table th.compat{width:20%}#sqlite-admin-side-wrap>table#plugins-table th.reason{width:50%}}@media screen and (max-width:782px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:900px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:1169px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sys-info{width:460px}table#status{width:460px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}} \ No newline at end of file +@CHARSET "UTF-8";#sqlite-admin-wrap h2,#sqlite-admin-side-wrap h2{background:#222;color:#fff;padding-left:5px}h3{clear:both}.navigation{display:block;margin-top:0;margin-bottom:0;min-height:20px}.navi-menu{margin-left:0}.menu-item{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#333;color:(255,255,255);line-height:40px}.menu-selected{font-size:20px;display:inline;min-width:150px;height:50px;margin-left:0;margin-right:10px;padding:5px;border:.5px solit #000;background:#2ea2cc;color:#fff}.menu-item a{text-decoration:none;color:#fff}#sqlite-admin-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:58%;margin-top:10px;padding:5px;box-shadow:5px 5px 5px #eee;z-index:1}#wpbody-content>.single{width:95%}#sqlite-admin-side-wrap{color:#1d1d1d;font-size:11pt;border:1px solid #ddd;background:#fff;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-bottomleft:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;border-top-right-radius:6px;border-top-left-radius:6px;display:block;float:left;min-height:100%;position:relative;width:35%;margin-top:10px;padding:5px 5px 5px 5px;box-shadow:5px 5px 5px #eee;z-index:1}p{text-indent:15px;line-height:160%;font-size:11pt;margin-left:10px;margin-right:10px}li{line-height:130%}table#sys-info{width:80%}table#status{width:100%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}td.system{color:#900}td.user{color:#00f}td.menu-title{width:95px}table.statement{width:500px}ul.in-body-list{margin-left:20px}ol{margin-left:40px}pre.code{padding:5px 5px 5px 5px;margin-left:15px;margin-right:10px;background:#eee;white-space:pre-wrap;word-wrap:break-word;overflow:auto}tr.incompatible{background:#fbe5dd}tr.workaround{background:#d9e8ed}th.active-plugins{width:20%}th.compatible{width:30%}input.button-primary{display:block;clear:both;width:100px}.alt{background:#f7feec}.em{font-weight:bold;text-transform:capitalize}table#patch-files .item,table#backup-files .item{width:150px}.alert{color:#f00}div.alert{display:block;width:95%;text-align:center;margin:0 auto;color:#f00;text-transform:capitalize}blockquote.caution{display:block;width:95%;border:3px double #000;margin:0 auto;padding:5px}blockquote.caution>p{margin:5px;padding:0}#errorlog,#dbfile{width:100%}@media screen and (max-width:600px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}#sqlite-admin-wrap>table#sys-info{width:100%}table#sys-info th.item{width:50%}#sqlite-admin-wrap>table#status{width:100%}table#status th{width:50%}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#sqlite-admin-side-wrap table#plugins-info{width:100%}th.installed-plugins{width:50%}th.active-plugins{width:20%}th.compatible{width:30%}#sqlite-admin-side-wrap>table#plugins-table{width:100%}#sqlite-admin-side-wrap>table#plugins-table th.item{width:30%}#sqlite-admin-side-wrap>table#plugins-table th.compat{width:20%}#sqlite-admin-side-wrap>table#plugins-table th.reason{width:50%}}@media screen and (max-width:782px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:900px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}}@media screen and (max-width:1169px){#sqlite-admin-wrap{width:95%}#sqlite-admin-side-wrap{width:95%}table#plugins-info{width:480px}table#sys-info{width:460px}table#status{width:460px}table#sqlite-table{width:100%}th.tbl-name{width:25%}th.tbl_owner{width:25%}th.tbl_index{width:50%}#plugins-table{width:500px}} \ No newline at end of file diff --git a/styles/sunrise.css b/styles/sunrise.css index a027c0a..e8cdcb0 100644 --- a/styles/sunrise.css +++ b/styles/sunrise.css @@ -1,6 +1,8 @@ /** * This file is a part of SQLite Integration. * + * @package SQLite Integration + * @author Kojima Toshiyasu */ @import url('./style.min.css'); @CHARSET "UTF-8"; diff --git a/utilities/database_maintenance.php b/utilities/database_maintenance.php index 7db49ff..ea2e313 100644 --- a/utilities/database_maintenance.php +++ b/utilities/database_maintenance.php @@ -3,15 +3,20 @@ * This file defines DatabaseMaintenance class. * * When WordPress was upgraded from 3.5.x to 3.6, SQLite Integration couldn't manipulate - * dbDelta() function of WordPress. As a result, there are some tables whose default - * values are missing. + * dbDelta() function of WordPress as expected. As a result, there are some tables whose + * default values are missing. * - * This class checks the table schemas and restore the default value if necessary. * This file is for temporary use and will be removed or changed in the future release. * * @package SQLite Integration * @author Kojima Toshiyasu */ +/** + * This class provide the methods to check the table schemas and restore if necessary. + * + * Each method is a private function except the one to show admin page. + * + */ class DatabaseMaintenance { /** * Method to check the table schemas. diff --git a/utilities/documentation.php b/utilities/documentation.php index 339a80c..18343da 100644 --- a/utilities/documentation.php +++ b/utilities/documentation.php @@ -37,7 +37,7 @@ class SQLiteIntegrationDocument {

- SQLite Integration page.', $domain);?> + SQLite Integration page.', $domain);?>

@@ -76,7 +76,7 @@ class SQLiteIntegrationDocument {

  • ', $domain);?>
  • ', $domain);?> - Patch Utility. See also the Plugin Page for more details.', $domain), $utils->show_parent());?>
  • + Patch Utility. See also the SQLite Integration Page for more details.', $domain), $utils->show_parent());?>

    Support Forum.', $domain);?> diff --git a/utilities/patch.php b/utilities/patch.php index b4b5f35..a5482b4 100644 --- a/utilities/patch.php +++ b/utilities/patch.php @@ -26,7 +26,7 @@ class PatchUtils { } else { if ($dir_handle = opendir(SQLitePatchDir)) { while (($file_name = readdir($dir_handle)) !== false) { - if ($file_name == '.' || $file_name == '..') + if ($file_name == '.' || $file_name == '..' || $file_name == '.htaccess') continue; $patch_files[] = $file_name; } @@ -148,31 +148,82 @@ class PatchUtils { * * It uploads a patch file to the server. You must have the permission to write to the * temporary directory. If there isn't SQLitePatchDir, this method will create it and - * set the permission to 0705. + * set the permission to 0707. * * No return values. * + * @return boolean * @access private */ private function upload_file() { global $utils; $domain = $utils->text_domain; if (!file_exists(SQLitePatchDir) || !is_dir(SQLitePatchDir)) { - mkdir(SQLitePatchDir, 0705, true); + if (!mkdir(SQLitePatchDir, 0707, true)) { + $message = __('Unable to create a patch directory.', $domain); + echo '

    '.$message.'
    '; + return false; + } + } + if (!is_file(SQLitePatchDir . '/.htaccess')) { + $fp = fopen(SQLitePatchDir . '/.htaccess', 'w'); + if (!$fp) { + $message = __('Unable to create a .htaccess file.', $domain); + echo '
    '.$message.'
    '; + return false; + } + fwrite($fp, 'DENY FROM ALL'); + fclose($fp); + } + if (!isset($_FILES['upfile']['error']) || !is_int($_FILES['upfile']['error'])) { + $message = __('Invalid operation.', $domain); + echo '
    '.$message.'
    '; + return false; + } elseif ($_FILES['upfile']['error'] != UPLOAD_ERR_OK) { + switch ($_FILES['upfile']['error']) { + case UPLOAD_ERR_FORM_SIZE: + $message = __('File is too large to upload.', $domain); + echo '
    '.$message.'
    '; + break; + case UPLOAD_ERR_PARTIAL: + $message = __('File upload is not complete.', $domain); + echo '
    '.$message.'
    '; + break; + case UPLOAD_ERR_NO_FILE: + $message = __('File is not uploaded.', $domain); + echo '
    '.$message.'
    '; + break; + case UPLOAD_ERR_NO_TMP_DIR: + $message = __('Temporary directory is not writable.', $domain); + echo '
    '.$message.'
    '; + break; + case UPLOAD_ERR_CANT_WRITE: + $message = __('File cannot be written on the disk.', $domain); + echo '
    '.$message.'
    '; + break; + default: + $message = __('Unknown error.', $domain); + break; + } + return false; } if (is_uploaded_file($_FILES['upfile']['tmp_name'])) { - if (move_uploaded_file($_FILES['upfile']['tmp_name'], SQLitePatchDir.'/'.$_FILES['upfile']['name'])) { - $message = __('File is uploaded', $domain); + $file_full_path = SQLitePatchDir . '/' . $_FILES['upfile']['name']; + if (move_uploaded_file($_FILES['upfile']['tmp_name'], $file_full_path)) { + $message = __('File is successfully uploaded.', $domain); echo '
    '.$message.'
    '; - chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0644); + chmod(SQLitePatchDir.'/'.$_FILES['upfile']['name'], 0606); } else { - $message = __('File is not uploaded', $domain); + $message = __('File upload failed. Possible file upload attack.', $domain); echo '
    '.$message.'
    '; + return false; } } else { $message = __('File is not selected', $domain); echo '
    '.$message.'
    '; + return false; } + return true; } /** * Method to display the patch utility page on the admin panel. @@ -308,7 +359,8 @@ class PatchUtils { wp_nonce_field('sqlitewordpress-plugin-patch-file-stats'); } ?> -
    + +
    diff --git a/utilities/plugin_lists.json b/utilities/plugin_lists.json index 39240a5..9fe8245 100644 --- a/utilities/plugin_lists.json +++ b/utilities/plugin_lists.json @@ -1,4 +1,18 @@ [ + { + "name":"Add Meta Tags", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Advanced Sitemap Generator", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Akismet", "compat":"Checked", @@ -11,18 +25,46 @@ "class":"compatible" }, + { + "name":"All In One WP Security & Firewall", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Anti-spam", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Any Mobile Theme Switcher", "compat":"Checked", "class":"compatible" }, - + + { + "name":"Batcache", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"BAW Manual Related Posts", "compat":"Checked", "class":"compatible" }, + { + "name":"bbPress", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Better Delete Revision", "compat":"No", @@ -37,6 +79,20 @@ "class":"incompatible" }, + { + "name":"Better WP Security", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Bit.ly", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Breadcrumb NavXT", "compat":"Checked", @@ -55,6 +111,20 @@ "class":"compatible" }, + { + "name":"BuddyPress", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"BuddyPress Courseware", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Camera slideshow", "compat":"Needs Patch", @@ -63,12 +133,40 @@ "class":"workaround" }, + { + "name":"Cart66 Cloud :: Ecommerce with security", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Cart66 Lite :: WordPress Ecommerce", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Category Order and Taxonomy Terms Order", "compat":"Checked", "class":"compatible" }, + { + "name":"CKEditor For WordPress", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"configure-login-timeout", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Contact Form 7", "compat":"Checked", @@ -81,12 +179,61 @@ "class":"compatible" }, + { + "name":"Control XML-RPC publishing", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Count per Day", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Crayon Syntax Highlighter", "compat":"Checked", "class":"compatible" }, + { + "name":"Custom Post type and short code", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Custom Content Shortcode", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Custom Field List Widget", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Custom Meta Widget", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Custom sidebars", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"DB Cache Reloaded Fix", "compat":"Probably No", @@ -112,12 +259,68 @@ "class":"compatible" }, + { + "name":"Disable XML-RPC", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Download Button Shortcode", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress Download Manager", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Dynamic To Top", "compat":"Checked", "class":"compatible" }, + { + "name":"Easy Digital Downloads", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Easy WP SMTP", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"EDD Hide Download", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"eShop", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Facebook", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"FeedWordPress", "compat":"Needs patch", @@ -126,12 +329,26 @@ "class":"workaround" }, + { + "name":"FlexiCache", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Google Analyticator", "compat":"Checked", "class":"compatible" }, + { + "name":"Google Analytics for WordPress", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Google Analytics Popular Posts", "compat":"Checked", @@ -152,6 +369,13 @@ "class":"compatible" }, + { + "name":"HTTP Digest Authentication", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"HyperDB", "compat":"Probably No", @@ -165,6 +389,13 @@ "class":"compatible" }, + { + "name":"Jigoshop", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Ktai Style", "compat":"Checked", @@ -177,18 +408,81 @@ "class":"compatible" }, + { + "name":"Login Only 1 Session", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Mass Email To users", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Mathjax Latex", "compat":"Checked", "class":"compatible" }, + { + "name":"Members", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Members Category", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"MP6", "compat":"Checked", "class":"compatible" }, + { + "name":"Multisite Global Search", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Multisite User Management", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"MW WP Form", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"My Content Management", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Networks for WordPress", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"NewStatPress", "compat":"Needs Patch", @@ -199,12 +493,19 @@ { "name":"NextGEN Gallery", - "compat":"Needs patch", + "compat":"Needs Patch", "patch_url":"http://dogwood.skr.jp/wordpress/plugins/", "reason":"MySQL specific function", "class":"workaround" }, + { + "name":"StatCounter - Free Real Time Visitor Stats", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Optimize Database after Deleting Revisions", "compat":"Probably No", @@ -212,12 +513,61 @@ "class":"workaround" }, + { + "name":"Options Framework", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"OSE Firewall™ Security", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Page Builder by SiteOrigin", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"PDF.js Viewer Shortcode", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"PHP Code Widget", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Polylang", "compat":"Checked", "class":"compatible" }, + { + "name":"Prevent XMLRPC", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Qikmo Mobile Website Redirection", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Redirection", "compat":"Checked", @@ -236,6 +586,13 @@ "class":"compatible" }, + { + "name":"Safer Cookies", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Search Everything", "compat":"Checked", @@ -248,42 +605,203 @@ "class":"compatible" }, + { + "name":"Sell Downloads", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Session Manager", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Simple Session Support", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Simple Tags", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Smart Donations", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Socializer!", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"SQLite Integration", "compat":"Checked", "class":"compatible" }, + { + "name":"StatPress", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Synchi", "compat":"Checked", "class":"compatible" }, + { + "name":"SysInfo", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"System information", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Theme-Check", "compat":"Checked", "class":"compatible" }, + { + "name":"Theme My Login", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Welcart e-Commerce", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"Wikiful Mediawiki Bridge", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WooCommerce - excelling eCommerce", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Wordfence Security", "compat":"Checked", "class":"compatible" }, + { + "name":"WordPress Advanced Ticket System", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Attachments", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WordPress Beta Tester", "compat":"Checked", "class":"compatible" }, + { + "name":"WP Campaign Manager", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress.com Custom CSS", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress.com Stats", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress Hit Counter", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WordPress Importer", "compat":"Checked", "class":"compatible" }, + { + "name":"WordPress Login Redirect", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress Mobile Pack", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress MU Domain Mapping", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress MU Sitewide Tags Pages", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Wordpress Popular Posts", "compat":"Needs Patch", @@ -298,18 +816,123 @@ "class":"compatible" }, + { + "name":"WordPress SEO by Yoast", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Document Revisions", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP e-Commerce", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Email Login", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WP Emmet", "compat":"Checked", "class":"compatible" }, + { + "name":"WP Custom Login", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Frontpage News", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP iSell Photo", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Mail SMTP", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP-Members", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP-Piwik", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WPtap Mobile Detector", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Mobile Edition", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Mobile Theme Switcher", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP-Mobilizer", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WP Multibyte Patch", "compat":"Checked", "class":"compatible" }, + { + "name":"WP Online Store", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WP-PageNavi", "compat":"Checked", @@ -334,24 +957,94 @@ "class":"compatible" }, + { + "name":"WP Session Manager", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WP Social Bookmarking Light", "compat":"Checked", "class":"compatible" }, + { + "name":"WP-Statistics", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WP Super Cache", "compat":"Checked", "class":"compatible" }, + { + "name":"WP System Health", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"WP Video Lightbox", "compat":"Checked", "class":"compatible" }, + { + "name":"wp-webservices", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Document Revisions Simple Downloads", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Marketplace - Complete Shopping Cart / eCommerce Solution", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WordPress Multi Site Mobile Edition", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WPQuery Shortcode", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WP Social Stats", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + + { + "name":"WPtouch Mobile Plugin", + "compat":"Checked", + "class":"compatible", + "informed":"Users' Information" + }, + { "name":"Wysija Newsletters", "compat":"Needs Patch", diff --git a/utilities/utility.php b/utilities/utility.php index 02d6c35..ff3088d 100644 --- a/utilities/utility.php +++ b/utilities/utility.php @@ -306,7 +306,11 @@ class SQLiteIntegrationUtils { $compat = __('No', $domain); break; case 'Checked': - $compat = __('Checked', $domain); + if (!empty($plugin_info->informed) && stripos($plugin_info->informed, 'Users\' Information') !== false) { + $compat = __('Checked*', $domain); + } else { + $compat = __('Checked', $domain); + } break; default: $compat = __('Not Checked', $domain); @@ -416,6 +420,7 @@ class SQLiteIntegrationUtils { * @access private */ private function backup_db() { + $domain = $this->text_domain; $result = array(); $database_file = FQDB; $db_name = basename(FQDB); @@ -447,12 +452,13 @@ class SQLiteIntegrationUtils { /** * Method to delete backup database file(s). * - * @return boolean|string + * Users can delete multiple files at a time. + * + * @return false if file names aren't checked, empty array if failed, array of messages if succeeded. * @access private */ private function delete_backup_db() { - global $utils; - $domain = $utils->text_domain; + $domain = $this->text_domain; $file_names = array(); $results = array(); if (isset($_POST['backup_checked'])) { @@ -471,6 +477,53 @@ class SQLiteIntegrationUtils { } return $results; } + /** + * Method to download a backup file. + * + * This method uses header() function, so we have to register this function using + * admin_init action hook. It must also be declared as public. We check HTTP_REFERER + * and input button name, and ,after that, wp_nonce. When the admin_init is executed + * it only returns true. + * + * The database file might be several hundred mega bytes, so we don't use readfile() + * but use fread() instead. + * + * Users can download one file at a time. + * + * @return 1 if the file name isn't checked, 2 if multiple files are checked, true if succeeded. + */ + static function download_backup_db() { + if (is_multisite()) { + $script_url = network_admin_url('settings.php?page=setting-file'); + } else { + $script_url = admin_url('options-general.php?page=setting-file'); + } + if (isset($_POST['download_backup_file']) && stripos($_SERVER['HTTP_REFERER'], $script_url) !== false) { + check_admin_referer('sqliteintegration-backup-manip-stats'); + if (!isset($_POST['backup_checked'])) return 1; + $file_names = array(); + $file_names = $_POST['backup_checked']; + if (count($file_names) != 1) return 2; + $file_name = $file_names[0]; + $file_path = FQDBDIR . $file_name; + $download_file_name = get_bloginfo('name') . '_' . $file_name; + header('Pragma: public'); + header('Cache-Control: must-revalidate,post-check=0,pre-check=0'); + header('Content-Type: application/force-download'); + header('Content-Type: application/octet-stream'); + header('Content-Type: application/download'); + header('Content-Disposition: attachment; filename='.$download_file_name.';'); + header('Content-Transfer-Encoding: binary'); + header('Content-Length: '.filesize($file_path)); + $fp = fopen($file_path, 'r'); + while (!feof($fp)) { + echo fread($fp, 65536); + flush(); + } + fclose($fp); + } + return true; + } /** * Method to show Welcome page. * @@ -705,6 +758,9 @@ class SQLiteIntegrationUtils { show_plugins_info();?> +

    + +

    '.$message.''; } } + if (isset($_POST['download_backup_file'])) { + check_admin_referer('sqliteintegration-backup-manip-stats'); + $message = ''; + $result = self::download_backup_db(); + if ($result !== true) { + switch($result) { + case 1: + $message = __('Please select backup file.', $domain); + break; + case 2: + $message = __('Please select one file at a time.', $domain); + break; + default: + break; + } + echo '
    ' . $message . '
    '; + } + } if (isset($_GET['page']) && $_GET['page'] == 'setting-file') :?>