%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.144.12.29
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/menu/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/menu/class.php
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

class CBitrixMenuComponent extends CBitrixComponent
{
	public function onPrepareComponentParams($arParams)
	{
		$arParams["CACHE_TYPE"] = $arParams["MENU_CACHE_TYPE"];
		$arParams["CACHE_TIME"] = $arParams["MENU_CACHE_TIME"];
		return $arParams;
	}

	public function getCacheID($additionalCacheID = false)
	{
		/** @global CMain $APPLICATION */
		global $APPLICATION;
		/** @global CUser $USER */
		global $USER;

		$strCacheID = "";
		if($this->arParams["MENU_CACHE_TIME"])
		{
			if($this->arParams["CACHE_SELECTED_ITEMS"])
				$strCacheID = $APPLICATION->GetCurPage();
			else
				$strCacheID = "";
			$strCacheID .=
				":".$this->arParams["USE_EXT"].
				":".$this->arParams["MAX_LEVEL"].
				":".$this->arParams["ROOT_MENU_TYPE"].
				":".$this->arParams["CHILD_MENU_TYPE"].
				":".LANGUAGE_ID.
				":".SITE_ID.
				""
			;

			if(($this->arParams["MENU_CACHE_USE_GROUPS"] ?? '') === "Y")
				$strCacheID .= ":".$USER->GetGroups();

			if(($this->arParams["MENU_CACHE_USE_USERS"] ?? '') === "Y")
				$strCacheID .= ":".$USER->GetID();

			if(is_array($this->arParams["MENU_CACHE_GET_VARS"]))
			{
				foreach($this->arParams["MENU_CACHE_GET_VARS"] as $name)
				{
					$name = trim($name);
					if($name != "" && array_key_exists($name, $_GET))
						$strCacheID .= ":".$name."=".$_GET[$name];
				}
			}

			$strCacheID = md5($strCacheID);
		}

		return $strCacheID;
	}

	public function getGenerationCachePath($id)
	{
		$hash = md5($id);
		$path = $this->getRelativePath()."/".substr($hash, -5, 2)."/".substr($hash, -3)."/".(int)$id;
		return $path;
	}

	public function getChildMenuRecursive(&$arMenu, &$arResult, $menuType, $use_ext, $menuTemplate, $currentLevel, $maxLevel, $bMultiSelect, $bCheckSelected, $parentItem)
	{
		if ($currentLevel > $maxLevel)
			return;

		for ($menuIndex = 0, $menuCount = count($arMenu); $menuIndex < $menuCount; $menuIndex++)
		{
			//Menu from iblock (bitrix:menu.sections)
			$arMenu[$menuIndex]["CHAIN"] = (is_array($parentItem) && !empty($parentItem["CHAIN"]) ? $parentItem["CHAIN"] : array());
			$arMenu[$menuIndex]["CHAIN"][] = $arMenu[$menuIndex]["TEXT"];

			if (is_array($arMenu[$menuIndex]["PARAMS"]) && isset($arMenu[$menuIndex]["PARAMS"]["FROM_IBLOCK"]))
			{
				$iblockSectionLevel = intval($arMenu[$menuIndex]["PARAMS"]["DEPTH_LEVEL"]);
				if ($currentLevel > 1)
					$iblockSectionLevel = $iblockSectionLevel + $currentLevel - 1;

				$arResult[] = $arMenu[$menuIndex] + Array("DEPTH_LEVEL" => $iblockSectionLevel, "IS_PARENT" => $arMenu[$menuIndex]["PARAMS"]["IS_PARENT"]);
				continue;
			}

			//Menu from files
			$subMenuExists = false;
			if ($currentLevel < $maxLevel)
			{
				//directory link only
				$bDir = false;
				if(!preg_match("'^(([a-z]+://)|mailto:|javascript:)'i", $arMenu[$menuIndex]["LINK"]))
				{
					if(mb_substr($arMenu[$menuIndex]["LINK"], -1) == "/")
					{
						if ($parentItem && $parentItem['LINK'] === $arMenu[$menuIndex]["LINK"])
						{
							$bDir = false;
						}
						else
						{
							$bDir = true;
						}
					}
				}
				if($bDir)
				{
					$menu = new CMenu($menuType);
					$menu->disableDebug();
					$success = $menu->Init($arMenu[$menuIndex]["LINK"], $use_ext, $menuTemplate, $onlyCurrentDir = true);
					$subMenuExists = ($success && count($menu->arMenu) > 0);

					if ($subMenuExists)
					{
						$menu->RecalcMenu($bMultiSelect, $bCheckSelected);

						$arResult[] = $arMenu[$menuIndex] + Array("DEPTH_LEVEL" => $currentLevel, "IS_PARENT" => (count($menu->arMenu) > 0));

						if($arMenu[$menuIndex]["SELECTED"])
						{
							$arResult["menuType"] = $menuType;
							$arResult["menuDir"] = $arMenu[$menuIndex]["LINK"];
						}

						if(count($menu->arMenu) > 0)
							$this->GetChildMenuRecursive($menu->arMenu, $arResult, $menuType, $use_ext, $menuTemplate, $currentLevel+1, $maxLevel, $bMultiSelect, $bCheckSelected, $arMenu[$menuIndex]);
					}
				}
			}

			if(!$subMenuExists)
				$arResult[] = $arMenu[$menuIndex] + Array("DEPTH_LEVEL" => $currentLevel, "IS_PARENT" => false);
		}
	}

	public function getMenuString($type = "left")
	{
		/** @var CMenuCustom*/
		global $BX_MENU_CUSTOM;
		global $APPLICATION;

		$sReturn = "";
		if ($APPLICATION->buffer_manual)
		{
			$arMenuCustom = $BX_MENU_CUSTOM->GetItems($type);
			if (is_array($arMenuCustom))
				$this->arResult = array_merge($this->arResult, $arMenuCustom);

			ob_start();
			$this->IncludeComponentTemplate();
			$sReturn = ob_get_contents();
			ob_end_clean();
		}
		return $sReturn;
	}

	public function setSelectedItems($bMultiSelect = false)
	{
		/** @global CMain $APPLICATION */
		global $APPLICATION;

		$cur_page = $APPLICATION->GetCurPage(true);
		$cur_page_no_index = $APPLICATION->GetCurPage(false);
		$cur_selected = -1;
		$cur_selected_len = -1;

		foreach($this->arResult as $iMenuItem => $MenuItem)
		{
			$LINK = $MenuItem['LINK'];
			$ADDITIONAL_LINKS = $MenuItem['ADDITIONAL_LINKS'];
			$SELECTED = false;

			$all_links = array();
			if(is_array($ADDITIONAL_LINKS))
			{
				foreach($ADDITIONAL_LINKS as $link)
				{
					$tested_link = trim($link);
					if($tested_link <> '')
						$all_links[] = $tested_link;
				}
			}
			$all_links[] = $LINK;

			if($MenuItem['PERMISSION'] != 'Z')
			{
				foreach($all_links as $tested_link)
				{
					if($tested_link == '')
						continue;

					$SELECTED = CMenu::IsItemSelected($tested_link, $cur_page, $cur_page_no_index);
					if($SELECTED)
					{
						$this->arResult[$iMenuItem]['SELECTED'] = true;
						break;
					}
				}
			}

			if($SELECTED && !$bMultiSelect)
			{
				/** @noinspection PhpUndefinedVariableInspection */
				$new_len = mb_strlen($tested_link);
				if($new_len > $cur_selected_len)
				{
					if($cur_selected !== -1)
						$this->arResult[$cur_selected]['SELECTED'] = false;

					$cur_selected = $iMenuItem;
					$cur_selected_len = $new_len;
				}
				elseif($tested_link !== SITE_DIR)
				{
					$this->arResult[$iMenuItem]['SELECTED'] = false;
				}
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit