| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/nimes/administrator/components/com_rstbox/EngageBox/ |
Upload File : |
<?php
/**
* @package EngageBox
* @version 6.1.3 Pro
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
namespace EngageBox;
defined('_JEXEC') or die('Restricted access');
class Cookie
{
/**
* The Joomla Application Object
*
* @var object
*/
private $app;
/**
* The box instance
*
* @var object
*/
private $box;
/**
* The cookie request params.
*
* @var object
*/
private $cookie;
/**
* The value of the cookie
*
* @var int
*/
private $cookie_value = 1;
/**
* The path of the cookie. It should be available in the whole domain.
*
* @var string
*/
private $cookie_path = '/';
/**
* Class constructor
*
* @param integer $box_id The box's ID
*/
public function __construct($box_id)
{
$this->box = Box::get($box_id);
$this->cookie = \JFactory::getApplication()->input->cookie;
}
/**
* Get the name of the cookie
*
* @return string
*/
private function getName()
{
return isset($this->box->id) ? 'engagebox_' . $this->box->id : '';
}
/**
* Store cookie in the browser
*
* @return void
*/
public function set()
{
if (!$this->box)
{
return;
}
$cookie_type = $this->box->params->get('cookietype', 'days');
switch ($cookie_type)
{
case 'never':
return;
case 'days':
case 'hours':
case 'minutes':
$expire = strtotime('now +' . (int) $this->box->cookie . ' ' . $cookie_type);
break;
case 'ever':
$expire = strtotime('now +20 years'); // forever
break;
default:
$expire = 0; // session
}
$this->cookie->set($this->getName(), $this->cookie_value, $expire, $this->cookie_path, '', true);
}
/**
* Check if the cookie of the box exist
*
* @return bool
*/
public function exist()
{
return $this->cookie->get($this->getName());
}
/**
* Removes the cookie from the browser
*
* @return void
*/
public function remove()
{
$this->cookie->set($this->getName(), $this->cookie_value, strtotime('-1 day'), $this->cookie_path);
}
}