[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/ -> sessionlib.php (summary)

(no description)

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
Copyright: 2008, 2009 Petr Skoda {@link http://skodak.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 215 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  sesskey()
  confirm_sesskey()
  require_sesskey()
  set_moodle_cookie()
  get_moodle_cookie()
  cron_setup_user()

Functions
Functions that are not part of a class:

sesskey()   X-Ref
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.

return: string

confirm_sesskey($sesskey=NULL)   X-Ref
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 {@link require_sesskey()}
helper function.

param: string $sesskey The sesskey value to check (optional). Normally leave this blank
return: bool whether the sesskey sent in the request matches the one stored in the session.

require_sesskey()   X-Ref
Check the session key using {@link confirm_sesskey()},
and cause a fatal error if it does not match.


set_moodle_cookie($username)   X-Ref
Sets a moodle cookie with a weakly encrypted username

param: string $username to encrypt and place in a cookie, '' means delete current cookie
return: void

get_moodle_cookie()   X-Ref
Gets a moodle cookie with a weakly encrypted username

return: string username

cron_setup_user($user = NULL, $course = NULL)   X-Ref
Sets up current user and course environment (lang, etc.) in cron.
Do not use outside of cron script!

param: stdClass $user full user object, null means default cron user (admin),
param: stdClass $course full course record, null means $SITE
return: void



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1