AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.111
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/montpellier/components/com_djcatalog2/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/montpellier/components/com_djcatalog2/helpers/rating.php
<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) 2012 DJ-Extensions.com LTD, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
class Djcatalog2HelperRating {
	/**
	 * 
	 * @param mixed $item object/$item's ID
	 * @return boolean
	 */
	public static function canVote($item) {
		$item_id = null;
		if (is_numeric($item)) {
			$item_id = $item;
		} else if (is_object($item)) {
			$item_id = $item->id;
		} else {
			return false;
		}
		
		$user = Factory::getUser();
		$params = ComponentHelper::getParams('com_djcatalog2');
		$access_cfg = $params->get('access_product_rating', 'any');
		
		if ($access_cfg == 'any') return true;
		
		if ($user->guest) return false;
		
		$db = Factory::getDbo();
		$query = $db->getQuery(true);
		$query->select('count(*)')->from('#__djc2_item_reviews')->where('user_id= ' . (int)$user->id)->where('item_id=' . $item_id);
		$db->setQuery($query);
		$rated = $db->loadResult();
		if ($rated) return false;
		
		if ($access_cfg == 'customer') {
			$invoiceStatuses = (array)$params->get('cart_status_invoice',  array('C', 'P', 'F'));
			
			
			$query = $db->getQuery(true);
			$query->select('count(*)');
			$query->from('#__djc2_order_items AS oi');
			$query->join('inner', '#__djc2_orders AS o ON o.id = oi.order_id');
			//$query->join('left', '#__djc2_item_reviews AS ir ON ir.user_id = o.user_id AND ir.item_id = oi.item_id');
			$query->where('oi.item_id = '.(int)$item_id.' AND oi.item_type=' . $db->quote('item'));
			$query->where('o.user_id=' . (int)$user->id);
			
			if (count($invoiceStatuses)) {
				$wheres=[];
				foreach ($invoiceStatuses as $status) {
					$wheres[] = 'o.status = ' . $db->quote($status);
				}
				
				$query->where('( '.implode(' OR ', $wheres).' )');
			}
			
			$db->setQuery($query);
			$purchases = $db->loadResult();

			return (bool)$purchases;
		}
		
		return true;
	}
}

Anon7 - 2022
AnonSec Team