ZenphotoCMS 1.6.x

Administrator extends PersistentObject

This is a simple class so that we have a convienient "handle" for manipulating Administrators.

NOTE: one should use the Authority::newAdministrator() method rather than directly instantiating an administrator object

Table of Contents

$exists  : mixed
$loaded  : mixed
$logout_link  : mixed
$master  : mixed
$msg  : mixed
$objects  : mixed
$passhash  : mixed
$reset  : mixed
$table  : mixed
$transient  : mixed
$id  : mixed
$cache_by  : mixed
$data  : mixed
$tempdata  : mixed
$unique_set  : mixed
$updates  : mixed
$use_cache  : mixed
__construct()  : Administrator
Constructor for an Administrator
__toString()  : string
"Magic" function to return a string identifying the object when it is treated as a string
checkChanges()  : bool
By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.
clearCache()  : mixed
Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.
clearObjectCache()  : mixed
Shortcut to clear the cache of the current object class only
copy()  : mixed
Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.
createPrimealbum()  : mixed
Creates a "prime" album for the user. Album name is based on the userid
get()  : mixed
Get the value of a variable. If $current is false, return the value as of the last save of this object.
getAlbum()  : mixed
Returns the user's "prime" album. See setAlbum().
getChallengePhraseInfo()  : mixed
getCredentials()  : mixed
Data to support other credential systems integration
getCustomData()  : mixed
Returns custom data
getData()  : array<string|int, mixed>
returns the database record of the object
getDateTime()  : date
Returns the unformatted date
getEmail()  : mixed
Returns the user email
getGroup()  : mixed
Returns user's group
getID()  : string
Returns the id
getLanguage()  : mixed
Returns the user's prefered language
getLastChange()  : string
Returns the last change user
getLastChangeUser()  : string
Returns the last change user
getLastLogon()  : mixed
returns the last time the user has logged on
getLastVisit()  : strig
Returns the last time the user visited the site being loggedin
getName()  : mixed
Returns the user name
getNameByUser()  : string
Gets the full name if set
getObjects()  : mixed
Saves local copy of managed objects.
getPass()  : mixed
Returns stored password hash
getQuota()  : mixed
Returns the users quota
getRights()  : mixed
Returns user rights
getUser()  : mixed
Returns user's user id
getValid()  : mixed
Returns the valid flag
instantiate()  : bool
}
move()  : mixed
Change one or more values of the unique set assigned to this record.
preservePrimeAlbum()  : mixed
Preserves the user's prime album as managed album even if he is in a group the album is actually set as managed
remove()  : bool
Removes a user from the system
save()  : mixed
Uptates the database with all changes
set()  : mixed
Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.
setAlbum()  : mixed
Records the "prime album" of a user. Prime albums are linked to the user and removed if the user is removed.
setChallengePhraseInfo()  : mixed
setCredentials()  : mixed
setCustomData()  : mixed
Stores custom data
setDateTime()  : mixed
Stores the date
setEmail()  : mixed
Stores the user email
setGroup()  : mixed
Sets the user's group.
setLanguage()  : mixed
Sets the user's preferec language
setLastChange()  : mixed
stores the current date in the format 'Y-m-d H:i:s' as the last change date
setLastchangeUser()  : mixed
stores the last change user
setLastVisit()  : mixed
Sets the last time the user visited the site being loggedin
setName()  : mixed
Stores the user name
setObjects()  : mixed
Returns local copy of managed objects.
setPass()  : mixed
Hashes and stores the password
setQuota()  : mixed
Sets the users quota
setRights()  : mixed
Stores user rights
setUser()  : mixed
Sets the user's user id
setValid()  : mixed
Sets the "valid" flag. Valid is 1 for users, 0 for groups and templates
updateLastVisit()  : mixed
Updates the last visit date if enabled on the options and the time frame defined has passed.
setDefaults()  : mixed
Sets default values for new objects using the set() method.
addToCache()  : mixed
add the entry to the cache
getFromCache()  : mixed
check the cache for presence of the entry and return it if found
load()  : false
Load the data array from the database, using the unique id set to get the unique record.

Properties

Methods

__construct()

Constructor for an Administrator

public __construct(mixed $user, int $valid) : Administrator
Parameters
$user : mixed
$valid : int

used to signal kind of admin object

Return values
Administrator

__toString()

"Magic" function to return a string identifying the object when it is treated as a string

public __toString() : string
Return values
string

checkChanges()

By default the object is saved if there are any updates within the property `$updates` no matter if these are actual changes to existing data.

public checkChanges([bool $update = true ]) : bool

This checks that and internally updates the $updates property with the actual changes obky so you optionally can skip unnecessary object saves.

Standard object fields lastchange and lastchangeuser are exclude because lastchange always changes and both make no sense if there is no actual content change at all.

This can be used before calling the save() method or enabled within the save() method optionally

Parameters
$update : bool = true

True (default) to also update the $updates property with changes found or clear it. False to only check for changes.

Tags
see
save()
since

ZenphotoCMS 1.5.2

Return values
bool

clearCache()

Clears the object cache by setting it to an empty array completely or a specific object (class name) cache.

public static clearCache([mixed $class = null ]) : mixed

Note: You normally never need to use this. But on certain occasions it may be necessary to avoid memory issues if you loop through a lot of object creations.

Parameters
$class : mixed = null
Tags
since

ZenphotoCMS 1.5.8

since

ZenphotoCMS 1.6: Method was made static

global

array $_zp_object_cache

Return values
mixed

clearObjectCache()

Shortcut to clear the cache of the current object class only

public clearObjectCache() : mixed
Tags
since

ZenphotoCMS 1.6

Return values
mixed

copy()

Copy this record to another unique set. Checks if the record exists there first, if so returns false. If successful returns true. No changes are made to this object and no other objects are created, just the database entry.

public copy(mixed $new_unique_set) : mixed

A call to copy is instant, it does not require a save() following it.

Parameters
$new_unique_set : mixed
Return values
mixed

createPrimealbum()

Creates a "prime" album for the user. Album name is based on the userid

public createPrimealbum([mixed $new = true ][, mixed $name = NULL ]) : mixed
Parameters
$new : mixed = true
$name : mixed = NULL
Return values
mixed

get()

Get the value of a variable. If $current is false, return the value as of the last save of this object.

public get(mixed $var[, mixed $current = true ]) : mixed
Parameters
$var : mixed
$current : mixed = true
Return values
mixed

getAlbum()

Returns the user's "prime" album. See setAlbum().

public getAlbum() : mixed
Return values
mixed

getChallengePhraseInfo()

public getChallengePhraseInfo() : mixed
Return values
mixed

getCredentials()

Data to support other credential systems integration

public getCredentials() : mixed
Return values
mixed

getCustomData()

Returns custom data

public getCustomData() : mixed
Return values
mixed

getData()

returns the database record of the object

public getData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDateTime()

Returns the unformatted date

public getDateTime() : date
Return values
date

getEmail()

Returns the user email

public getEmail() : mixed
Return values
mixed

getLanguage()

Returns the user's prefered language

public getLanguage() : mixed
Return values
mixed

getLastChange()

Returns the last change user

public getLastChange() : string
Return values
string

getLastChangeUser()

Returns the last change user

public getLastChangeUser() : string
Tags
since

ZenphotoCMS 1.5.2

Return values
string

getLastLogon()

returns the last time the user has logged on

public getLastLogon() : mixed
Return values
mixed

getLastVisit()

Returns the last time the user visited the site being loggedin

public getLastVisit() : strig
Tags
since

ZenphotoCMS 1.5.8

Return values
strig

getNameByUser()

Gets the full name if set

public static getNameByUser(string $user) : string
Parameters
$user : string

User id

Tags
since

ZenphotoCNS 1.5.8

Return values
string

getObjects()

Saves local copy of managed objects.

public getObjects([mixed $what = NULL ]) : mixed

NOTE: The database is NOT updated by this, the user object MUST be saved to cause an update

Parameters
$what : mixed = NULL
Return values
mixed

getPass()

Returns stored password hash

public getPass() : mixed
Return values
mixed

getQuota()

Returns the users quota

public getQuota() : mixed
Return values
mixed

getValid()

Returns the valid flag

public getValid() : mixed
Return values
mixed

instantiate()

}

public instantiate( $tablename,  $unique_set[,  $cache_by = NULL ][,  $use_cache = true ][,  $is_transient = false ][,  $allowCreate = true ]) : bool

Prime instantiator for Zenphoto objects

Parameters
$tablename :

The name of the database table

$unique_set :

An array of unique fields

$cache_by : = NULL
$use_cache : = true
$is_transient : = false

Set true to prevent database insertion

$allowCreate : = true

Set true to allow a new object to be made.

Return values
bool

will be true if the unique_set does not already exist

move()

Change one or more values of the unique set assigned to this record.

public move(mixed $new_unique_set) : mixed

Checks if the record already exists first, if so returns false. If successful returns true and changes $this->unique_set A call to move is instant, it does not require a save() following it.

Parameters
$new_unique_set : mixed
Return values
mixed

preservePrimeAlbum()

Preserves the user's prime album as managed album even if he is in a group the album is actually set as managed

public preservePrimeAlbum() : mixed
Return values
mixed

remove()

Removes a user from the system

public remove() : bool
Return values
bool

save()

Uptates the database with all changes

public save([bool $checkupdates = false ]) : mixed
Parameters
$checkupdates : bool = false

Default false. If true the internal $updates property is checked for actual changes so unnecessary saving is skipped. Applies to already existing objects only.

Return values
mixed

set()

Set a variable in this object. Does not persist to the database until save() is called. So, IMPORTANT: Call save() after set() to persist.

public set(mixed $var, mixed $value) : mixed

If the requested variable is not in the database, sets it in temp storage, which won't be persisted to the database.

Parameters
$var : mixed
$value : mixed
Return values
mixed

setAlbum()

Records the "prime album" of a user. Prime albums are linked to the user and removed if the user is removed.

public setAlbum(mixed $album) : mixed
Parameters
$album : mixed
Return values
mixed

setChallengePhraseInfo()

public setChallengePhraseInfo(mixed $challenge, mixed $response) : mixed
Parameters
$challenge : mixed
$response : mixed
Return values
mixed

setCredentials()

public setCredentials(mixed $cred) : mixed
Parameters
$cred : mixed
Return values
mixed

setCustomData()

Stores custom data

public setCustomData(mixed $custom_data) : mixed
Parameters
$custom_data : mixed
Return values
mixed

setDateTime()

Stores the date

public setDateTime(string $datetime) : mixed
Parameters
$datetime : string

formatted date

Return values
mixed

setEmail()

Stores the user email

public setEmail(mixed $admin_e) : mixed
Parameters
$admin_e : mixed
Return values
mixed

setGroup()

Sets the user's group.

public setGroup(mixed $group) : mixed

NOTE this does NOT set rights, etc. that must be done separately

Parameters
$group : mixed
Return values
mixed

setLanguage()

Sets the user's preferec language

public setLanguage(mixed $locale) : mixed
Parameters
$locale : mixed
Return values
mixed

setLastChange()

stores the current date in the format 'Y-m-d H:i:s' as the last change date

public setLastChange() : mixed
Return values
mixed

setLastchangeUser()

stores the last change user

public setLastchangeUser(mixed $a) : mixed
Parameters
$a : mixed
Tags
since

ZenphotoCMS 1.5.2

Return values
mixed

setLastVisit()

Sets the last time the user visited the site being loggedin

public setLastVisit([mixed $datetime = '' ]) : mixed
Parameters
$datetime : mixed = ''
Tags
since

ZenphotoCMS 1.5.8

Return values
mixed

setName()

Stores the user name

public setName(mixed $admin_n) : mixed
Parameters
$admin_n : mixed
Return values
mixed

setObjects()

Returns local copy of managed objects.

public setObjects(mixed $objects) : mixed
Parameters
$objects : mixed
Return values
mixed

setPass()

Hashes and stores the password

public setPass( $pwd) : mixed
Parameters
$pwd :
Return values
mixed

setQuota()

Sets the users quota

public setQuota(mixed $v) : mixed
Parameters
$v : mixed
Return values
mixed

setRights()

Stores user rights

public setRights(mixed $rights) : mixed
Parameters
$rights : mixed
Return values
mixed

setUser()

Sets the user's user id

public setUser(mixed $user) : mixed
Parameters
$user : mixed
Return values
mixed

setValid()

Sets the "valid" flag. Valid is 1 for users, 0 for groups and templates

public setValid(mixed $valid) : mixed
Parameters
$valid : mixed
Return values
mixed

updateLastVisit()

Updates the last visit date if enabled on the options and the time frame defined has passed.

public updateLastVisit() : mixed
Tags
since

ZenphotoCMS 1.5.8

Return values
mixed

setDefaults()

Sets default values for new objects using the set() method.

protected setDefaults() : mixed

Should do nothing in the base class; subclasses should override.

Return values
mixed

addToCache()

add the entry to the cache

private addToCache( $entry) : mixed
Parameters
$entry :
Return values
mixed

getFromCache()

check the cache for presence of the entry and return it if found

private getFromCache() : mixed
Return values
mixed

load()

Load the data array from the database, using the unique id set to get the unique record.

private load(bool $allowCreate) : false
Parameters
$allowCreate : bool

set to true to enable new object creation.

Return values
false

if the record already exists, true if a new record was created.

Search results