Changed some sesskey behaviours SC#73 (admin part)

This commit is contained in:
stronk7
2005-01-22 21:02:12 +00:00
parent 7a0a2f49fc
commit 4530d4372a
4 changed files with 17 additions and 23 deletions
+10 -9
View File
@@ -29,7 +29,6 @@
$title = $strmissingstrings;
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
'<input type="hidden" name="mode" value="compare" />'.
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />'.
'<input type="submit" value="'.$strcomparelanguage.'" /></form>';
break;
case "compare":
@@ -37,7 +36,6 @@
$title = $strcomparelanguage;
$button = '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
'<input type="hidden" name="mode" value="missing" />'.
'<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />'.
'<input type="submit" value="'.$strmissingstrings.'" /></form>';
break;
default:
@@ -62,8 +60,8 @@
echo "</td><td>";
echo popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
echo "</td></tr></table>";
print_heading("<a href=\"lang.php?mode=missing&sesskey=$USER->sesskey\">$strmissingstrings</a>");
print_heading("<a href=\"lang.php?mode=compare&sesskey=$USER->sesskey\">$strcomparelanguage</a>");
print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>");
print_heading("<a href=\"lang.php?mode=compare\">$strcomparelanguage</a>");
echo "<center><hr noshade=\"noshade\" size=\"1\" />";
$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&amp;currentfile=$currentfile&amp;sesskey=$USER->sesskey");
error("Could not save the file '$currentfile'!", "lang.php?mode=compare&amp;currentfile=$currentfile");
}
}
@@ -173,7 +174,7 @@
if ($file == $currentfile) {
echo "<b>$file</b> &nbsp; ";
} else {
echo "<a href=\"lang.php?mode=compare&currentfile=$file&sesskey=$USER->sesskey\">$file</a> &nbsp; ";
echo "<a href=\"lang.php?mode=compare&currentfile=$file\">$file</a> &nbsp; ";
}
}
echo '</font></center>';
@@ -216,7 +217,6 @@
if ($editable) {
echo "<form name=\"$currentfile\" action=\"lang.php\" method=\"post\">";
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
}
echo "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"3\" border=\"0\">";
foreach ($enstring as $key => $envalue) {
@@ -266,6 +266,7 @@
}
if ($editable) {
echo "<tr><td colspan=\"2\">&nbsp;<td><br />";
echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
echo " <input type=\"hidden\" name=\"currentfile\" value=\"$currentfile\">";
echo " <input type=\"hidden\" name=\"mode\" value=\"compare\">";
echo " <input type=\"submit\" name=\"update\" value=\"".get_string("savechanges").": $currentfile\">";