From ceebb2ec5f41bddbabc5d55f2cecc8f15cec0bcf Mon Sep 17 00:00:00 2001 From: samhemelryk Date: Wed, 30 Sep 2009 06:14:58 +0000 Subject: [PATCH] core MDL-19799 Upgraded deprecated calls and minor documentation improvement --- lib/deprecatedlib.php | 4 +++- lib/navigationlib.php | 6 ++++-- theme/preview.php | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index cd44793efc..41468d5198 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -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 */ diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 692fe67fd6..2e46a611b9 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -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); } diff --git a/theme/preview.php b/theme/preview.php index a2404424cd..30fb709f9e 100644 --- a/theme/preview.php +++ b/theme/preview.php @@ -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)); -- 2.39.5