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/socialnetwork/classes/general/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/socialnetwork/classes/general/log_favorites.php
<?php

class CAllSocNetLogFavorites
{
	public static function Change($user_id, $log_id, array $params = array('TRIGGER_EVENT' => true))
	{
		global $DB, $APPLICATION;

		$user_id = intval($user_id);
		$log_id = intval($log_id);

		if ($user_id <= 0 || $log_id <= 0)
		{
			if ($user_id <= 0)
				$APPLICATION->ThrowException(GetMessage("SONET_LF_WRONG_PARAMETER_USER_ID"), "EMPTY_USER_ID");
			else
				$APPLICATION->ThrowException(GetMessage("SONET_LF_WRONG_PARAMETER_LOG_ID"), "EMPTY_LOG_ID");

			return false;
		}

		$strSQL = "SELECT * FROM b_sonet_log_favorites WHERE USER_ID = ".$user_id." AND LOG_ID = ".$log_id;
		$dbRes = $DB->Query($strSQL);

		$pool = \Bitrix\Main\Application::getInstance()->getConnectionPool();
		$pool->useMasterOnly(true);

		$connection = \Bitrix\Main\Application::getConnection();

		$result = false;
		if (!$arRes = $dbRes->Fetch())
		{
			$strSQL = $connection->getSqlHelper()->getInsertIgnore(
				'b_sonet_log_favorites',
				' (USER_ID, LOG_ID) ',
				"VALUES(" . $user_id . ", " . $log_id . ")"
			);

			if ($connection->query($strSQL))
				$result = "Y";
			else
				$APPLICATION->ThrowException(GetMessage("SONET_LF_CANNOT_INSERT"), "CANNOT_INSERT");
		}
		else
		{
			$strSQL = "DELETE FROM b_sonet_log_favorites WHERE USER_ID = ".$user_id." AND LOG_ID = ".$log_id;
			if ($DB->Query($strSQL))
				$result = "N";
			else
				$APPLICATION->ThrowException(GetMessage("SONET_LF_CANNOT_INSERT"), "CANNOT_DELETE");
		}

		$pool->useMasterOnly(false);

		if(
			$result
			&& (!isset($params['TRIGGER_EVENT']) || $params['TRIGGER_EVENT'] === true)
		)
		{
			foreach(GetModuleEvents('socialnetwork', 'OnSonetLogFavorites', true) as $arEvent)
			{
				ExecuteModuleEventEx($arEvent, array(array('USER_ID' => $user_id, 'LOG_ID' => $log_id, 'OPERATION' => $result == 'Y' ? 'ADD' : 'DELETE')));
			}
		}

		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit