2015-12-31 19:47:34 +01:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
|
|
|
class User
|
|
|
|
{
|
|
|
|
public $db;
|
|
|
|
|
|
|
|
public function setField($field, $value)
|
|
|
|
{
|
|
|
|
$this->db[$field] = $value;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getField($field)
|
|
|
|
{
|
|
|
|
if(isset($this->db[$field])) {
|
|
|
|
return $this->db[$field];
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns username
|
|
|
|
public function username()
|
|
|
|
{
|
|
|
|
return $this->getField('username');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function firstName()
|
|
|
|
{
|
|
|
|
return $this->getField('firstName');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function lastName()
|
|
|
|
{
|
|
|
|
return $this->getField('lastName');
|
|
|
|
}
|
2017-07-02 22:46:05 +02:00
|
|
|
|
|
|
|
public function tokenAuth()
|
|
|
|
{
|
|
|
|
return $this->getField('tokenAuth');
|
|
|
|
}
|
2015-12-31 19:47:34 +01:00
|
|
|
|
|
|
|
public function role()
|
|
|
|
{
|
|
|
|
return $this->getField('role');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function password()
|
|
|
|
{
|
|
|
|
return $this->getField('password');
|
|
|
|
}
|
|
|
|
|
2016-09-07 02:14:57 +02:00
|
|
|
public function enabled()
|
|
|
|
{
|
|
|
|
$password = $this->getField('password');
|
|
|
|
|
|
|
|
return $password != '!';
|
|
|
|
}
|
|
|
|
|
2015-12-31 19:47:34 +01:00
|
|
|
public function salt()
|
|
|
|
{
|
|
|
|
return $this->getField('salt');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function email()
|
|
|
|
{
|
|
|
|
return $this->getField('email');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function registered()
|
|
|
|
{
|
|
|
|
return $this->getField('registered');
|
|
|
|
}
|
|
|
|
|
2016-02-14 01:15:19 +01:00
|
|
|
public function twitter()
|
2015-12-31 19:47:34 +01:00
|
|
|
{
|
2016-02-14 01:15:19 +01:00
|
|
|
return $this->getField('twitter');
|
2015-12-31 19:47:34 +01:00
|
|
|
}
|
|
|
|
|
2016-02-14 01:15:19 +01:00
|
|
|
public function facebook()
|
2015-12-31 19:47:34 +01:00
|
|
|
{
|
2016-02-14 01:15:19 +01:00
|
|
|
return $this->getField('facebook');
|
2015-12-31 19:47:34 +01:00
|
|
|
}
|
|
|
|
|
2017-10-02 23:17:32 +02:00
|
|
|
public function codepen()
|
|
|
|
{
|
|
|
|
return $this->getField('codepen');
|
|
|
|
}
|
|
|
|
|
2016-02-14 01:15:19 +01:00
|
|
|
public function googlePlus()
|
2015-12-31 19:47:34 +01:00
|
|
|
{
|
2016-02-14 01:15:19 +01:00
|
|
|
return $this->getField('googlePlus');
|
2015-12-31 19:47:34 +01:00
|
|
|
}
|
|
|
|
|
2016-02-14 01:15:19 +01:00
|
|
|
public function instagram()
|
2015-12-31 19:47:34 +01:00
|
|
|
{
|
2016-02-14 01:15:19 +01:00
|
|
|
return $this->getField('instagram');
|
2015-12-31 19:47:34 +01:00
|
|
|
}
|
|
|
|
|
2016-01-02 23:51:12 +01:00
|
|
|
public function profilePicture($absolute=true)
|
|
|
|
{
|
|
|
|
$filename = $this->getField('username').'.png';
|
|
|
|
|
2016-09-22 04:12:29 +02:00
|
|
|
if( !file_exists(PATH_UPLOADS_PROFILES.$filename) ) {
|
|
|
|
return '#';
|
|
|
|
}
|
|
|
|
|
2016-01-02 23:51:12 +01:00
|
|
|
if($absolute) {
|
|
|
|
return HTML_PATH_UPLOADS_PROFILES.$filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $filename;
|
|
|
|
}
|
|
|
|
|
2015-12-31 19:47:34 +01:00
|
|
|
}
|