<?php
namespace Claromentis\Quiz\Repository;

$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_a1a206ba256d" . "65e864789b32e" . "276d773" => base64_decode("b2JqZWN0X2lkIElOIGluOmludDpvYmplY3RfaW" . "Q="), "_064a08b" . "00b0a703" . "78bc4fab" . "68e9624d" . "d" => base64_decode("SU5TRVJUIElOVE8gcXVpel9hbm9ueW1vdXMgKHVzZXJfaWQgLCBvYmplY3RfdHlwZSAsIG9iamVjdF9pZCkKCQkJCQlWQUxVRVMgKHN0cjp1c" . "2VyX2lkLCBpbnQ6b2JqZWN0X3R5cGUsIGludDpvYmplY3RfaWQp"), "_fcc37122db80c55" . "e2819d5b49d9057b" . "2" => base64_decode("aG" . "Fz" . "aA" . "=="), "_087c01cb1445e159b79b268a5" . "d6a2f23" => base64_decode("dXNlcl9pZCA9IHN0cjp1c2V" . "yX2lk"), "_2c4b4b0b7c066641f6a3f521" . "9962921a" => base64_decode("c2" . "hh" . "Mj" . "U2"), "_bea045c065" . "9dcf8a4be5b" . "b64f2b53953" => base64_decode("b2JqZWN0X3R5cGUgPSBpbjppbnQ6" . "b2JqZWN0X3R5cGU="), "_092d3e8f6d71e5b52079059dd32648f" . "f" => base64_decode("U0VMRUNUICogRlJPTSBxdWl6X2Fub25" . "5bW91cw=="), "_d6890e764d034099b92d9" . "8bb4dc1c799" => base64_decode("dDhFcXpmbV" . "hXVTZocDAz" . "Rm5wQnZZYU" . "Vj"));
use Claromentis\Core\DAL;
class AnonymousRepository
{
    protected $db;
    protected $salt;
    public function __construct(DAL\Db $_e87574de8e606d438c70d60ffb96ef44)
    {
        $this->db = $_e87574de8e606d438c70d60ffb96ef44;
        $this->salt = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_d6890e7" . "64d03409" . "9b92d98b" . "b4dc1c79" . "9"];
    }
    
    
    
    
    
    
    
    
    
    public function UserHasVotedAnonymously($user_id, $object_type, $object_id)
    {
        $user_id = $this->Hash($user_id);
        
        
        $_30f942154645a3deca356c5cbdef7313 = new DAL\QueryBuilder($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_092d3e8f6d71e5b52079059dd3" . "2648ff"]);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_087c01cb1445e159b" . "79b268a5d6a2f23"], $user_id);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_bea045c0659dcf8a4be5b" . "b64f2b53953"], $object_type);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_a1a206ba256d65e864789b32e276d77" . "3"], $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["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_064a08b00b0a70378bc4fab6" . "8e9624dd"], $user_id, $object_type, $object_id);
            $this->db->query($_7f5aa4e96d4b415a86ed72ebff677cbe);
        }
    }
    
    
    
    
    
    public function Hash($user_id)
    {
        return $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_fcc37122db80c55e2819d5" . "b49d9057b2"]($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_2c4b4b0b7c066641f" . "6a3f5219962921a"], $user_id . $this->salt);
    }
}