core MDL-19799 Upgraded deprecated calls and minor documentation improvement
This commit is contained in:
@@ -113,8 +113,10 @@ function isteacherinanycourse($userid=0, $includeadmin=true) {
|
||||
/**
|
||||
* Determines if the specified user is logged in as guest.
|
||||
*
|
||||
* See {@link isguestuser()} as an alternative
|
||||
*
|
||||
* @deprecated
|
||||
* @global object
|
||||
* @uses CONTEXT_SYSTEM
|
||||
* @param int $userid The user being tested. You can set this to 0 or leave it blank to test the currently logged in user.
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -1467,15 +1467,17 @@ class global_navigation extends navigation_node {
|
||||
protected function load_categories($categoryid=0) {
|
||||
global $PAGE, $CFG, $DB, $USER;
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
// Cache capability moodle/site:config we use this in the next bit of code
|
||||
if (!$this->cache->cached('hassiteconfig')) {
|
||||
$this->cache->hassiteconfig = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
$this->cache->hassiteconfig = has_capability('moodle/site:config', $systemcontext);
|
||||
}
|
||||
|
||||
// If the user is logged in (but not as a guest), doesnt have the site config capability,
|
||||
// and my courses havn't been disabled then we will show the user's courses in the
|
||||
// global navigation, otherwise we will show up to FRONTPAGECOURSELIMIT available courses
|
||||
if (isloggedin() && !$this->cache->hassiteconfig && !isguest() && empty($CFG->disablemycourses)) {
|
||||
if (isloggedin() && !$this->cache->hassiteconfig && !isguestuser() && empty($CFG->disablemycourses)) {
|
||||
if (!$this->cache->cached('mycourses')) {
|
||||
$this->cache->mycourses = get_my_courses($USER->id);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ if (!file_exists($CFG->themedir .'/'. $preview)) {
|
||||
$preview = 'standard';
|
||||
}
|
||||
|
||||
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/theme/preview.php', array('preview'=>$preview)));
|
||||
|
||||
require_login();
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
Reference in New Issue
Block a user