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/security/classes/general/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/security/classes/general/temporary_storage.php
<?php

class CSecurityTemporaryStorage
{
	const SESSION_DATA_KEY = 'SECURITY_TEMPORARY_STORAGE';
	const DEFAULT_DATA_KEY = 'default';
	protected $sessionData = array();

	public function __construct($sessionKey = '', $forceFlush = false)
	{
		$this->initializeSessionData($sessionKey);
		if($forceFlush)
		{
			$this->flushData();
		}
	}

	/*
	 * Destroy data in all temporary storage
	 */
	public static function clearAll()
	{
		unset($_SESSION[self::SESSION_DATA_KEY]);
	}

	/**
	 * @param string $key
	 */
	public function clearKey($key)
	{
		unset($this->sessionData[$key]);
	}

	/**
	 * @param string $sessionKey
	 * @return bool
	 */
	protected function initializeSessionData($sessionKey = '')
	{
		if(!is_string($sessionKey) || !$sessionKey)
			$sessionKey = self::DEFAULT_DATA_KEY;

		$this->sessionData = &$_SESSION[self::SESSION_DATA_KEY][$sessionKey];
		if(!is_array($this->sessionData))
		{
			$this->sessionData = array();
		}
		return true;
	}

	public function flushData()
	{
		$this->sessionData = array();
	}

	/**
	 * @param int|string $key
	 * @param mixed $value
	 */
	public function setData($key, $value)
	{
		$this->sessionData[$key] = $value;
	}

	/**
	 * @param int|string $key
	 * @return string
	 */
	public function getString($key)
	{
		if(isset($this->sessionData[$key]) && is_string($this->sessionData[$key]))
		{
			return $this->sessionData[$key];
		}
		else
		{
			return '';
		}
	}

	/**
	 * @param int|string $key
	 * @return int
	 */
	public function getInt($key)
	{
		if(isset($this->sessionData[$key]) && is_numeric($this->sessionData[$key]))
		{
			return $this->sessionData[$key];
		}
		else
		{
			return 0;
		}
	}

	/**
	 * @param int|string $key
	 * @return bool
	 */
	public function getBool($key)
	{
		if(isset($this->sessionData[$key]) && is_bool($this->sessionData[$key]))
		{
			return $this->sessionData[$key];
		}
		else
		{
			return false;
		}
	}

	/**
	 * @param int|string $key
	 * @return bool
	 */
	public function isEmpty($key)
	{
		if(!isset($this->sessionData[$key]) || empty($this->sessionData[$key]))
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	/**
	 * @param int|string $key
	 * @return bool
	 */
	public function isExists($key)
	{
		return isset($this->sessionData[$key]);
	}

	/**
	 * @param int|string $key
	 */
	public function increment($key)
	{
		$this->setData($key, $this->getInt($key) + 1);
	}

	/**
	 * @param int|string $key
	 */
	public function decrement($key)
	{
		$this->setData($key, $this->getInt($key) - 1);
	}

	/**
	 * @param int|string $key
	 * @return bool|array
	 */
	public function getArray($key)
	{
		if(isset($this->sessionData[$key]) && is_array($this->sessionData[$key]))
		{
			return $this->sessionData[$key];
		}
		else
		{
			return array();
		}
	}

	/**
	 * @param int|string $key
	 * @return mixed
	 */
	public function getArrayPop($key)
	{
		if(isset($this->sessionData[$key]) && is_array($this->sessionData[$key]))
		{
			return array_pop($this->sessionData[$key]);
		}
		else
		{
			return null;
		}
	}

	/**
	 * @param int|string $key
	 * @param mixed $value
	 */
	public function pushToArray($key, $value)
	{
		if(isset($this->sessionData[$key]) && is_array($this->sessionData[$key]))
		{
			array_push($this->sessionData[$key], $value);
		}
		else
		{
			$this->sessionData[$key] = array($value);
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit