|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
Data Structures | |
| interface | moodle_session |
| class | emergency_session |
| class | session_stub |
| class | legacy_file_session |
| class | database_session |
Namespaces | |
| namespace | core |
Functions | |
| if(!defined('SESSION_ACQUIRE_LOCK_TIMEOUT')) | session_get_instance () |
| session_is_legacy () | |
| session_kill_all () | |
| session_touch ($sid) | |
| session_kill ($sid) | |
| session_kill_user ($userid) | |
| session_gc () | |
| sesskey () | |
| confirm_sesskey ($sesskey=NULL) | |
| require_sesskey () | |
| set_moodle_cookie ($username) | |
| get_moodle_cookie () | |
| session_set_user ($user) | |
| session_is_loggedinas () | |
| session_get_realuser () | |
| session_loginas ($userid, $context) | |
| cron_setup_user ($user=NULL, $course=NULL) | |
| confirm_sesskey | ( | $ | sesskey = NULL | ) |
Check the sesskey and return true of false for whether it is valid. (You might like to imagine this function is called sesskey_is_valid().)
Every script that lets the user perform a significant action (that is, changes data in the database) should check the sesskey before doing the action. Depending on your code flow, you may want to use the require_sesskey() helper function.
| string | $sesskey | The sesskey value to check (optional). Normally leave this blank and this function will do required_param('sesskey', ...). |
Definition at line 972 of file sessionlib.php.


| cron_setup_user | ( | $ | user = NULL, |
| $ | course = NULL |
||
| ) |
Sets up current user and course environment (lang, etc.) in cron. Do not use outside of cron script!
| stdClass | $user | full user object, null means default cron user (admin) |
| $course | full course record, null means $SITE |
ignore admins timezone, language and locale - use site default instead!
Definition at line 1130 of file sessionlib.php.


Gets a moodle cookie with a weakly encrypted username
Definition at line 1035 of file sessionlib.php.


| require_sesskey | ( | ) |
Check the session key using confirm_sesskey(), and cause a fatal error if it does not match.
Definition at line 990 of file sessionlib.php.


| session_gc | ( | ) |
Session garbage collection
NOTE: this can not work when legacy file sessions used!
kill all sessions of deleted users
kill sessions of users with disabled plugins
now get a list of time-out candidates
Definition at line 891 of file sessionlib.php.


| if (!defined('SESSION_ACQUIRE_LOCK_TIMEOUT')) session_get_instance | ( | ) |
Factory method returning moodle_session object.
Definition at line 39 of file sessionlib.php.

Returns the $USER object ignoring current login-as session
Definition at line 1087 of file sessionlib.php.


returns true if legacy session used.
Definition at line 783 of file sessionlib.php.

Is current $USER logged-in-as somebody else?
Definition at line 1079 of file sessionlib.php.

| session_kill | ( | $ | sid | ) |
Terminates one sessions, auth hooks are not executed.
| string | $sid | session id |
Definition at line 843 of file sessionlib.php.


| session_kill_all | ( | ) |
Terminates all sessions, auth hooks are not executed. Useful in upgrade scripts.
Definition at line 792 of file sessionlib.php.

| session_kill_user | ( | $ | userid | ) |
Terminates all sessions of one user, auth hooks are not executed. NOTE: This can not work for file based sessions!
| int | $userid | user id |
Definition at line 868 of file sessionlib.php.


| session_loginas | ( | $ | userid, |
| $ | context | ||
| ) |
Login as another user - no security checks here.
| int | $userid | |
| stdClass | $context |
Create the new $USER object with all details and reload needed capabilities
Definition at line 1101 of file sessionlib.php.

| session_set_user | ( | $ | user | ) |
Setup $USER object - called during login, loginas, etc.
Call sync_user_enrolments() manually after log-in, or log-in-as.
| stdClass | $user | full user record object |
Definition at line 1069 of file sessionlib.php.


| session_touch | ( | $ | sid | ) |
Mark session as accessed, prevents timeouts.
| string | $sid |
Definition at line 816 of file sessionlib.php.


| sesskey | ( | ) |
Makes sure that $USER->sesskey exists, if $USER itself exists. It sets a new sesskey if one does not already exist, but does not overwrite existing sesskeys. Returns the sesskey string if $USER exists, or boolean false if not.
$USER
Definition at line 949 of file sessionlib.php.

| set_moodle_cookie | ( | $ | username | ) |
Sets a moodle cookie with a weakly encrypted username
| string | $username | to encrypt and place in a cookie, '' means delete current cookie |
Definition at line 1002 of file sessionlib.php.
