....................................../////.===Shadow-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.19.154.92  /  Your IP : 216.73.216.47
Web Server : Apache
System : Linux lon12.onrocket.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC 2023 x86_64
User : gd5hzp4 ( 1069)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gd5hzp4/www/wp-content/plugins/litespeed-cache/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gd5hzp4/www/wp-content/plugins/litespeed-cache/src/router.cls.php
<?php
// phpcs:ignoreFile

/**
 * The core plugin router class.
 *
 * This generate the valid action.
 *
 * @since       1.1.0
 */

namespace LiteSpeed;

defined('WPINC') || exit();

class Router extends Base {

	const LOG_TAG = '[Router]';

	const NONCE  = 'LSCWP_NONCE';
	const ACTION = 'LSCWP_CTRL';

	const ACTION_SAVE_SETTINGS_NETWORK = 'save-settings-network';
	const ACTION_DB_OPTM               = 'db_optm';
	const ACTION_PLACEHOLDER           = 'placeholder';
	const ACTION_AVATAR                = 'avatar';
	const ACTION_SAVE_SETTINGS         = 'save-settings';
	const ACTION_CLOUD                 = 'cloud';
	const ACTION_IMG_OPTM              = 'img_optm';
	const ACTION_HEALTH                = 'health';
	const ACTION_CRAWLER               = 'crawler';
	const ACTION_PURGE                 = 'purge';
	const ACTION_CONF                  = 'conf';
	const ACTION_ACTIVATION            = 'activation';
	const ACTION_CSS                   = 'css';
	const ACTION_UCSS                  = 'ucss';
	const ACTION_VPI                   = 'vpi';
	const ACTION_PRESET                = 'preset';
	const ACTION_IMPORT                = 'import';
	const ACTION_REPORT                = 'report';
	const ACTION_DEBUG2                = 'debug2';
	const ACTION_CDN_CLOUDFLARE        = 'CDN\Cloudflare';
	const ACTION_ADMIN_DISPLAY         = 'admin_display';
	const ACTION_TMP_DISABLE          = 'tmp_disable';

	// List all handlers here
	private static $_HANDLERS = array(
		self::ACTION_ADMIN_DISPLAY,
		self::ACTION_ACTIVATION,
		self::ACTION_AVATAR,
		self::ACTION_CDN_CLOUDFLARE,
		self::ACTION_CLOUD,
		self::ACTION_CONF,
		self::ACTION_CRAWLER,
		self::ACTION_CSS,
		self::ACTION_UCSS,
		self::ACTION_VPI,
		self::ACTION_DB_OPTM,
		self::ACTION_DEBUG2,
		self::ACTION_HEALTH,
		self::ACTION_IMG_OPTM,
		self::ACTION_PRESET,
		self::ACTION_IMPORT,
		self::ACTION_PLACEHOLDER,
		self::ACTION_PURGE,
		self::ACTION_REPORT,
	);

	const TYPE = 'litespeed_type';

	const ITEM_HASH       = 'hash';
	const ITEM_FLASH_HASH = 'flash_hash';

	private static $_esi_enabled;
	private static $_is_ajax;
	private static $_is_logged_in;
	private static $_ip;
	private static $_action;
	private static $_is_admin_ip;
	private static $_frontend_path;

	/**
	 * Redirect to self to continue operation
	 *
	 * Note: must return when use this func. CLI/Cron call won't die in this func.
	 *
	 * @since  3.0
	 * @access public
	 */
	public static function self_redirect( $action, $type ) {
		if (defined('LITESPEED_CLI') || wp_doing_cron()) {
			Admin_Display::success('To be continued'); // Show for CLI
			return;
		}

		// Add i to avoid browser too many redirected warning
		$i = !empty($_GET['litespeed_i']) ? $_GET['litespeed_i'] : 0;
		++$i;

		$link = Utility::build_url($action, $type, false, null, array( 'litespeed_i' => $i ));

		$url = html_entity_decode($link);
		exit("<meta http-equiv='refresh' content='0;url=$url'>");
	}

	/**
	 * Check if can run optimize
	 *
	 * @since  1.3
	 * @since  2.3.1 Relocated from cdn.cls
	 * @access public
	 */
	public function can_optm() {
		$can = true;

		if (is_user_logged_in() && $this->conf(self::O_OPTM_GUEST_ONLY)) {
			$can = false;
		} elseif (is_admin()) {
			$can = false;
		} elseif (is_feed()) {
			$can = false;
		} elseif (is_preview()) {
			$can = false;
		} elseif (self::is_ajax()) {
			$can = false;
		}

		if (self::_is_login_page()) {
			Debug2::debug('[Router] Optm bypassed: login/reg page');
			$can = false;
		}

		$can_final = apply_filters('litespeed_can_optm', $can);

		if ($can_final != $can) {
			Debug2::debug('[Router] Optm bypassed: filter');
		}

		return $can_final;
	}

	/**
	 * Check referer page to see if its from admin
	 *
	 * @since 2.4.2.1
	 * @access public
	 */
	public static function from_admin() {
		return !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], get_admin_url()) === 0;
	}

	/**
	 * Check if it can use CDN replacement
	 *
	 * @since  1.2.3
	 * @since  2.3.1 Relocated from cdn.cls
	 * @access public
	 */
	public static function can_cdn() {
		$can = true;

		if (is_admin()) {
			if (!self::is_ajax()) {
				Debug2::debug2('[Router] CDN bypassed: is not ajax call');
				$can = false;
			}

			if (self::from_admin()) {
				Debug2::debug2('[Router] CDN bypassed: ajax call from admin');
				$can = false;
			}
		} elseif (is_feed()) {
			$can = false;
		} elseif (is_preview()) {
			$can = false;
		}

		/**
		 * Bypass cron to avoid deregister jq notice `Do not deregister the <code>jquery-core</code> script in the administration area.`
		 *
		 * @since  2.7.2
		 */
		if (wp_doing_cron()) {
			$can = false;
		}

		/**
		 * Bypass login/reg page
		 *
		 * @since  1.6
		 */
		if (self::_is_login_page()) {
			Debug2::debug('[Router] CDN bypassed: login/reg page');
			$can = false;
		}

		/**
		 * Bypass post/page link setting
		 *
		 * @since 2.9.8.5
		 */
		$rest_prefix = function_exists('rest_get_url_prefix') ? rest_get_url_prefix() : apply_filters('rest_url_prefix', 'wp-json');
		if (
			!empty($_SERVER['REQUEST_URI']) &&
			strpos($_SERVER['REQUEST_URI'], $rest_prefix . '/wp/v2/media') !== false &&
			isset($_SERVER['HTTP_REFERER']) &&
			strpos($_SERVER['HTTP_REFERER'], 'wp-admin') !== false
		) {
			Debug2::debug('[Router] CDN bypassed: wp-json on admin page');
			$can = false;
		}

		$can_final = apply_filters('litespeed_can_cdn', $can);

		if ($can_final != $can) {
			Debug2::debug('[Router] CDN bypassed: filter');
		}

		return $can_final;
	}

	/**
	 * Check if is login page or not
	 *
	 * @since  2.3.1
	 * @access protected
	 */
	protected static function _is_login_page() {
		if (in_array($GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ), true)) {
			return true;
		}

		return false;
	}

	/**
	 * UCSS/Crawler role simulator
	 *
	 * @since  1.9.1
	 * @since  3.3 Renamed from `is_crawler_role_simulation`
	 */
	public function is_role_simulation() {
		if (is_admin()) {
			return;
		}

		if (empty($_COOKIE['litespeed_hash']) && empty($_COOKIE['litespeed_flash_hash'])) {
			return;
		}

		self::debug('🪪 starting role validation');

		// Check if is from crawler
		// if ( empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) || strpos( $_SERVER[ 'HTTP_USER_AGENT' ], Crawler::FAST_USER_AGENT ) !== 0 ) {
		// Debug2::debug( '[Router] user agent not match' );
		// return;
		// }
		$server_ip = $this->conf(self::O_SERVER_IP);
		if (!$server_ip || self::get_ip() !== $server_ip) {
			self::debug('❌❌ Role simulate uid denied! Not localhost visit!');
			Control::set_nocache('Role simulate uid denied');
			return;
		}

		// Flash hash validation
		if (!empty($_COOKIE['litespeed_flash_hash'])) {
			$hash_data = self::get_option(self::ITEM_FLASH_HASH, array());
			if ($hash_data && is_array($hash_data) && !empty($hash_data['hash']) && !empty($hash_data['ts']) && !empty($hash_data['uid'])) {
				if (time() - $hash_data['ts'] < 120 && $_COOKIE['litespeed_flash_hash'] == $hash_data['hash']) {
					self::debug('🪪 Role simulator flash hash matched, escalating user to be uid=' . $hash_data['uid']);
					self::delete_option(self::ITEM_FLASH_HASH);
					wp_set_current_user($hash_data['uid']);
					return;
				}
			}
		}
		// Hash validation
		if (!empty($_COOKIE['litespeed_hash'])) {
			$hash_data = self::get_option(self::ITEM_HASH, array());
			if ($hash_data && is_array($hash_data) && !empty($hash_data['hash']) && !empty($hash_data['ts']) && !empty($hash_data['uid'])) {
				$RUN_DURATION = $this->cls('Crawler')->get_crawler_duration();
				if (time() - $hash_data['ts'] < $RUN_DURATION && $_COOKIE['litespeed_hash'] == $hash_data['hash']) {
					self::debug('🪪 Role simulator hash matched, escalating user to be uid=' . $hash_data['uid']);
					wp_set_current_user($hash_data['uid']);
					return;
				}
			}
		}

		self::debug('❌ WARNING: role simulator hash not match');
	}

	/**
	 * Get a short ttl hash (2mins)
	 *
	 * @since  6.4
	 */
	public function get_flash_hash( $uid ) {
		$hash_data = self::get_option(self::ITEM_FLASH_HASH, array());
		if ($hash_data && is_array($hash_data) && !empty($hash_data['hash']) && !empty($hash_data['ts'])) {
			if (time() - $hash_data['ts'] < 60) {
				return $hash_data['hash'];
			}
		}

		// Check if this user has editor access or not
		if (user_can($uid, 'edit_posts')) {
			self::debug('🛑 The user with id ' . $uid . ' has editor access, which is not allowed for the role simulator.');
			return '';
		}

		$hash = Str::rrand(32);
		self::update_option(self::ITEM_FLASH_HASH, array(
			'hash' => $hash,
			'ts' => time(),
			'uid' => $uid,
		));
		return $hash;
	}

	/**
	 * Get a security hash
	 *
	 * @since  3.3
	 */
	public function get_hash( $uid ) {
		// Check if this user has editor access or not
		if (user_can($uid, 'edit_posts')) {
			self::debug('🛑 The user with id ' . $uid . ' has editor access, which is not allowed for the role simulator.');
			return '';
		}

		// As this is called only when starting crawling, not per page, no need to reuse
		$hash = Str::rrand(32);
		self::update_option(self::ITEM_HASH, array(
			'hash' => $hash,
			'ts' => time(),
			'uid' => $uid,
		));
		return $hash;
	}

	/**
	 * Get user role
	 *
	 * @since  1.6.2
	 */
	public static function get_role( $uid = null ) {
		if (defined('LITESPEED_WP_ROLE')) {
			return LITESPEED_WP_ROLE;
		}

		if ($uid === null) {
			$uid = get_current_user_id();
		}

		$role = false;
		if ($uid) {
			$user = get_userdata($uid);
			if (isset($user->roles) && is_array($user->roles)) {
				$tmp  = array_values($user->roles);
				$role = implode(',', $tmp); // Combine for PHP5.3 const compatibility
			}
		}
		Debug2::debug('[Router] get_role: ' . $role);

		if (!$role) {
			return $role;
			// Guest user
			Debug2::debug('[Router] role: guest');

			/**
			 * Fix double login issue
			 * The previous user init refactoring didn't fix this bcos this is in login process and the user role could change
			 *
			 * @see  https://github.com/litespeedtech/lscache_wp/commit/69e7bc71d0de5cd58961bae953380b581abdc088
			 * @since  2.9.8 Won't assign const if in login process
			 */
			if (substr_compare(wp_login_url(), $GLOBALS['pagenow'], -strlen($GLOBALS['pagenow'])) === 0) {
				return $role;
			}
		}

		define('LITESPEED_WP_ROLE', $role);

		return LITESPEED_WP_ROLE;
	}

	/**
	 * Get frontend path
	 *
	 * @since 1.2.2
	 * @access public
	 * @return boolean
	 */
	public static function frontend_path() {
		// todo: move to htaccess.cls ?
		if (!isset(self::$_frontend_path)) {
			$frontend = rtrim(ABSPATH, '/'); // /home/user/public_html/frontend
			// get home path failed. Trac ticket #37668 (e.g. frontend:/blog backend:/wordpress)
			if (!$frontend) {
				Debug2::debug('[Router] No ABSPATH, generating from home option');
				$frontend = parse_url(get_option('home'));
				$frontend = !empty($frontend['path']) ? $frontend['path'] : '';
				$frontend = $_SERVER['DOCUMENT_ROOT'] . $frontend;
			}
			$frontend = realpath($frontend);

			self::$_frontend_path = $frontend;
		}
		return self::$_frontend_path;
	}

	/**
	 * Check if ESI is enabled or not
	 *
	 * @since 1.2.0
	 * @access public
	 * @return boolean
	 */
	public function esi_enabled() {
		if (!isset(self::$_esi_enabled)) {
			self::$_esi_enabled = defined('LITESPEED_ON') && $this->conf(self::O_ESI);
			if (!empty($_REQUEST[self::ACTION])) {
				self::$_esi_enabled = false;
			}
		}
		return self::$_esi_enabled;
	}

	/**
	 * Check if crawler is enabled on server level
	 *
	 * @since 1.1.1
	 * @access public
	 */
	public static function can_crawl() {
		if (isset($_SERVER['X-LSCACHE']) && strpos($_SERVER['X-LSCACHE'], 'crawler') === false) {
			return false;
		}

		// CLI will bypass this check as crawler library can always do the 428 check
		if (defined('LITESPEED_CLI')) {
			return true;
		}

		return true;
	}

	/**
	 * Check action
	 *
	 * @since 1.1.0
	 * @access public
	 * @return string
	 */
	public static function get_action() {
		if (!isset(self::$_action)) {
			self::$_action = false;
			self::cls()->verify_action();
			if (self::$_action) {
				defined('LSCWP_LOG') && Debug2::debug('[Router] LSCWP_CTRL verified: ' . var_export(self::$_action, true));
			}
		}
		return self::$_action;
	}

	/**
	 * Check if is logged in
	 *
	 * @since 1.1.3
	 * @access public
	 * @return boolean
	 */
	public static function is_logged_in() {
		if (!isset(self::$_is_logged_in)) {
			self::$_is_logged_in = is_user_logged_in();
		}
		return self::$_is_logged_in;
	}

	/**
	 * Check if is ajax call
	 *
	 * @since 1.1.0
	 * @access public
	 * @return boolean
	 */
	public static function is_ajax() {
		if (!isset(self::$_is_ajax)) {
			self::$_is_ajax = wp_doing_ajax();
		}
		return self::$_is_ajax;
	}

	/**
	 * Check if is admin ip
	 *
	 * @since 1.1.0
	 * @access public
	 * @return boolean
	 */
	public function is_admin_ip() {
		if (!isset(self::$_is_admin_ip)) {
			$ips = $this->conf(self::O_DEBUG_IPS);

			self::$_is_admin_ip = $this->ip_access($ips);
		}
		return self::$_is_admin_ip;
	}

	/**
	 * Get type value
	 *
	 * @since 1.6
	 * @access public
	 */
	public static function verify_type() {
		if (empty($_REQUEST[self::TYPE])) {
			Debug2::debug('[Router] no type', 2);
			return false;
		}

		Debug2::debug('[Router] parsed type: ' . $_REQUEST[self::TYPE], 2);

		return $_REQUEST[self::TYPE];
	}

	/**
	 * Check privilege and nonce for the action
	 *
	 * @since 1.1.0
	 * @access private
	 */
	private function verify_action() {
		if (empty($_REQUEST[self::ACTION])) {
			Debug2::debug2('[Router] LSCWP_CTRL bypassed empty');
			return;
		}

		$action = stripslashes($_REQUEST[self::ACTION]);

		if (!$action) {
			return;
		}

		$_is_public_action = false;

		// Each action must have a valid nonce unless its from admin ip and is public action
		// Validate requests nonce (from admin logged in page or cli)
		if (!$this->verify_nonce($action)) {
			// check if it is from admin ip
			if (!$this->is_admin_ip()) {
				Debug2::debug('[Router] LSCWP_CTRL query string - did not match admin IP: ' . $action);
				return;
			}

			// check if it is public action
			if (
				!in_array($action, array(
					Core::ACTION_QS_NOCACHE,
					Core::ACTION_QS_PURGE,
					Core::ACTION_QS_PURGE_SINGLE,
					Core::ACTION_QS_SHOW_HEADERS,
					Core::ACTION_QS_PURGE_ALL,
					Core::ACTION_QS_PURGE_EMPTYCACHE,
				))
			) {
				Debug2::debug('[Router] LSCWP_CTRL query string - did not match admin IP Actions: ' . $action);
				return;
			}

			if (apply_filters('litespeed_qs_forbidden', false)) {
				Debug2::debug('[Router] LSCWP_CTRL forbidden by hook litespeed_qs_forbidden');
				return;
			}

			$_is_public_action = true;
		}

		/* Now it is a valid action, lets log and check the permission */
		Debug2::debug('[Router] LSCWP_CTRL: ' . $action);

		// OK, as we want to do something magic, lets check if its allowed
		$_is_multisite       = is_multisite();
		$_is_network_admin   = $_is_multisite && is_network_admin();
		$_can_network_option = $_is_network_admin && current_user_can('manage_network_options');
		$_can_option         = current_user_can('manage_options');

		switch ($action) {
			case self::ACTION_TMP_DISABLE: // Disable LSC for 24H
				Debug2::tmp_disable();
				Admin::redirect("?page=litespeed-toolbox#settings-debug");
				return;

			case self::ACTION_SAVE_SETTINGS_NETWORK: // Save network settings
            if ($_can_network_option) {
					self::$_action = $action;
				}
				return;

			case Core::ACTION_PURGE_BY:
            if (defined('LITESPEED_ON') && ($_can_network_option || $_can_option || self::is_ajax())) {
					// here may need more security
					self::$_action = $action;
				}
				return;

			case self::ACTION_DB_OPTM:
            if ($_can_network_option || $_can_option) {
					self::$_action = $action;
				}
				return;

			case Core::ACTION_PURGE_EMPTYCACHE: // todo: moved to purge.cls type action
            if ((defined('LITESPEED_ON') || $_is_network_admin) && ($_can_network_option || (!$_is_multisite && $_can_option))) {
					self::$_action = $action;
				}
				return;

			case Core::ACTION_QS_NOCACHE:
			case Core::ACTION_QS_PURGE:
			case Core::ACTION_QS_PURGE_SINGLE:
			case Core::ACTION_QS_SHOW_HEADERS:
			case Core::ACTION_QS_PURGE_ALL:
			case Core::ACTION_QS_PURGE_EMPTYCACHE:
            if (defined('LITESPEED_ON') && ($_is_public_action || self::is_ajax())) {
					self::$_action = $action;
				}
				return;

			case self::ACTION_ADMIN_DISPLAY:
			case self::ACTION_PLACEHOLDER:
			case self::ACTION_AVATAR:
			case self::ACTION_IMG_OPTM:
			case self::ACTION_CLOUD:
			case self::ACTION_CDN_CLOUDFLARE:
			case self::ACTION_CRAWLER:
			case self::ACTION_PRESET:
			case self::ACTION_IMPORT:
			case self::ACTION_REPORT:
			case self::ACTION_CSS:
			case self::ACTION_UCSS:
			case self::ACTION_VPI:
			case self::ACTION_CONF:
			case self::ACTION_ACTIVATION:
			case self::ACTION_HEALTH:
			case self::ACTION_SAVE_SETTINGS: // Save settings
            if ($_can_option && !$_is_network_admin) {
					self::$_action = $action;
				}
				return;

			case self::ACTION_PURGE:
			case self::ACTION_DEBUG2:
            if ($_can_network_option || $_can_option) {
					self::$_action = $action;
				}
				return;

			case Core::ACTION_DISMISS:
            /**
             * Non ajax call can dismiss too
             *
             * @since  2.9
             */
            // if ( self::is_ajax() ) {
            self::$_action = $action;
            // }
				return;

			default:
            Debug2::debug('[Router] LSCWP_CTRL match failed: ' . $action);
				return;
		}
	}

	/**
	 * Verify nonce
	 *
	 * @since 1.1.0
	 * @access public
	 * @param  string $action
	 * @return bool
	 */
	public function verify_nonce( $action ) {
		if (!isset($_REQUEST[self::NONCE]) || !wp_verify_nonce($_REQUEST[self::NONCE], $action)) {
			return false;
		} else {
			return true;
		}
	}

	/**
	 * Check if the ip is in the range
	 *
	 * @since 1.1.0
	 * @access public
	 */
	public function ip_access( $ip_list ) {
		if (!$ip_list) {
			return false;
		}
		if (!isset(self::$_ip)) {
			self::$_ip = self::get_ip();
		}

		if (!self::$_ip) {
			return false;
		}
		// $uip = explode('.', $_ip);
		// if(empty($uip) || count($uip) != 4) Return false;
		// foreach($ip_list as $key => $ip) $ip_list[$key] = explode('.', trim($ip));
		// foreach($ip_list as $key => $ip) {
		// if(count($ip) != 4) continue;
		// for($i = 0; $i <= 3; $i++) if($ip[$i] == '*') $ip_list[$key][$i] = $uip[$i];
		// }
		return in_array(self::$_ip, $ip_list);
	}

	/**
	 * Get client ip
	 *
	 * @since 1.1.0
	 * @since  1.6.5 changed to public
	 * @access public
	 * @return string
	 */
	public static function get_ip() {
		$_ip = '';
		// if ( function_exists( 'apache_request_headers' ) ) {
		// $apache_headers = apache_request_headers();
		// $_ip = ! empty( $apache_headers['True-Client-IP'] ) ? $apache_headers['True-Client-IP'] : false;
		// if ( ! $_ip ) {
		// $_ip = ! empty( $apache_headers['X-Forwarded-For'] ) ? $apache_headers['X-Forwarded-For'] : false;
		// $_ip = explode( ',', $_ip );
		// $_ip = $_ip[ 0 ];
		// }

		// }

		if (!$_ip) {
			$_ip = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false;
		}
		return $_ip;
	}

	/**
	 * Check if opcode cache is enabled
	 *
	 * @since  1.8.2
	 * @access public
	 */
	public static function opcache_enabled() {
		return function_exists('opcache_reset') && ini_get('opcache.enable');
	}

	/**
	 * Check if opcode cache is restricted and file that is requesting.
	 * https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.restrict-api
	 *
	 * @since  7.3
	 * @access public
	 */
	public static function opcache_restricted($file)
	{
		$restrict_value = ini_get('opcache.restrict_api');
		if ($restrict_value) {
			if ( !$file || false === strpos($restrict_value, $file) ) {
				return true;
			}
		}

		return false;
	}

	/**
	 * Handle static files
	 *
	 * @since  3.0
	 */
	public function serve_static() {
		if (!empty($_SERVER['SCRIPT_URI'])) {
			if (strpos($_SERVER['SCRIPT_URI'], LITESPEED_STATIC_URL . '/') !== 0) {
				return;
			}
			$path = substr($_SERVER['SCRIPT_URI'], strlen(LITESPEED_STATIC_URL . '/'));
		} elseif (!empty($_SERVER['REQUEST_URI'])) {
			$static_path = parse_url(LITESPEED_STATIC_URL, PHP_URL_PATH) . '/';
			if (strpos($_SERVER['REQUEST_URI'], $static_path) !== 0) {
				return;
			}
			$path = substr(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), strlen($static_path));
		} else {
			return;
		}

		$path = explode('/', $path, 2);

		if (empty($path[0]) || empty($path[1])) {
			return;
		}

		switch ($path[0]) {
			case 'avatar':
            $this->cls('Avatar')->serve_static($path[1]);
				break;

			case 'localres':
            $this->cls('Localization')->serve_static($path[1]);
				break;

			default:
				break;
		}
	}

	/**
	 * Handle all request actions from main cls
	 *
	 * This is different than other handlers
	 *
	 * @since  3.0
	 * @access public
	 */
	public function handler( $cls ) {
		if (!in_array($cls, self::$_HANDLERS)) {
			return;
		}

		return $this->cls($cls)->handler();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit