engine/lib/sessions.php File Reference

Go to the source code of this file.

Namespaces

namespace  Elgg::Core
 

Activate a plugin or plugins.


Functions

 elgg_get_logged_in_user_entity ()
 Return the current logged in user, or NULL if no user is logged in.
 elgg_get_logged_in_user_guid ()
 Return the current logged in user by id.
 elgg_is_logged_in ()
 Returns whether or not the user is currently logged in.
 elgg_is_admin_logged_in ()
 Returns whether or not the user is currently logged in and that they are an admin user.
 elgg_is_admin_user ($user_guid)
 Check if the given user has full access.
 elgg_authenticate ($username, $password)
 Perform user authentication with a given username and password.
 pam_auth_userpass (array $credentials=array())
 Hook into the PAM system which accepts a username and password and attempts to authenticate it against a known user.
 log_login_failure ($user_guid)
 Log a failed login for $user_guid.
 reset_login_failure_count ($user_guid)
 Resets the fail login count for $user_guid.
 check_rate_limit_exceeded ($user_guid)
 Checks if the rate limit of failed logins has been exceeded for $user_guid.
 login (ElggUser $user, $persistent=false)
 Logs in a specified ElggUser.
 logout ()
 Log the current user out.
 _elgg_session_boot ()
 Initialises the system session and potentially logs the user in.
 gatekeeper ()
 Used at the top of a page to mark it as logged in users only.
 admin_gatekeeper ()
 Used at the top of a page to mark it as logged in admin or siteadmin only.
 _elgg_session_open ($save_path, $session_name)
 Handles opening a session in the DB.
 _elgg_session_close ()
 Closes a session.
 _elgg_session_read ($id)
 Read the session data from DB failing back to file.
 _elgg_session_write ($id, $sess_data)
 Write session data to the DB falling back to file.
 _elgg_session_destroy ($id)
 Destroy a DB session, falling back to file.
 _elgg_session_gc ($maxlifetime)
 Perform garbage collection on session table / files.

Variables

global $SESSION
 Elgg magic session.

Function Documentation

_elgg_session_boot (  ) 

Initialises the system session and potentially logs the user in.

This function looks for:

1. $_SESSION['id'] - if not present, we're logged out, and this is set to 0 2. The cookie 'elggperm' - if present, checks it for an authentication token, validates it, and potentially logs the user in

$_SESSION

Returns:
bool private

Definition at line 378 of file sessions.php.

_elgg_session_close (  ) 

Closes a session.

Returns:
true private

Definition at line 516 of file sessions.php.

_elgg_session_destroy ( id  ) 

Destroy a DB session, falling back to file.

Parameters:
string $id Session ID
Returns:
bool private

Definition at line 602 of file sessions.php.

_elgg_session_gc ( maxlifetime  ) 

Perform garbage collection on session table / files.

Parameters:
int $maxlifetime Max age of a session
Returns:
bool private

Definition at line 627 of file sessions.php.

_elgg_session_open ( save_path,
session_name 
)

Handles opening a session in the DB.

Parameters:
string $save_path The path to save the sessions
string $session_name The name of the session
Returns:
true

Definition at line 500 of file sessions.php.

_elgg_session_read ( id  ) 

Read the session data from DB failing back to file.

Parameters:
string $id The session ID
Returns:
string private

Definition at line 528 of file sessions.php.

_elgg_session_write ( id,
sess_data 
)

Write session data to the DB falling back to file.

Parameters:
string $id The session ID
mixed $sess_data Session data
Returns:
bool private

Definition at line 562 of file sessions.php.

admin_gatekeeper (  ) 

Used at the top of a page to mark it as logged in admin or siteadmin only.

Returns:
void

Definition at line 480 of file sessions.php.

check_rate_limit_exceeded ( user_guid  ) 

Checks if the rate limit of failed logins has been exceeded for $user_guid.

Parameters:
int $user_guid User GUID
Returns:
bool on exceeded limit.

Definition at line 248 of file sessions.php.

elgg_authenticate ( username,
password 
)

Perform user authentication with a given username and password.

Warning:
This returns an error message on failure. Use the identical operator to check for access: if (true === elgg_authenticate()) { ... }.
See also:
login
Parameters:
string $username The username
string $password The password
Returns:
true|string True or an error message on failure private

Definition at line 142 of file sessions.php.

elgg_get_logged_in_user_entity (  ) 

Return the current logged in user, or NULL if no user is logged in.

If no user can be found in the current session, a plugin hook - 'session:get' 'user' to give plugin authors another way to provide user details to the ACL system without touching the session.

Returns:
ElggUser

Definition at line 23 of file sessions.php.

elgg_get_logged_in_user_guid (  ) 

Return the current logged in user by id.

See also:
elgg_get_logged_in_user_entity()
Returns:
int

Definition at line 39 of file sessions.php.

elgg_is_admin_logged_in (  ) 

Returns whether or not the user is currently logged in and that they are an admin user.

Returns:
bool

Definition at line 68 of file sessions.php.

elgg_is_admin_user ( user_guid  ) 

Check if the given user has full access.

Parameters:
int $user_guid The user to check
Returns:
bool
Since:
1.7.1

Definition at line 88 of file sessions.php.

elgg_is_logged_in (  ) 

Returns whether or not the user is currently logged in.

Returns:
bool

Definition at line 53 of file sessions.php.

gatekeeper (  ) 

Used at the top of a page to mark it as logged in users only.

Returns:
void

Definition at line 467 of file sessions.php.

log_login_failure ( user_guid  ) 

Log a failed login for $user_guid.

Parameters:
int $user_guid User GUID
Returns:
bool

Definition at line 194 of file sessions.php.

login ( ElggUser user,
persistent = false 
)

Logs in a specified ElggUser.

For standard registration, use in conjunction with elgg_authenticate.

See also:
elgg_authenticate
Parameters:
ElggUser $user A valid Elgg user object
boolean $persistent Should this be a persistent login?
Returns:
true or throws exception
Exceptions:
LoginException 

Definition at line 288 of file sessions.php.

logout (  ) 

Log the current user out.

Returns:
bool

Definition at line 334 of file sessions.php.

pam_auth_userpass ( array $  credentials = array()  ) 

Hook into the PAM system which accepts a username and password and attempts to authenticate it against a known user.

Parameters:
array $credentials Associated array of credentials passed to Elgg's PAM system. This function expects 'username' and 'password' (cleartext).
Returns:
bool
Exceptions:
LoginException private

Definition at line 164 of file sessions.php.

reset_login_failure_count ( user_guid  ) 

Resets the fail login count for $user_guid.

Parameters:
int $user_guid User GUID
Returns:
bool true on success (success = user has no logged failed attempts)

Definition at line 217 of file sessions.php.


Variable Documentation

global $SESSION

Elgg magic session.

Definition at line 12 of file sessions.php.

 All Classes Namespaces Files Functions Variables Enumerations
Generated on Tue May 21 00:01:19 2013 for Elgg by  doxygen 1.6.3