From 4530d4372a452ea125f6695e7a2991c74b8e86ae Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 22 Jan 2005 21:02:12 +0000 Subject: [PATCH] Changed some sesskey behaviours SC#73 (admin part) --- admin/backup.php | 6 +----- admin/configure.php | 2 +- admin/filters.php | 13 +++++-------- admin/lang.php | 19 ++++++++++--------- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/admin/backup.php b/admin/backup.php index 9d7bdda164..c461c00523 100644 --- a/admin/backup.php +++ b/admin/backup.php @@ -15,17 +15,13 @@ error("Site isn't defined!"); } - if (!confirm_sesskey()) { - error(get_string('confirmsesskeybad', 'error')); - } - //Initialise error variables $error = false; $sche_destination_error = ""; /// If data submitted, then process and store. - if ($config = data_submitted()) { + if (($config = data_submitted()) && confirm_sesskey()) { //First of all we check that everything is correct //Check for trailing slash and backslash in backup_sche_destination diff --git a/admin/configure.php b/admin/configure.php index ed82aeabcf..68e6036a3f 100644 --- a/admin/configure.php +++ b/admin/configure.php @@ -37,7 +37,7 @@ $table->data[] = array("". get_string('managefilters') .'', get_string('adminhelpmanagefilters')); if (!isset($CFG->disablescheduledbackups)) { - $table->data[] = array("sesskey\">".get_string("backup")."", + $table->data[] = array("".get_string("backup")."", get_string('adminhelpbackup')); } diff --git a/admin/filters.php b/admin/filters.php index 62a159177e..1f999f29a7 100644 --- a/admin/filters.php +++ b/admin/filters.php @@ -16,10 +16,6 @@ error("Only administrators can use this page!"); } - if (!confirm_sesskey()) { - error(get_string('confirmsesskeybad', 'error')); - } - if (!$site = get_site()) { error("Site isn't defined!"); } @@ -86,22 +82,23 @@ /// If data submitted, then process and store. if (!empty($options)) { - if ($config = data_submitted()) { + if (($config = data_submitted()) && confirm_sesskey()) { unset($config->options); + unset($config->sesskey); foreach ($config as $name => $value) { set_config($name, $value); } } } - if (!empty($add) and !empty($uselect)) { + if (!empty($add) and !empty($uselect) and confirm_sesskey()) { $selectedfilter = $uselect; if (!in_array($selectedfilter, $installedfilters)) { $installedfilters[] = $selectedfilter; set_config("textfilters", implode(',', $installedfilters)); } - } else if (!empty($remove) and !empty($iselect)) { + } else if (!empty($remove) and !empty($iselect) and confirm_sesskey()) { $selectedfilter = $iselect; foreach ($installedfilters as $key => $installedfilter) { if ($installedfilter == $selectedfilter) { @@ -110,7 +107,7 @@ } set_config("textfilters", implode(',', $installedfilters)); - } else if ((!empty($up) or !empty($down)) and !empty($iselect)) { + } else if ((!empty($up) or !empty($down)) and !empty($iselect) and confirm_sesskey()) { if (!empty($up)) { if ($allfilters[$iselect]) { diff --git a/admin/lang.php b/admin/lang.php index 1a61e9eddb..9be450d173 100644 --- a/admin/lang.php +++ b/admin/lang.php @@ -29,7 +29,6 @@ $title = $strmissingstrings; $button = '
'. ''. - ''. '
'; break; case "compare": @@ -37,7 +36,6 @@ $title = $strcomparelanguage; $button = '
'. ''. - ''. '
'; break; default: @@ -62,8 +60,8 @@ echo ""; echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true); echo ""; - print_heading("sesskey\">$strmissingstrings"); - print_heading("sesskey\">$strcomparelanguage"); + print_heading("$strmissingstrings"); + print_heading("$strcomparelanguage"); echo "

"; $options["lang"] = $currentlang; print_single_button("http://moodle.org/download/lang/", $options, get_string("latestlanguagepack")); @@ -87,7 +85,7 @@ } } - if ($mode == "missing" and confirm_sesskey()) { + if ($mode == "missing") { // For each file, check that a counterpart exists, then check all the strings foreach ($stringfiles as $file) { @@ -153,15 +151,18 @@ notice(get_string("languagegood"), "lang.php"); } - } else if ($mode == "compare" and confirm_sesskey()) { + } else if ($mode == "compare") { if (isset($_POST['currentfile'])){ // Save a file + if (!confirm_sesskey()) { + error(get_string('confirmsesskeybad', 'error')); + } $newstrings = $_POST; unset($newstrings['currentfile']); if (lang_save_file($langdir, $currentfile, $newstrings)) { notify(get_string("changessaved")." ($langdir/$currentfile)", "green"); } else { - error("Could not save the file '$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile&sesskey=$USER->sesskey"); + error("Could not save the file '$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile"); } } @@ -173,7 +174,7 @@ if ($file == $currentfile) { echo "$file   "; } else { - echo "sesskey\">$file   "; + echo "$file   "; } } echo '
'; @@ -216,7 +217,6 @@ if ($editable) { echo "
"; - echo ''; } echo ""; foreach ($enstring as $key => $envalue) { @@ -266,6 +266,7 @@ } if ($editable) { echo "
 
"; + echo ''; echo " "; echo " "; echo " "; -- 2.39.5