This object represents the user running the script

uses implements the singleton pattern
uses the exceptions handler
uses a request sent to the database
uses the link database
uses transforms $this into an array
uses translate errors
package OWR
used_by \OWR\CLI\Controller
used_by \OWR\Includes\Themes\OriginalDark\Theme
used_by \OWR\Includes\Themes\Original\Theme
used_by \OWR\Model\Users
used_by \OWR\REST\Controller
used_by \OWR\Plugins
used_by \OWR\Controller
used_by \OWR\Model
used_by \OWR\View\Utilities
used_by \OWR\Cron
used_by \OWR\Theme
used_by \OWR\DB\Request

 Methods

Cloning is denied This function can NOT be overloaded

__clone() 
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\Singleton::__clone()

Executed when serializing this object Removing $this->_tz from session

__sleep() 
author Pierre-Alain Mignot
access public

Executed when deserializing this object Register $this to PrivateSingleton, set the date_timezone and lang

__wakeUp() 
author Pierre-Alain Mignot
access public

Auth a user using his login and password

auth(string $login, string $pass) : boolean
author Pierre-Alain Mignot
access public

Parameters

$login

string

the login

$pass

string

the password

Returns

booleantrue if admin

Checks the validity of the token

checkToken(boolean $auto, int $uid, string $login, string $key, string $action) : boolean
author Pierre-Alain Mignot
access public

Parameters

$auto

boolean

automatic check

$uid

int

the user's id

$login

string

&$login the user's token

$key

string

&$key the token's key

$action

string

the related token's action

Returns

booleantrue on success

Returns the user's browser agent

getAgent() : string
author Pierre-Alain Mignot
access public

Returns

stringthe user's browser agent

Returns the user's configuration

getConfig(string $var) : mixed
author Pierre-Alain Mignot
access public

Parameters

$var

string

optionnal the var name

Returns

mixedthe value(s)

Returns the user's lang

getLang() : string
author Pierre-Alain Mignot
access public

Returns

stringthe user's lang

Returns the user's login

getLogin() : string
author Pierre-Alain Mignot
access public

Returns

stringthe user's login

Returns the user's rights

getRights() : int
author Pierre-Alain Mignot
access public

Returns

intthe user's rights

Gets the timezone(s) If a timezone is passed by argument, we will check for this validity

getTimeZones(string $timezone) : string
author Pierre-Alain Mignot
access public

Parameters

$timezone

string

the timezone, optionnal

Returns

stringthe timezone

Returns the user's timestamp, which corresponds to the last http request timestamp for this user

getTimestamp($id) : int
author Pierre-Alain Mignot
access public

Parameters

$id

stream/group/tag id

Returns

intthe user's stream/group/tag timestamp

Returns the user's token It will generate one if any

getToken() : string
author Pierre-Alain Mignot
access public

Returns

stringthe user's token

Returns the user's id

getUid() : int
author Pierre-Alain Mignot
access public

Returns

intthe user's id

Returns the user's lang in XML format

getXMLLang() : string
author Pierre-Alain Mignot
access public

Returns

stringthe user's lang in XML format

Instance getter This function can NOT be overloaded

iGet() : mixed
InheritedStatic
access public
static
author Pierre-Alain Mignot
inherited_from \OWR\Singleton::iGet()

Returns

mixedthe instance

Returns true if logged-in as an admin

isAdmin() : boolean
author Pierre-Alain Mignot
access public

Returns

booleantrue if admin

Returns true if logged-in

isLogged() : boolean
author Pierre-Alain Mignot
access public

Returns

booleantrue if logged-in at least as a user

Registers the user into the session

reg() 
author Pierre-Alain Mignot
access public

Returns the user's token related to the given action

regenerateActionToken(string $action) : string
author Pierre-Alain Mignot
access public

Parameters

$action

string

the action

Returns

stringthe user's token

Regenerate a token for the current user

regenerateToken() 
author Pierre-Alain Mignot
access public

Register function This function is called when an object is unserialized and is used to register the instance of the object This function can NOT be overloaded

register(mixed $instance) 
InheritedStatic
access public
static
author Pierre-Alain Mignot
inherited_from \OWR\Singleton::register()

Parameters

$instance

mixed

the instance to register

Resets the user to default values

reset() 
access public
author Pierre-Alain Mignot

Set a config value for the current user

setConfig(string $var, mixed $value) 
author Pierre-Alain Mignot
access public

Parameters

$var

string

the var name

$value

mixed

the value

Set the lang and variables for gettext

setLang(string $lang) : string
author Pierre-Alain Mignot
access public

Parameters

$lang

string

the lang

Returns

stringthe lang

Sets the user's timestamp, which corresponds to the last http request timestamp for this user

setTimestamp(int $id, int $timestamp) : int
author Pierre-Alain Mignot
access public

Parameters

$id

int

stream/group/tag id

$timestamp

int

the timestamp

Returns

intthe user's stream/group/tag timestamp

Sets the timezone

setTimezone(string $timezone) : string
author Pierre-Alain Mignot
access public

Parameters

$timezone

string

the timezone, optionnal

Returns

stringthe timezone

Sets the user ID Only when in CLI mode

setUid(int $id) 
author Pierre-Alain Mignot
access public

Parameters

$id

int

the user's id

Unregisters the user from the session

unregister() 
author Pierre-Alain Mignot
access public

Constructor

__construct(array $user) 
access protected
author Pierre-Alain Mignot

Parameters

$user

array

the user values

Set the user's configuration

_setConfig(array $config) 
author Pierre-Alain Mignot
access protected

Parameters

$config

array

the configuration

Set the login

_setLogin(string $login) 
author Pierre-Alain Mignot
access protected

Parameters

$login

string

the login

Set the rights

_setRights(int $rights) : int
author Pierre-Alain Mignot
access protected

Parameters

$rights

int

the rights

Returns

intthe rights

Set the values for the current user

_setUser(array $user) 
author Pierre-Alain Mignot
access protected

Parameters

$user

array

the values to set

Sets the user's id

_setUid(int $uid) : int
author Pierre-Alain Mignot
access protected

Parameters

$uid

int

the id

Returns

intthe id

 Properties

 

user browser agent

$_agent : string
access private
 

user configuration

$_config : array
access private
 

store instancied objects

$_instances : array
Inherited
access private
static
inherited_from \OWR\Singleton::$$_instances
 

user lang

$_lang : string
access private
   

user rights

$_rights : int
access private
 

timestamp of last user request

$_timestamp : array
access private
 

user timezone

$_timezone : string
access private
 

user token

$_token : string
access private
 

list of timezones

$_tz : array
access private
 

user id

$_uid : int
access private
 

user lang (xml format)

$_xmlLang : string
access private

 Constants

 

<p>administrator (and CLI user)</p>

LEVEL_ADMIN : int
 

<p>simple use</p>

LEVEL_USER : int
 

<p>not logged-in user</p>

LEVEL_VISITOR : int