108 lines
1.8 KiB
PHP
108 lines
1.8 KiB
PHP
<?php
|
|
/*****************************************************************************
|
|
* User.php
|
|
* Contains key class User, as well as the Guest and Member class derived
|
|
* from it.
|
|
*
|
|
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
|
|
*****************************************************************************/
|
|
|
|
/**
|
|
* User model; contains attributes and methods shared by both members and guests.
|
|
*/
|
|
abstract class User
|
|
{
|
|
protected int $id_user;
|
|
protected string $first_name;
|
|
protected string $surname;
|
|
protected string $slug;
|
|
protected string $emailaddress;
|
|
protected string $password_hash;
|
|
protected $creation_time;
|
|
protected $last_action_time;
|
|
protected $ip_address;
|
|
protected $is_admin;
|
|
protected $reset_key;
|
|
protected $reset_blocked_until;
|
|
|
|
protected bool $is_logged;
|
|
protected bool $is_guest;
|
|
|
|
/**
|
|
* Returns user id.
|
|
*/
|
|
public function getUserId()
|
|
{
|
|
return $this->id_user;
|
|
}
|
|
|
|
/**
|
|
* Returns first name.
|
|
*/
|
|
public function getFirstName()
|
|
{
|
|
return $this->first_name;
|
|
}
|
|
|
|
/**
|
|
* Returns surname.
|
|
*/
|
|
public function getSurname()
|
|
{
|
|
return $this->surname;
|
|
}
|
|
|
|
/**
|
|
* Returns full name.
|
|
*/
|
|
public function getFullName()
|
|
{
|
|
return trim($this->first_name . ' ' . $this->surname);
|
|
}
|
|
|
|
/**
|
|
* Returns email address.
|
|
*/
|
|
public function getEmailAddress()
|
|
{
|
|
return $this->emailaddress;
|
|
}
|
|
|
|
/**
|
|
* Have a guess!
|
|
*/
|
|
public function getIPAddress()
|
|
{
|
|
return $this->ip_address;
|
|
}
|
|
|
|
public function getSlug()
|
|
{
|
|
return $this->slug;
|
|
}
|
|
|
|
/**
|
|
* Returns whether user is logged in.
|
|
*/
|
|
public function isLoggedIn()
|
|
{
|
|
return $this->is_logged;
|
|
}
|
|
|
|
/**
|
|
* Returns whether user is a guest.
|
|
*/
|
|
public function isGuest()
|
|
{
|
|
return $this->is_guest;
|
|
}
|
|
|
|
/**
|
|
* Returns whether user is an administrator.
|
|
*/
|
|
public function isAdmin()
|
|
{
|
|
return $this->is_admin;
|
|
}
|
|
}
|