%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.144.172.233
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/modules/main/lib/composite/debug/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/main/lib/composite/debug//logger.php
<?
namespace Bitrix\Main\Composite\Debug;

use Bitrix\Main\Composite\Helper;
use Bitrix\Main\Composite\Debug\Model\LogTable;
use Bitrix\Main\Composite\Engine;
use Bitrix\Main\Config\Option;
use Bitrix\Main\Localization\Loc;

class Logger
{
	const TYPE_CACHE_REWRITING = "CACHE_REWRITING";
	const TYPE_COMPONENT_VOTING = "COMPONENT_VOTING";
	const TYPE_BUFFER_RESTART = "BUFFER_RESTART";
	const TYPE_CACHE_RESET = "CACHE_RESET";

	const TYPE_GET_METHOD_ONLY = "GET_METHOD_ONLY";
	const TYPE_NCC_PARAMETER = "NCC_PARAMETER";
	const TYPE_NCC_COOKIE = "NCC_COOKIE";
	const TYPE_EXCLUDE_MASK = "EXCLUDE_MASK";
	const TYPE_EXCLUDE_PARAMETER = "EXCLUDE_PARAMETER";
	const TYPE_INCLUDE_MASK = "INCLUDE_MASK";
	const TYPE_INVALID_HOST = "INVALID_HOST";
	const TYPE_INVALID_QUERY_STRING = "INVALID_QUERY_STRING";

	const TYPE_LOCAL_REDIRECT = "LOCAL_REDIRECT";
	const TYPE_ADMIN_PANEL = "ADMIN_PANEL";
	const TYPE_PHP_SHUTDOWN = "PHP_SHUTDOWN";
	const TYPE_PAGE_NOT_CACHEABLE = "PAGE_NOT_CACHEABLE";
	const TYPE_COMPOSITE_NOT_INJECTED = "COMPOSITE_NOT_INJECTED";

	const TYPE_CC_COOKIE_NOT_FOUND = "CC_COOKIE_NOT_FOUND";
	const TYPE_SESSID_PARAMETER = "SESSID_PARAMETER";
	const TYPE_AJAX_REQUEST = "AJAX_REQUEST";
	const TYPE_BITRIX_FOLDER = "BITRIX_FOLDER";
	const TYPE_CONTROLLER_FILE = "CONTROLLER_FILE";
	const TYPE_MESSAGE = "MESSAGE";

	const END_TIME_OPTION = "composite_debug_end_time";

	public static function isOn()
	{
		return time() < Option::get("main", static::END_TIME_OPTION, 0);
	}

	public static function enable($endTime = 0)
	{
		Option::set("main", static::END_TIME_OPTION, intval($endTime));
	}

	public static function disable()
	{
		Option::delete("main", array("name" => static::END_TIME_OPTION));
	}

	public static function getEndTime()
	{
		return intval(Option::get("main", static::END_TIME_OPTION, 0));
	}

	public static function log(array $params = array())
	{
		if (!static::isOn())
		{
			return null;
		}

		$pageTitle = isset($params["TITLE"]) ? $params["TITLE"] : $GLOBALS["APPLICATION"]->getTitle();
		$pageTitle = mb_substr($pageTitle, 0, 250);

		$pageHost = isset($params["HOST"]) && mb_strlen($params["HOST"]) ? $params["HOST"] : Helper::getHttpHost();
		$pageHost = mb_substr($pageHost, 0, 100);

		$pageUri = isset($params["URI"]) && mb_strlen($params["URI"]) ? $params["URI"] : Helper::getRequestUri();
		$pageUri = mb_substr($pageUri, 0, 2000);

		$userId = 0;
		if (isset($params["USER_ID"]))
		{
			$userId = intval($params["USER_ID"]);
		}
		else if (isset($GLOBALS["USER"]) && $GLOBALS["USER"]->isAuthorized())
		{
			$userId = intval($GLOBALS["USER"]->getId());
		}

		$data = array(
			"TITLE" => $pageTitle,
			"MESSAGE" => isset($params["MESSAGE"]) && is_string($params["MESSAGE"]) ? $params["MESSAGE"] : null,
			"TYPE" =>
				isset($params["TYPE"]) && in_array($params["TYPE"], self::getTypes())
				? $params["TYPE"]
				: self::TYPE_MESSAGE,
			"URI" => $pageUri,
			"HOST" => $pageHost,
			"USER_ID" => $userId,
			"AJAX" => Engine::isAjaxRequest() ? "Y" : "N",
			"PAGE_ID" => isset($params["PAGE_ID"]) ? intval($params["PAGE_ID"]) : 0
		);

		$GLOBALS["DB"]->StartUsingMasterOnly();

		$result = LogTable::add($data);

		$GLOBALS["DB"]->StopUsingMasterOnly();

		return $result;
	}

	/**
	 * Returns logger types
	 * @return array
	 */
	public static function getTypes()
	{
		static $types = null;
		if ($types !== null)
		{
			return $types;
		}

		$types = array();
		$refClass = new \ReflectionClass(__CLASS__);
		foreach ($refClass->getConstants() as $name => $value)
		{
			if (mb_substr($name, 0, 4) === "TYPE")
			{
				$types[] = $value;
			}
		}

		return $types;
	}

	/**
	 * Returns name for specific type. Returns null if type is invalid .
	 * @param string $type Log Message Type.
	 * @return null|string
	 */
	public static function getTypeName($type)
	{
		static $messagesLoaded = false;

		if (!$messagesLoaded)
		{
			Loc::loadMessages(__FILE__);
			$messagesLoaded = true;
		}

		$types = static::getTypes();
		if (!in_array($type, $types))
		{
			return null;
		}

		return Loc::getMessage("MAIN_COMPOSITE_LOG_{$type}") ?: $type;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit