%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.145.178.159
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/app.placement/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

/**
 * Bitrix vars
 *
 * @var array $arParams
 * @var array $arResult
 * @var CBitrixComponent $this
 * @global CMain $APPLICATION
 */

use Bitrix\Main\ErrorCollection;
use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\SystemException;

class CAPConnectComponent extends \CBitrixComponent
{
	protected $placementId = null;
	protected $appList = array();

	protected $currentApp = null;
	protected $currentPlacementOptions = null;

	protected $errors;

	protected $ajaxMode = false;
	protected $templatePage = '';

	public function __construct($component = null)
	{
		$this->errors = new ErrorCollection();

		parent::__construct($component);
	}

	public function onPrepareComponentParams($arParams)
	{
		$arParams['PLACEMENT'] = trim($arParams['PLACEMENT']);

		if(!isset($arParams['PLACEMENT_OPTIONS']) || !is_array($arParams['PLACEMENT_OPTIONS']))
		{
			$arParams['PLACEMENT_OPTIONS'] = array();
		}

		if(isset($arParams['INTERFACE_EVENT']))
		{
			$arParams['INTERFACE_EVENT'] = trim($arParams['INTERFACE_EVENT']);
		}

		if(!isset($arParams['SAVE_LAST_APP']))
		{
			$arParams['SAVE_LAST_APP'] = 'Y';
		}
		else
		{
			$arParams['SAVE_LAST_APP'] = $arParams['SAVE_LAST_APP'] == 'N' ? 'N' : 'Y';
		}

		if($arParams['PLACEMENT_APP'] > 0)
		{
			$this->currentApp = intval($arParams['PLACEMENT_APP']);
		}

		$this->placementId = $arParams['PLACEMENT'];

		return parent::onPrepareComponentParams($arParams);
	}

	/**
	 * Check Required Modules
	 *
	 * @throws Exception
	 */
	protected function checkModules()
	{
		if(!Loader::includeModule('rest'))
		{
			return false;
		}

		return true;
	}

	/**
	 * Process incoming request
	 * @return void
	 */
	protected function processRequest()
	{
		$request = \Bitrix\Main\Context::getCurrent()->getRequest();
		if($request->isPost() && isset($request['placement_action']) && check_bitrix_sessid())
		{
			switch($request['placement_action'])
			{
				case 'load':

					$this->currentApp = intval($request['app']);
					$this->currentPlacementOptions = $request['placement_options'];

					$this->ajaxMode = true;
					$this->templatePage = 'layout';

				break;
			}
		}
	}


	/**
	 * Get main data
	 *
	 * @return void
	 */
	protected function prepareData()
	{
		$this->appList = \Bitrix\Rest\PlacementTable::getHandlersList($this->placementId);

		if($this->arParams['SAVE_LAST_APP'] == 'Y')
		{
			$userOption = \CUserOptions::GetOption('rest', 'placement_last', array());

			if($this->currentApp === null)
			{
				if(is_array($userOption) && array_key_exists($this->placementId, $userOption))
				{
					$this->currentApp = $userOption[$this->placementId];
				}
			}
			else
			{
				if(!is_array($userOption))
				{
					$userOption = array();
				}

				if(!array_key_exists($this->placementId, $userOption))
				{
					$userOption[$this->placementId] = array();
				}

				$userOption[$this->placementId] = $this->currentApp;
			}

			$saveOption = false;

			foreach($this->appList as $app)
			{
				if($app['ID'] == $this->currentApp)
				{
					$saveOption = true;
					break;
				}
			}

			if($saveOption)
			{
				\CUserOptions::SetOption('rest', 'placement_last', $userOption);
			}
		}
	}

	/**
	 * Prepare data to render
	 *
	 * @return void
	 */
	protected function formatResult()
	{
		global $APPLICATION;

		$this->arResult['PLACEMENT'] = $this->placementId;
		$this->arResult['APPLICATION_LIST'] = $this->appList;
		$this->arResult['APPLICATION_CURRENT'] = (int) $this->currentApp;
		$this->arResult['SHOW_MARKET_EMPTY_COUNT'] = (int) $this->arParams['SHOW_MARKET_EMPTY_COUNT'];

		$this->arResult["IS_SLIDER"] =  isset($this->arParams['IS_SLIDER']) && $this->arParams['IS_SLIDER'] === 'Y';
		$this->arResult['APPLICATION_TAGS'] = [
			'placement',
			$this->placementId
		];
		if($this->arResult['APPLICATION_CURRENT'] <= 0)
		{
			$this->arResult['APPLICATION_CURRENT'] = $this->appList[0]['ID'];
		}

		$this->arResult['PLACEMENT_OPTIONS'] = array();
		if(!empty($this->currentPlacementOptions) && is_array($this->currentPlacementOptions))
		{
			$this->arResult['PLACEMENT_OPTIONS'] =  $this->currentPlacementOptions;
		}

		if(is_array($this->arParams['PLACEMENT_OPTIONS']))
		{
			$this->arResult['PLACEMENT_OPTIONS'] = array_merge(
				$this->arResult['PLACEMENT_OPTIONS'],
				$this->arParams['PLACEMENT_OPTIONS']
			);
		}

		$this->arResult['AJAX_URL'] = $APPLICATION->GetCurPageParam('', \Bitrix\Main\HttpRequest::getSystemParameters());
	}

	/**
	 * Extract data from cache
	 *
	 * @return bool
	 */
	protected function extractDataFromCache()
	{
		return false;
	}

	protected function putDataToCache()
	{
	}

	protected function abortDataCache()
	{
	}


	public function executeComponent()
	{
		global $APPLICATION;

		if(!$this->checkModules())
		{
			return;
		}

		try
		{
			$this->processRequest();

			if($this->ajaxMode)
			{
				$APPLICATION->RestartBuffer();
			}

			if(!$this->extractDataFromCache())
			{
				$this->prepareData();

				\CJSCore::Init(array('applayout', 'appplacement', 'marketplace'));

				$this->formatResult();
				$this->setResultCacheKeys(array());

				$this->includeComponentTemplate($this->templatePage);
				$this->putDataToCache();
			}
		}
		catch(SystemException $e)
		{
			$this->abortDataCache();

			if($this->ajaxMode)
			{
				$APPLICATION->RestartBuffer();
			}

			ShowError($e->getMessage());
		}

		if($this->ajaxMode)
		{
			\CMain::FinalActions();
			die();
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit