Skip to content
Snippets Groups Projects
Commit cc4ef9c7 authored by Friederike Schwager's avatar Friederike Schwager Committed by Friederike Schwager
Browse files

#9 check sesskey

parent 4ffc2036
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ class answermenu implements \renderable, \templatable { ...@@ -58,6 +58,7 @@ class answermenu implements \renderable, \templatable {
$urlparams['annotationid'] = $annotationid; $urlparams['annotationid'] = $annotationid;
$urlparams['itemsperpage'] = $itemsperpage; $urlparams['itemsperpage'] = $itemsperpage;
$urlparams['answerfilter'] = $answerfilter; $urlparams['answerfilter'] = $answerfilter;
$urlparams['sesskey'] = sesskey();
$url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams);
$this->url = $url; $this->url = $url;
......
...@@ -261,7 +261,7 @@ class comment implements \renderable, \templatable { ...@@ -261,7 +261,7 @@ class comment implements \renderable, \templatable {
private function addforwardbutton($comment, $forwardquestions, $cm) { private function addforwardbutton($comment, $forwardquestions, $cm) {
if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions) { if (!isset($comment->type) && $comment->isquestion && !$comment->isdeleted && $forwardquestions) {
global $CFG; global $CFG;
$urlparams = ['id' => $cm->id, 'action' => 'forwardquestion', 'commentid' => $comment->uuid]; $urlparams = ['id' => $cm->id, 'action' => 'forwardquestion', 'commentid' => $comment->uuid, 'sesskey' => sesskey()];
$url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams);
$comment->buttons[] = ["classes" => "comment-forward-a", "attributes" => ["name" => "onclick", "value" => "window.location.href = '$url';"], $comment->buttons[] = ["classes" => "comment-forward-a", "attributes" => ["name" => "onclick", "value" => "window.location.href = '$url';"],
......
...@@ -44,6 +44,7 @@ class questionmenu implements \renderable, \templatable { ...@@ -44,6 +44,7 @@ class questionmenu implements \renderable, \templatable {
$urlparams['action'] = 'forwardquestion'; $urlparams['action'] = 'forwardquestion';
$urlparams['fromoverview'] = '1'; $urlparams['fromoverview'] = '1';
$urlparams['commentid'] = $commentid; $urlparams['commentid'] = $commentid;
$urlparams['sesskey'] = sesskey();
$url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams); $url = new moodle_url($CFG->wwwroot . '/mod/pdfannotator/view.php', $urlparams);
$this->url = $url; $this->url = $url;
......
...@@ -28,6 +28,8 @@ $taburl = new moodle_url('/mod/pdfannotator/view.php', array('id' => $id)); ...@@ -28,6 +28,8 @@ $taburl = new moodle_url('/mod/pdfannotator/view.php', array('id' => $id));
$myrenderer = $PAGE->get_renderer('mod_pdfannotator'); $myrenderer = $PAGE->get_renderer('mod_pdfannotator');
require_course_login($pdfannotator->course, true, $cm);
/* * ********************************************** Display overview page *********************************************** */ /* * ********************************************** Display overview page *********************************************** */
if ($action === 'overview') { if ($action === 'overview') {
...@@ -36,6 +38,7 @@ if ($action === 'overview') { ...@@ -36,6 +38,7 @@ if ($action === 'overview') {
} }
if ($action === 'forwardquestion') { if ($action === 'forwardquestion') {
require_sesskey();
require_capability('mod/pdfannotator:forwardquestions', $context); require_capability('mod/pdfannotator:forwardquestions', $context);
require_once($CFG->dirroot . '/mod/pdfannotator/forward_form.php'); require_once($CFG->dirroot . '/mod/pdfannotator/forward_form.php');
global $USER; global $USER;
...@@ -182,7 +185,7 @@ if ($action === 'overviewquestions') { ...@@ -182,7 +185,7 @@ if ($action === 'overviewquestions') {
* all answers. * all answers.
*/ */
if ($action === 'subscribeQuestion') { if ($action === 'subscribeQuestion') {
require_sesskey();
require_capability('mod/pdfannotator:subscribe', $context); require_capability('mod/pdfannotator:subscribe', $context);
global $DB; global $DB;
...@@ -205,7 +208,7 @@ if ($action === 'subscribeQuestion') { ...@@ -205,7 +208,7 @@ if ($action === 'subscribeQuestion') {
* answers to questions to which the user is subscribed. * answers to questions to which the user is subscribed.
*/ */
if ($action === 'unsubscribeQuestion') { if ($action === 'unsubscribeQuestion') {
require_sesskey();
require_capability('mod/pdfannotator:subscribe', $context); require_capability('mod/pdfannotator:subscribe', $context);
global $DB; global $DB;
...@@ -306,6 +309,7 @@ if ($action === 'overviewownposts') { ...@@ -306,6 +309,7 @@ if ($action === 'overviewownposts') {
* (either unread reports (reportfiler == 0) or all reports (reportfilter == 2)). * (either unread reports (reportfiler == 0) or all reports (reportfilter == 2)).
*/ */
if ($action === 'markreportasread') { // XXX Rename key and move it into $action === 'overviewreports' if ($action === 'markreportasread') { // XXX Rename key and move it into $action === 'overviewreports'
require_sesskey();
require_capability('mod/pdfannotator:viewreports', $context); require_capability('mod/pdfannotator:viewreports', $context);
global $DB; global $DB;
...@@ -341,6 +345,7 @@ if ($action === 'markreportasread') { // XXX Rename key and move it into $action ...@@ -341,6 +345,7 @@ if ($action === 'markreportasread') { // XXX Rename key and move it into $action
* (either unread reports (reportfiler == 0) or all reports (reportfilter == 2)). * (either unread reports (reportfiler == 0) or all reports (reportfilter == 2)).
*/ */
if ($action === 'markreportasunread') { // XXX Rename key and move it into $action === 'overviewreports' if ($action === 'markreportasunread') { // XXX Rename key and move it into $action === 'overviewreports'
require_sesskey();
require_capability('mod/pdfannotator:viewreports', $context); require_capability('mod/pdfannotator:viewreports', $context);
global $DB; global $DB;
...@@ -484,6 +489,7 @@ if ($action === 'report') { ...@@ -484,6 +489,7 @@ if ($action === 'report') {
echo $myrenderer->pdfannotator_render_tabs($taburl, $action, $pdfannotator->name, $context); echo $myrenderer->pdfannotator_render_tabs($taburl, $action, $pdfannotator->name, $context);
pdfannotator_display_embed($pdfannotator, $cm, $course, $file); pdfannotator_display_embed($pdfannotator, $cm, $course, $file);
} else if ($report = $mform->get_data()) { // Process validated data. $mform->get_data() returns data posted in form. } else if ($report = $mform->get_data()) { // Process validated data. $mform->get_data() returns data posted in form.
require_sesskey();
global $USER; global $USER;
// 1. Notify course manager(s). // 1. Notify course manager(s).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment