session_set_user mistakingly sets the session user to be a reference to the passed object.
This is a problem when alot of data is attached to the session user object,
as any process holding a list of these users will use more memory each time it changes user.
* has course and status fields
* $PAGE->status updated by print_header and footer
* $PAGE->set_course now replace course_setup function
* global $PAGE created in setup.php
* unit tests for functionality so far
* Moodle still seems to work after this commit!