| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/icd/administrator/components/com_akeeba/liveupdate/classes/storage/ |
Upload File : |
<?php
/**
* @package LiveUpdate
* @copyright Copyright ©2011 Nicholas K. Dionysopoulos / AkeebaBackup.com
* @license GNU LGPLv3 or later <http://www.gnu.org/copyleft/lesser.html>
*/
defined('_JEXEC') or die();
/**
* Abstract class for the update parameters storage
* @author nicholas
*
*/
class LiveUpdateStorage
{
/**
* The update data registry
* @var JRegistry
*/
protected static $registry = null;
/**
*
* @param string $type
* @param array $config
* @return LiveUpdateStorage
*/
public static function getInstance($type, $config)
{
static $instances = array();
$sig = md5($type, serialize($config));
if(!array_key_exists($sig, $instances)) {
require_once dirname(__FILE__).'/'.strtolower($type).'.php';
$className = 'LiveUpdateStorage'.ucfirst($type);
$object = new $className($config);
$object->load($config);
$instances[$sig] = $object;
}
return $instances[$sig];
}
public final function set($key, $value)
{
if($key == 'updatedata') {
if(function_exists('json_encode') && function_exists('json_decode')) {
$value = json_encode($value);
} elseif(function_exists('base64_encode') && function_exists('base64_decode')) {
$value = base64_encode(serialize($value));
} else {
$value = serialize($value);
}
}
self::$registry->setValue("update.$key", $value);
}
public final function get($key, $default)
{
$value = self::$registry->getValue("update.$key", $default);
if($key == 'updatedata') {
if(function_exists('json_encode') && function_exists('json_decode')) {
$value = json_decode($value);
} elseif(function_exists('base64_encode') && function_exists('base64_decode')) {
$value = unserialize(base64_decode($value));
} else {
$value = unserialize($value);
}
}
return $value;
}
public function save() {}
public function load($config) {}
}