From e101802eb5e6bfdf3e49738b13b6725348a93c99 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 24 Oct 2004 23:57:25 +0000 Subject: [PATCH] Added sesskey to more actions + bug fix when detecting directory traversals. From skodak! Merged from MOODLE_14_STABLE --- files/index.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/files/index.php b/files/index.php index 64da2bf095..889ce72e6d 100644 --- a/files/index.php +++ b/files/index.php @@ -184,7 +184,7 @@ case "move": html_header($course, $wdir); - if ($count = setfilelist($_POST)) { + if (($count = setfilelist($_POST)) and confirm_sesskey()) { $USER->fileop = $action; $USER->filesource = $wdir; echo "

"; @@ -197,7 +197,7 @@ case "paste": html_header($course, $wdir); - if (isset($USER->fileop) and $USER->fileop == "move") { + if (isset($USER->fileop) and ($USER->fileop == "move") and confirm_sesskey()) { foreach ($USER->filelist as $file) { $shortfile = basename($file); $oldfile = $basedir.$file; @@ -291,7 +291,7 @@ case "edit": html_header($course, $wdir); - if (isset($text)) { + if (isset($text) and confirm_sesskey()) { $fileptr = fopen($basedir.$file,"w"); fputs($fileptr, stripslashes($text)); fclose($fileptr); @@ -318,6 +318,7 @@ echo " "; echo " "; echo " "; + echo " sesskey\" />"; print_textarea($usehtmleditor, 25, 80, 680, 400, "text", $contents); echo ""; echo " "; @@ -540,8 +541,9 @@ function setfilelist($VARS) { foreach ($VARS as $key => $val) { if (substr($key,0,4) == "file") { $count++; + $val = rawurldecode($val); if (!detect_munged_arguments($val, 0)) { - $USER->filelist[] = rawurldecode($val); + $USER->filelist[] = $val; } } } @@ -731,6 +733,7 @@ function displaydir ($wdir) { echo ""; echo ""; echo " "; + echo "sesskey\" />"; $options = array ( "move" => "$strmovetoanotherfolder", "delete" => "$strdeletecompletely", @@ -747,6 +750,7 @@ function displaydir ($wdir) { echo " "; echo " "; echo " "; + echo " sesskey\" />"; echo " "; echo ""; } -- 2.39.5