mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
relacing deprecated functions with capability checks
This commit is contained in:
parent
0dde27bb52
commit
9ce384ba1e
10 changed files with 17 additions and 20 deletions
|
@ -7,7 +7,7 @@ if (isset($THEME->chameleonenabled) && $THEME->chameleonenabled) {
|
|||
if (isset($course->id)) {
|
||||
$chameleon_courseparam = '?id=' . $course->id;
|
||||
if (!$chameleon_isadmin) {
|
||||
$chameleon_isteacher = (isteacheredit($course->id) && isset($CFG->coursetheme));
|
||||
$chameleon_isteacher = (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id)) && isset($CFG->coursetheme));
|
||||
}
|
||||
} else {
|
||||
$chameleon_courseparam = '';
|
||||
|
|
|
@ -11,7 +11,7 @@ if (empty($THEME->chameleonenabled)) {
|
|||
|
||||
$chameleon_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
||||
if ($chameleon_id != 0 && !empty($CFG->allowcoursethemes) && !empty($THEME->chameleonteachereditenabled)) {
|
||||
if (!isteacheredit($chameleon_id)) {
|
||||
if (!has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $chameleon_id))) {
|
||||
die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme');
|
||||
}
|
||||
} else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue