"MDL-14460,fix get_context_instance, merged from MOODLE_19_STABLE"

This commit is contained in:
dongsheng 2008-04-30 04:46:46 +00:00
parent 33aa5723ca
commit d9d16e56a3
5 changed files with 9 additions and 9 deletions

View File

@ -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)) {
print_error('cannoteditpostorblog');
}

View File

@ -27,7 +27,7 @@ if (empty($CFG->bloglevel)) {
print_error('blogdisable', 'blog');
}
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
// change block edit staus if not guest and logged in

View File

@ -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 = '<br />&nbsp;&nbsp;';
@ -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 = '';

View File

@ -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);

View File

@ -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;