From 79fb7ea7d3ecc25da990c3ffe2c8e783416edd97 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Wed, 30 Apr 2008 04:45:22 +0000 Subject: [PATCH] "MDL-14460,fix get_context_instance" --- blog/edit.php | 2 +- blog/index.php | 2 +- blog/lib.php | 10 +++++----- blog/preferences.php | 2 +- calendar/lib.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/blog/edit.php b/blog/edit.php index 7b6bf68fa..fc5e5bd4f 100755 --- a/blog/edit.php +++ b/blog/edit.php @@ -19,7 +19,7 @@ if (isguest()) { print_error('noguestpost', 'blog'); } -$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); +$sitecontext = get_context_instance(CONTEXT_SYSTEM); if (!has_capability('moodle/blog:create', $sitecontext) and !has_capability('moodle/blog:manageentries', $sitecontext)) { error('You can not post or edit blogs.'); } diff --git a/blog/index.php b/blog/index.php index fa516928c..3f2dea6f9 100755 --- a/blog/index.php +++ b/blog/index.php @@ -27,7 +27,7 @@ if (empty($CFG->bloglevel)) { error('Blogging is disabled!'); } -$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); +$sitecontext = get_context_instance(CONTEXT_SYSTEM); // change block edit staus if not guest and logged in diff --git a/blog/lib.php b/blog/lib.php index 0946cdbcd..9c645334b 100755 --- a/blog/lib.php +++ b/blog/lib.php @@ -77,7 +77,7 @@ $bloglimit = optional_param('limit', get_user_preferences('blogpagesize', 10), PARAM_INT); $start = $blogpage * $bloglimit; - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); $morelink = '
  '; @@ -369,7 +369,7 @@ global $CFG, $USER; - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); if (has_capability('moodle/blog:manageentries', $sitecontext)) { return true; // can edit any blog post @@ -400,7 +400,7 @@ return true; // can view own posts in any case } - $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + $sitecontext = get_context_instance(CONTEXT_SYSTEM); if (has_capability('moodle/blog:manageentries', $sitecontext)) { return true; // can manage all posts } @@ -524,7 +524,7 @@ $tagquerysql = ''; } - if (isloggedin() && !has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM, SITEID), $USER->id, false)) { + if (isloggedin() && !has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), $USER->id, false)) { $permissionsql = 'AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')'; } else { $permissionsql = 'AND p.publishstate = \'public\''; @@ -532,7 +532,7 @@ // fix for MDL-9165, use with readuserblogs capability in a user context can read that user's private blogs // admins can see all blogs regardless of publish states, as described on the help page - if (has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) { $permissionsql = ''; } else if ($filtertype=='user' && has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_USER, $filterselect))) { $permissionsql = ''; diff --git a/blog/preferences.php b/blog/preferences.php index 3f5fdce78..d3e897f73 100755 --- a/blog/preferences.php +++ b/blog/preferences.php @@ -8,7 +8,7 @@ if ($courseid == SITEID) { require_login(); - $context = get_context_instance(CONTEXT_SYSTEM, SITEID); + $context = get_context_instance(CONTEXT_SYSTEM); } else { require_login($courseid); $context = get_context_instance(CONTEXT_COURSE, $courseid); diff --git a/calendar/lib.php b/calendar/lib.php index 329be325c..7c575d41a 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -1416,7 +1416,7 @@ function calendar_get_default_courses($ignoreref = false) { } $courses = array(); - if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID))) { + if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) { if (!empty($CFG->calendar_adminseesall)) { $courses = get_records_sql('SELECT id, 1 FROM '.$CFG->prefix.'course'); return $courses; -- 2.11.4.GIT