Skip to content

Commit 27dbf26

Browse files
andyjdavismarinaglancy
authored andcommitted
MDL-46447 core_rate: made sure non-ajax files don't return JSON data
1 parent 91a4788 commit 27dbf26

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

rating/rate.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,17 @@
4747
$PAGE->set_url('/rating/rate.php', array('contextid' => $context->id));
4848

4949
if (!confirm_sesskey() || !has_capability('moodle/rating:rate', $context)) {
50-
echo $OUTPUT->header();
51-
echo get_string('ratepermissiondenied', 'rating');
52-
echo $OUTPUT->footer();
53-
die();
50+
print_error('ratepermissiondenied', 'rating');
5451
}
5552

5653
$rm = new rating_manager();
5754

5855
// Check the module rating permissions.
59-
// Doing this check here rather than within rating_manager::get_ratings() so we can return a json error response.
56+
// Doing this check here rather than within rating_manager::get_ratings() so we can choose how to handle the error.
6057
$pluginpermissionsarray = $rm->get_plugin_permissions_array($context->id, $component, $ratingarea);
6158

6259
if (!$pluginpermissionsarray['rate']) {
63-
$result->error = get_string('ratepermissiondenied', 'rating');
64-
echo json_encode($result);
65-
die();
60+
print_error('ratepermissiondenied', 'rating');
6661
} else {
6762
$params = array(
6863
'context' => $context,

0 commit comments

Comments
 (0)