<?php
require_once 'vendor/autoload.php';

class User
{
    public $username;
    public $first_name;
    public $last_name;
    public $organization;
    public $user_hash;
    public $password;
    public $street;
    public $zip;
    public $city;
    public $country;
    public $email;
    public $phone;
    public bool $eula_signed;
    public bool $privacy_policy_signed;

    function __construct()
    {
        $this->username = "";
        $this->first_name = "";
        $this->last_name = "";
        $this->email = "";
        $this->organization = "";
        $this->user_hash = "";
        $this->password = "";
        $this->city = "";
        $this->country = "";
        $this->zip = "";
        $this->street = "";
        $this->phone = "";
        $this->eula_signed = false;
        $this->privacy_policy_signed = false;
    }

    function __construct1(object $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this))
                $this->{$key} = $value;
        }
        if (isset($data->password)) $this->set_password($data->password);
    }

    function init_from_object(object $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this))
                $this->{$key} = $value;
        }
        if (isset($data->password)) $this->set_password($data->password);
    }

    function init_from_array(array $data)
    {
        foreach ($data as $key => $value) {
            if (array_key_exists($key, (array) $this)) {
                if (is_bool(gettype($this->{$key})) && is_string($value))
                    $this->{$key} = !empty($value);
                else
                    $this->{$key} = $value;
            }
        }
        if (!empty($data["password"])) $this->set_password($data["password"]);
    }


    function set_password(string $password)
    {
        include 'config.php';
        if ($ENCRYPT_PASSWORDS) {
            $this->user_hash = "{crypt}" . crypt($password, '$6$' . generateSalt(10) . '$');
            # $this->user_hash = "{SHA}" .  base64_encode(sha1($password, true));
        } else {
            $this->user_hash = "{CLEAR}" . $password;
        }
        $this->password = $this->user_hash;
    }

    function to_string()
    {
        $tmp_user = $this;
        $tmp_user->password = "***";
        $tmp_user->user_hash = "***";
        return  json_encode($tmp_user);
    }

    function backup_in_session()
    {
        global $_SESSION;
        foreach ($this as $key => $value) {
            $_SESSION[$key] = $value;
        }
    }

    function to_table() {
        $table = "<table  style='border: 1px solid #e1e4e8; border-collapse: collapse; width: 100%;'>";
        foreach ($this as $key => $value) {
            if ($key != "password" && $key != "user_hash" && !empty($value)) {
                if (is_bool($value)) {
                    if ($value) $value = "yes";
                    else $value = "no";
                }
                $value = str_replace("\r\n", "<br>", $value);
                $key = str_replace("_", " ", ucfirst($key));
                $table .= " <tr>
  <td style='border: 1px solid #e1e4e8; padding: 6px 13px;'><strong>$key</strong></td>
  <td style='border: 1px solid #e1e4e8; padding: 6px 13px;'>$value</td>
 </tr>\n";
            }
        }
        $table .= "</table>";
        return $table;
    }
}