403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/engine/actionfilter/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/engine/actionfilter/scope.php
<?php

namespace Bitrix\Main\Engine\ActionFilter;

use Bitrix\Main\ArgumentOutOfRangeException;
use Bitrix\Main\Engine\Controller;
use Bitrix\Main\Error;
use Bitrix\Main\Event;
use Bitrix\Main\EventResult;

class Scope extends Base
{
	public const AJAX = 0b00000001;
	public const REST = 0b00000010;
	public const CLI  = 0b00000100;
	public const ALL  = 0b00000111;

	public const NOT_AJAX = self::ALL & ~self::AJAX;
	public const NOT_REST = self::ALL & ~self::REST;
	public const NOT_CLI  = self::ALL & ~self::CLI;

	private $scopes;

	public function __construct($scopes)
	{
		$this->scopes = $scopes;
		parent::__construct();
	}

	public function onBeforeAction(Event $event)
	{
		$scope = $this->getCurrentScope();
		if (($this->scopes & $scope) === $scope)
		{
			return null;
		}

		$this->addError(new Error('Requested scope is invalid'));

		return new EventResult(EventResult::ERROR, null, null, $this);
	}

	protected function getCurrentScope()
	{
		switch ($this->getAction()->getController()->getScope())
		{
			case Controller::SCOPE_AJAX:
				return static::AJAX;
			case Controller::SCOPE_REST:
				return static::REST;
			case Controller::SCOPE_CLI:
				return static::CLI;
		}

		throw new ArgumentOutOfRangeException('Scope is invalid');
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit