<?php
namespace Claromentis\Quiz\Repository;

$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] ?: array()) + array("_2c4b4b0b7" . "c066641f6a" . "3f52199629" . "21a" => base64_decode("c2" . "hh" . "Mj" . "U2"), "_a1a206ba256d65e86478" . "9b32e276d773" => base64_decode("b2JqZWN0X2lkIElOIGluOmludDpvYm" . "plY3RfaWQ="), "_bea045c0659dcf" . "8a4be5bb64f2b53" . "953" => base64_decode("b2JqZWN0X3R5" . "cGUgPSBpbjpp" . "bnQ6b2JqZWN0" . "X3R5cGU="), "_d6890e764d034099b92d98bb4" . "dc1c799" => base64_decode("dDhFcXpmbVhXVTZocDAzRm5wQnZZYU" . "Vj"), "_092d3e8f6d71e5b5" . "2079059dd32648ff" => base64_decode("U0VMRUNUICogRlJPTSBxdWl6X2Fub255bW91c" . "w=="), "_fcc37122db80c" . "55e2819d5b49d9" . "057b2" => base64_decode("aGFzaA=" . "="), "_087c01cb1445e1" . "59b79b268a5d6a2" . "f23" => base64_decode("dXNlcl9p" . "ZCA9IHN0" . "cjp1c2Vy" . "X2lk"), "_064a08b00b0a70378bc4fab68e96" . "24dd" => base64_decode("SU5TRVJUIElOVE8gcXVpel9hbm9ueW1vdXMgKHVzZXJfaWQgLCBvYmplY3RfdHlwZSAsIG9iamVjdF9pZ" . "CkKCQkJCQlWQUxVRVMgKHN0cjp1c2VyX2lkLCBpbnQ6b2JqZWN0X3R5cGUsIGludDpvYmplY3RfaWQp"));
use Claromentis\Core\DAL;
class AnonymousRepository
{
    protected $db;
    protected $salt;
    public function __construct(DAL\Db $_e87574de8e606d438c70d60ffb96ef44)
    {
        $this->db = $_e87574de8e606d438c70d60ffb96ef44;
        $this->salt = $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_d6890e764d0" . "34099b92d98b" . "b4dc1c799"];
    }
    
    
    
    
    
    
    
    
    
    public function UserHasVotedAnonymously($user_id, $object_type, $object_id)
    {
        $user_id = $this->Hash($user_id);
        
        
        $_30f942154645a3deca356c5cbdef7313 = new DAL\QueryBuilder($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_092d3e8f6d71" . "e5b52079059dd" . "32648ff"]);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_087c01cb1445e159b79b268" . "a5d6a2f23"], $user_id);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_bea045c0659dcf8a4b" . "e5bb64f2b53953"], $object_type);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_a1a206ba256d65e864789" . "b32e276d773"], $object_id);
        $_d69bc5256e082f5dee25c2438a6ddc93 = $this->db->query($_30f942154645a3deca356c5cbdef7313->GetQuery())->fetchAllValues();
        return !empty($_d69bc5256e082f5dee25c2438a6ddc93);
    }
    
    
    
    
    
    
    public function AddAnonymousUser($user_id, $object_type, $object_id)
    {
        if (!$this->UserHasVotedAnonymously($user_id, $object_type, $object_id)) {
            $user_id = $this->Hash($user_id);
            $_7f5aa4e96d4b415a86ed72ebff677cbe = new DAL\Query($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_064a08b00b0a70378bc4f" . "ab68e9624dd"], $user_id, $object_type, $object_id);
            $this->db->query($_7f5aa4e96d4b415a86ed72ebff677cbe);
        }
    }
    
    
    
    
    
    public function Hash($user_id)
    {
        return $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_fcc37122db80c55e2" . "819d5b49d9057b2"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_2c4b4b0b7c066641f6" . "a3f5219962921a"], $user_id . $this->salt);
    }
}