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/cvetdv.ru/bitrix/modules/acrit.cleanmaster/classes/general/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/acrit.cleanmaster/classes/general/ccleanforum.php
<?php


class CCleanForum
{
	/**
	 * удалять элементов за шаг
	 */
	const MESSAGE_PER_STEP = 10;

	public function GetStepCount()
	{
		return self::MESSAGE_PER_STEP;
	}

	public function MakeFilterArray($postSubstr, $author)
	{
		$arFilter = [];
		$postSubstr = trim($postSubstr);
		if ($postSubstr != '') {
			$arFilter['%=POST_MESSAGE_HTML'] = '%' . $postSubstr . '%';
		}
		$author = trim($author);
		if ($author != '') {
			$arFilter['%=AUTHOR_NAME'] = '%' . $author . '%';
		}
		return $arFilter;
	}

	/**
	 * Получить кол-во спам-сообщений
	 *
	 * @param $postSubstr
	 * @param $author
	 * @return int
	 */
	public function GetCount($postSubstr, $author)
	{
		$arFilter = $this->MakeFilterArray($postSubstr, $author);

		$cnt = \Bitrix\Forum\MessageTable::getList([
			'select'    => ['CNT'],
			'runtime' => [
				new \Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(*)')
			],
			'filter'    => $arFilter,
		])->fetch();

		return $cnt['CNT'];
	}

	/**
	 * Удаление сообщений форума
	 * @param $postSubstr
	 * @param $author
	 * @param bool|int $noLimit = false
	 * @return bool
	 */
	public function DeleteForumMessageByFilter($postSubstr, $author, $noLimit = false)
	{
		$arFilter = $this->MakeFilterArray($postSubstr, $author);

		$params = [
			'order'     => ['ID' => 'ASC'],
			'select'    => ['ID', 'AUTHOR_NAME', 'POST_MESSAGE_HTML', 'AUTHOR_REAL_IP'],
			'filter'    => $arFilter,
			'limit'     => self::MESSAGE_PER_STEP,
		];
		if ($noLimit === true) {
			unset($params['limit']);
		}
		$rs = \Bitrix\Forum\MessageTable::getList($params);

		while ($ar = $rs->fetch()) {
			\CForumMessage::Delete($ar['ID']);
		}
	}


	public function GetExampleForumMessageByFilter($postSubstr, $author)
	{
		$arFilter = $this->MakeFilterArray($postSubstr, $author);

		$rs = \Bitrix\Forum\MessageTable::getList([
			'order'     => ['ID' => 'ASC'],
			'select'    => ['ID', 'AUTHOR_NAME', 'POST_MESSAGE_HTML', 'AUTHOR_REAL_IP'],
			'filter'    => $arFilter,
			'limit'     => 1,
		]);
		return $rs->fetch();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit