From 1082105205dfc9416f7680a63f464ea603091fbd Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 22 Jan 2005 18:53:44 +0000 Subject: [PATCH] Modify sesskey behaviour. SC#73 --- course/mod.php | 18 +++++------------- course/mod_delete.html | 1 + mod/assignment/mod.html | 1 + mod/attendance/mod.html | 1 + mod/chat/mod.html | 3 ++- mod/choice/mod.html | 3 ++- mod/dialogue/mod.html | 3 ++- mod/exercise/mod.html | 3 ++- mod/forum/mod.html | 3 ++- mod/glossary/mod.html | 1 + mod/journal/mod.html | 3 ++- mod/label/mod.html | 1 + mod/lesson/mod.html | 1 + mod/quiz/mod.html | 3 ++- mod/resource/type/common.html | 1 + mod/scorm/mod.html | 1 + mod/survey/details.php | 3 ++- mod/survey/mod.html | 1 + mod/wiki/mod.html | 1 + mod/workshop/mod.html | 3 ++- 20 files changed, 33 insertions(+), 22 deletions(-) diff --git a/course/mod.php b/course/mod.php index 5f3be7994a..e87056ef95 100644 --- a/course/mod.php +++ b/course/mod.php @@ -25,15 +25,7 @@ } - if (isset($_POST["course"])) { // add or update form submitted - - //It caller is correct, $SESSION->sesskey must exist and coincide - if (empty($SESSION->sesskey) or !confirm_sesskey($SESSION->sesskey)) { - error(get_string('confirmsesskeybad', 'error')); - } - - //Unset this, check done - unset($SESSION->sesskey); + if (isset($_POST["course"]) and confirm_sesskey()) { // add or update form submitted if (!$course = get_record("course", "id", $mod->course)) { error("This course doesn't exist"); @@ -421,7 +413,7 @@ $form->modulename = $module->name; $form->fullmodulename = $fullmodulename; $form->instancename = $instance->name; - $SESSION->sesskey = !empty($USER->id) ? $USER->sesskey : ''; + $form->sesskey = !empty($USER->id) ? $USER->sesskey : ''; $strdeletecheck = get_string("deletecheck", "", "$form->fullmodulename"); $strdeletecheckfull = get_string("deletecheckfull", "", "$form->fullmodulename '$form->instancename'"); @@ -475,7 +467,7 @@ $form->modulename = $module->name; $form->instance = $cm->instance; $form->mode = "update"; - $SESSION->sesskey = !empty($USER->id) ? $USER->sesskey : ''; + $form->sesskey = !empty($USER->id) ? $USER->sesskey : ''; $sectionname = get_string("name$course->format"); $fullmodulename = strtolower(get_string("modulename", $module->name)); @@ -527,7 +519,7 @@ $form->modulename = $module->name; $form->instance = $cm->instance; $form->mode = "add"; - $SESSION->sesskey = !empty($USER->id) ? $USER->sesskey : ''; + $form->sesskey = !empty($USER->id) ? $USER->sesskey : ''; $sectionname = get_string("name$course->format"); $fullmodulename = strtolower(get_string("modulename", $module->name)); @@ -566,7 +558,7 @@ $form->instance = ""; $form->coursemodule = ""; $form->mode = "add"; - $SESSION->sesskey = !empty($USER->id) ? $USER->sesskey : ''; + $form->sesskey = !empty($USER->id) ? $USER->sesskey : ''; if (isset($_GET['type'])) { $form->type = $_GET['type']; } diff --git a/course/mod_delete.html b/course/mod_delete.html index 5bad6f3230..8670c0784d 100644 --- a/course/mod_delete.html +++ b/course/mod_delete.html @@ -3,6 +3,7 @@ + diff --git a/mod/assignment/mod.html b/mod/assignment/mod.html index a69c7295a4..3f48b5a0e0 100644 --- a/mod/assignment/mod.html +++ b/mod/assignment/mod.html @@ -129,6 +129,7 @@
+ diff --git a/mod/attendance/mod.html b/mod/attendance/mod.html index de03351dc5..0fc773b285 100755 --- a/mod/attendance/mod.html +++ b/mod/attendance/mod.html @@ -201,6 +201,7 @@ if ($form->hours >1) { ?> + diff --git a/mod/chat/mod.html b/mod/chat/mod.html index 43885d7ab9..34d10732ea 100644 --- a/mod/chat/mod.html +++ b/mod/chat/mod.html @@ -96,8 +96,9 @@
+ - + diff --git a/mod/choice/mod.html b/mod/choice/mod.html index a60a1fd697..b4fab5289a 100644 --- a/mod/choice/mod.html +++ b/mod/choice/mod.html @@ -262,8 +262,9 @@
+ - + diff --git a/mod/dialogue/mod.html b/mod/dialogue/mod.html index 94c82bb9bb..c37949c3f1 100644 --- a/mod/dialogue/mod.html +++ b/mod/dialogue/mod.html @@ -96,8 +96,9 @@ print_heading_with_help(get_string("furtherinformation", "dialogue"), "info", "d
+ - + diff --git a/mod/exercise/mod.html b/mod/exercise/mod.html index 578ccb1de8..2661f87ca4 100644 --- a/mod/exercise/mod.html +++ b/mod/exercise/mod.html @@ -214,8 +214,9 @@
+ - + diff --git a/mod/forum/mod.html b/mod/forum/mod.html index cff981a64a..eb4d30f565 100644 --- a/mod/forum/mod.html +++ b/mod/forum/mod.html @@ -268,8 +268,9 @@
+ - + diff --git a/mod/glossary/mod.html b/mod/glossary/mod.html index 1bf1609c8f..bd0baea6c9 100644 --- a/mod/glossary/mod.html +++ b/mod/glossary/mod.html @@ -504,6 +504,7 @@ if (!$mainglossary or $mainglossary->id == $form->instance ) { + diff --git a/mod/journal/mod.html b/mod/journal/mod.html index 3acf866d7c..20a418717a 100644 --- a/mod/journal/mod.html +++ b/mod/journal/mod.html @@ -95,8 +95,9 @@
+ - + diff --git a/mod/label/mod.html b/mod/label/mod.html index 741acef60b..863cfd9bc9 100644 --- a/mod/label/mod.html +++ b/mod/label/mod.html @@ -32,6 +32,7 @@ + diff --git a/mod/lesson/mod.html b/mod/lesson/mod.html index 9564959353..0bf9e5b0a7 100644 --- a/mod/lesson/mod.html +++ b/mod/lesson/mod.html @@ -444,6 +444,7 @@ if ($form->mode == "add") { + diff --git a/mod/quiz/mod.html b/mod/quiz/mod.html index d8fb9ca39e..6853ca59ab 100644 --- a/mod/quiz/mod.html +++ b/mod/quiz/mod.html @@ -546,6 +546,7 @@ + @@ -564,4 +565,4 @@ \ No newline at end of file + diff --git a/mod/resource/type/common.html b/mod/resource/type/common.html index 8b8eb8af39..34da88273a 100644 --- a/mod/resource/type/common.html +++ b/mod/resource/type/common.html @@ -2,6 +2,7 @@ + diff --git a/mod/scorm/mod.html b/mod/scorm/mod.html index c66a63d0bc..b36e9389bc 100755 --- a/mod/scorm/mod.html +++ b/mod/scorm/mod.html @@ -56,6 +56,7 @@ + diff --git a/mod/survey/details.php b/mod/survey/details.php index b93dd35837..04b923568c 100644 --- a/mod/survey/details.php +++ b/mod/survey/details.php @@ -58,8 +58,9 @@ + - + diff --git a/mod/survey/mod.html b/mod/survey/mod.html index d6c1666761..834c5540bd 100644 --- a/mod/survey/mod.html +++ b/mod/survey/mod.html @@ -41,6 +41,7 @@ wwwroot/course/mod.php" ?>" /> + diff --git a/mod/wiki/mod.html b/mod/wiki/mod.html index 17a98a2e43..1bef67c68a 100644 --- a/mod/wiki/mod.html +++ b/mod/wiki/mod.html @@ -207,6 +207,7 @@ + diff --git a/mod/workshop/mod.html b/mod/workshop/mod.html index aa46cf92da..2a2a624fbe 100644 --- a/mod/workshop/mod.html +++ b/mod/workshop/mod.html @@ -424,8 +424,9 @@
+ - + -- 2.39.5