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

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/mail/lib/internals/mailboxdirectorystorage.php
<?php

namespace Bitrix\Mail\Internals;

use Bitrix\Mail\MailboxDirectory;
use Bitrix\Main\Text\Emoji;

class MailboxDirectoryStorage
{
	private $mailboxId = null;
	private $data = [];

	public function __construct($mailboxId)
	{
		$this->mailboxId = $mailboxId;

		$this->init();
	}

	public function init()
	{
		$items = MailboxDirectory::fetchAll($this->mailboxId);

		$this->set($items);
	}

	public function set(array $items)
	{
		$this->group($items);
	}

	public function get(string $key, $default = null)
	{
		return $this->getData($key, $default);
	}

	public function getByHash(string $key)
	{
		$list = $this->get('hashed', []);
		return isset($list[$key]) ? $list[$key] : null;
	}

	public function getByPath(string $key)
	{
		$key = Emoji::decode($key);
		$list = $this->get('all', []);
		return isset($list[$key]) ? $list[$key] : null;
	}

	private function has(string $key)
	{
		return isset($this->data[$key]);
	}

	private function remove(string $key)
	{
		if (isset($this->data[$key]))
		{
			unset($this->data[$key]);
		}
	}

	private function reset()
	{
		$this->data = [];
	}

	private function getData(string $key, $default = null)
	{
		return $this->has($key) ? $this->data[$key] : $default;
	}

	private function setData($name, $value)
	{
		$this->data[$name] = $value;
	}

	private function group($items)
	{
		$all = [];
		$income = [];
		$outcome = [];
		$spam = [];
		$trash = [];
		$draft = [];
		$hashed = [];

		foreach ($items as $item)
		{
			$all[$item->getPath()] = $item;
			$hashed[$item->getDirMd5()] = $item;

			if ($item->isIncome())
			{
				$income[] = $item;
			}

			if ($item->isOutcome())
			{
				$outcome[] = $item;
			}

			if ($item->isSpam())
			{
				$spam[] = $item;
			}

			if ($item->isDraft())
			{
				$draft[] = $item;
			}

			if ($item->isTrash())
			{
				$trash[] = $item;
			}
		}

		$this->reset();
		$this->setData('all', $all);
		$this->setData('income', $income);
		$this->setData('outcome', $outcome);
		$this->setData('spam', $spam);
		$this->setData('trash', $trash);
		$this->setData('draft', $draft);
		$this->setData('hashed', $hashed);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit