mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
"MDL-14460,fix get_context_instance, merged from MOODLE_19_STABLE"
This commit is contained in:
parent
33aa5723ca
commit
d9d16e56a3
@ -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');
|
||||
}
|
||||
|
@ -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
|
||||
|
10
blog/lib.php
10
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 = '<br /> ';
|
||||
|
||||
@ -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 = '';
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user