From 06a6ed1f186f497dbbe838d35e796b1cfea65432 Mon Sep 17 00:00:00 2001
From: Petr Skoda
Date: Thu, 19 Nov 2009 19:27:12 +0000
Subject: [PATCH] MDL-20901 fixed input validation
---
calendar/event.php | 6 +++---
calendar/event_delete.html | 2 ++
calendar/event_edit.html | 1 +
calendar/event_new.html | 1 +
calendar/preferences.html | 1 +
calendar/preferences.php | 2 +-
6 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/calendar/event.php b/calendar/event.php
index 5fbc4290a3e..8ec7a8b6b5a 100644
--- a/calendar/event.php
+++ b/calendar/event.php
@@ -123,7 +123,7 @@
error('You are not authorized to do this');
}
- if($form = data_submitted()) {
+ if($form = data_submitted() and confirm_sesskey()) {
$form->name = clean_param(strip_tags($form->name,''), PARAM_CLEAN);
@@ -188,7 +188,7 @@
case 'new':
$title = get_string('newevent', 'calendar');
$form = data_submitted();
- if(!empty($form) && !empty($form->name)) {
+ if(!empty($form) && !empty($form->name) && confirm_sesskey()) {
$form->name = clean_text(strip_tags($form->name, ''));
@@ -286,7 +286,7 @@
case 'delete':
$confirm = optional_param('confirm', 0, PARAM_INT);
$repeats = optional_param('repeats', 0, PARAM_INT);
- if($confirm) {
+ if($confirm and confirm_sesskey()) {
// Kill it and redirect to day view
if(($event = get_record('event', 'id', $eventid)) !== false) {
diff --git a/calendar/event_delete.html b/calendar/event_delete.html
index 8d013ba942b..d3db9ac5ccb 100644
--- a/calendar/event_delete.html
+++ b/calendar/event_delete.html
@@ -13,6 +13,7 @@
+
@@ -31,6 +32,7 @@
+
diff --git a/calendar/event_edit.html b/calendar/event_edit.html
index 61768604444..1fc0d87d38e 100644
--- a/calendar/event_edit.html
+++ b/calendar/event_edit.html
@@ -89,6 +89,7 @@
+
diff --git a/calendar/event_new.html b/calendar/event_new.html
index 15035d5e04b..a7d9de87f18 100644
--- a/calendar/event_new.html
+++ b/calendar/event_new.html
@@ -99,6 +99,7 @@
+
diff --git a/calendar/preferences.html b/calendar/preferences.html
index b4e52c07aef..ecb80af117b 100644
--- a/calendar/preferences.html
+++ b/calendar/preferences.html
@@ -71,6 +71,7 @@
+
" />
diff --git a/calendar/preferences.php b/calendar/preferences.php
index f6fa8ca1fb6..af5a1729469 100644
--- a/calendar/preferences.php
+++ b/calendar/preferences.php
@@ -18,7 +18,7 @@
/// If data submitted, then process and store.
- if ($form = data_submitted()) {
+ if ($form = data_submitted() and confirm_sesskey()) {
foreach ($form as $preference => $value) {
switch ($preference) {
case 'timeformat':