<?php
namespace Claromentis\Quiz\Repository;

$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] ?: array()) + array("_bea045c0659dcf8a4b" . "e5bb64f2b53953" => base64_decode("b2JqZWN0X3R5cGUgPSBpbjppbnQ6b2JqZWN0X3R5cGU" . "="), "_a1a206ba256d65e864789b32e276" . "d773" => base64_decode("b2JqZWN0X2lkIElO" . "IGluOmludDpvYmpl" . "Y3RfaWQ="), "_fcc37122db80c55e2819d5b49d9057" . "b2" => base64_decode("aGFzaA=" . "="), "_092d3e8f6d" . "71e5b520790" . "59dd32648ff" => base64_decode("U0VMRUNUICogRlJPTSBxdWl6X2Fub255bW91c" . "w=="), "_087c01cb1445e159b79b268a5d6a2" . "f23" => base64_decode("dXNlcl9pZCA9I" . "HN0cjp1c2VyX2" . "lk"), "_2c4b4b0b7c066641f6a3f" . "5219962921a" => base64_decode("c2h" . "hMj" . "U2"), "_d6890e764d" . "034099b92d9" . "8bb4dc1c799" => base64_decode("dDhFcXpmbVhXVTZocDA" . "zRm5wQnZZYUVj"), "_064a08b00b0" . "a70378bc4fab" . "68e9624dd" => base64_decode("SU5TRVJUIElOVE8gcXVpel9hbm9ueW1vdXMgKHVzZXJfaWQgLCBvYmplY3RfdHlwZSAsIG9iamVjdF9pZCkKCQkJCQlWQ" . "UxVRVMgKHN0cjp1c2VyX2lkLCBpbnQ6b2JqZWN0X3R5cGUsIGludDpvYmplY3RfaWQp"));
use Claromentis\Core\DAL;
class AnonymousRepository
{
    protected $db;
    protected $salt;
    public function __construct(DAL\Db $_e87574de8e606d438c70d60ffb96ef44)
    {
        $this->db = $_e87574de8e606d438c70d60ffb96ef44;
        $this->salt = $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_d6890e764d034099b92d98" . "bb4dc1c799"];
    }
    
    
    
    
    
    
    
    
    
    public function UserHasVotedAnonymously($user_id, $object_type, $object_id)
    {
        $user_id = $this->Hash($user_id);
        
        
        $_30f942154645a3deca356c5cbdef7313 = new DAL\QueryBuilder($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_092d3e8f6d71e5b52079059dd32648" . "ff"]);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_087c01cb1445e159b79b268a5" . "d6a2f23"], $user_id);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_bea045c0659dcf8" . "a4be5bb64f2b5395" . "3"], $object_type);
        $_30f942154645a3deca356c5cbdef7313->AddWhereAndClause($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_a1a206ba256d65e" . "864789b32e276d77" . "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["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_064a08b00b0a70378bc4f" . "ab68e9624dd"], $user_id, $object_type, $object_id);
            $this->db->query($_7f5aa4e96d4b415a86ed72ebff677cbe);
        }
    }
    
    
    
    
    
    public function Hash($user_id)
    {
        return $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_fcc37122db80c55e2819d5b49d9057" . "b2"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_2c4b4b0b7c066641f6a3f52" . "19962921a"], $user_id . $this->salt);
    }
}