]> git.mjollnir.org Git - moodle.git/commitdiff
Merged sesskey fixes from STABLE
authormoodler <moodler>
Mon, 4 Oct 2004 13:50:37 +0000 (13:50 +0000)
committermoodler <moodler>
Mon, 4 Oct 2004 13:50:37 +0000 (13:50 +0000)
admin/config.html
admin/config.php
admin/site.html
admin/site.php
admin/timezone.php
admin/upgradelogs.php
admin/user.php

index 54653e52ca008e47675e81a51a0dc7afd4c861d2..5a141074aa4424b117b909cb163c42382d5ab240 100644 (file)
 
 <tr>
     <td colspan="3" align="center">
-    <input type="submit" value="<?php print_string("savechanges") ?>"></td>
+    <input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" />
+    <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
 </tr>
 </table>
 
index 8d7072397955cffbb39923293ceee21e9801e128..f8b1f94082b0af8ba2443ddbb36bee2757f9a4d1 100644 (file)
 
        if ($config = data_submitted($match)) {  
 
+        if (isset($USER)) {             // Additional identity check
+            if (!confirm_sesskey()) {
+                error(get_string('confirmsesskeybad', 'error'));
+            }
+        }
+
         validate_form($config, $err);
 
         if (count($err) == 0) {
@@ -82,6 +88,8 @@
         echo "<br />";
     }
 
+    $sesskey = isset($USER) ? $USER->sesskey : '';
+
     print_simple_box_start("center", "", "$THEME->cellheading");
        include("config.html");
     print_simple_box_end();
 
 function validate_form(&$form, &$err) {
 
-   // if (empty($form->fullname))
-   //     $err["fullname"] = get_string("missingsitename");
+    // Currently no checks are needed ...
 
-    return;
+    return true;
 }
 
 
index 21c58ecf64d838377215ace70145657687f31ed0..b406720c434bce538341c38d791d3d910d0a09f3 100644 (file)
@@ -1,4 +1,4 @@
-<form method="post" action="site.php" name="form" <?php echo $onsubmit ?>>
+<form method="post" action="site.php" name="form">
 <table cellpadding="9" cellspacing="0" >
 <tr valign="top">
     <td align="right"><p><?php print_string("fullsitename") ?>:</td>
 <input type="hidden" name="id" value="<?php p($form->id) ?>">
 <input type="hidden" name="category" value="<?php p($form->category) ?>">
 <input type="hidden" name="format" value="<?php p($form->format) ?>">
+<input type="hidden" name="sesskey" value="<?php p($sesskey) ?>">
 </form>
-
-<?php 
-   if ($usehtmleditor) { 
-       print_richedit_javascript("form", "summary", "no");
-   }
-?>
index a55d73bb09540f68e34793f07fc8239fbd2e91e3..aa9bdd2ca77d2d251a0943923070b78ebaad77a5 100644 (file)
 
        if ($form = data_submitted()) {
 
+        if (isset($USER)) {             // Additional identity check
+            if (!confirm_sesskey()) {
+                error(get_string('confirmsesskeybad', 'error'));
+            }
+        }
+
         validate_form($form, $err);
 
         if (count($err) == 0) {
         print_heading($strsitesettings);
     }
 
-    $defaultformat = FORMAT_HTML;
-    if ($usehtmleditor = can_use_richtext_editor()) {
-        $onsubmit = "onsubmit=\"copyrichtext(form.summary);\"";
-    } else {
-        $onsubmit = "";
+    if (!isset($USER)) {
+        $USER->htmleditor = true;
     }
+    $usehtmleditor = can_use_html_editor();
+    $defaultformat = FORMAT_HTML;
+
+    $sesskey = isset($USER) ? $USER->sesskey : '';
 
     print_simple_box_start("center", "", "$THEME->cellheading");
     include("site.html");
     print_simple_box_end();
 
+    if ($usehtmleditor) { 
+        use_html_editor();
+    }
+
     if (!$firsttime) {
         print_footer();
     }
index 1fb3740f91b61549a4bc36e05be35485b645ab0f..028e6080e57eecf032379adb4cfd24e2a91848f5 100644 (file)
@@ -17,7 +17,7 @@
 
     print_heading("");
 
-    if (isset($zone)) {
+    if (isset($zone) and confirm_sesskey()) {
         $db->debug = true;
         echo "<center>";
         execute_sql("UPDATE {$CFG->prefix}user SET timezone = '$zone'");
         }
     }
 
-    echo "<center><form action=\"timezone\".php method=\"get\">";
+    echo '<center><form action="timezone.php" method="get">';
     echo "$strusers ($strall): ";
     choose_from_menu ($timezones, "zone", $user->timezone, get_string("serverlocaltime"), "", "99");
+    echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
     echo "<input type=\"submit\" value=\"$strsavechanges\">";
-    echo "</form>";
+    echo "</form></center>";
 
     print_footer();
 
index 07771ba590008f9375920f9bf280b8f37260e43b..dc7fabdaf1412f32b0b1b18315256da32ece1573 100644 (file)
 
     if (empty($_GET['confirm'])) {
         notice_yesno(get_string("upgradelogsinfo", "admin"), 
-                     "upgradelogs.php?confirm=true", 
+                     "upgradelogs.php?confirm=true&sesskey=$USER->sesskey", 
                      "index.php");
         print_footer();
         exit;
+    } else if (!confirm_sesskey()) {
+        error(get_string('confirmsesskeybad', 'error'));
     }
 
 
index 751634483550b291cc0cdb8627afdecf109ed903..4af033c8bea98fa33fa73f09de284c2803035f7b 100644 (file)
                          "<a href=\"users.php\">$strusers</a> -> $stredituser");
         }
 
-        if ($confirmuser) {
+        if ($confirmuser and confirm_sesskey()) {
             if (!$user = get_record("user", "id", "$confirmuser")) {
                 error("No such user!");
             }
                     $strlastaccess = get_string("never");
                 }
                 if ($user->confirmed == 0) {
-                    $confirmbutton = "<a href=\"user.php?confirmuser=$user->id\">" . get_string("confirm") . "</a>";
+                    $confirmbutton = "<a href=\"user.php?confirmuser=$user->id&sesskey=$USER->sesskey\">" . get_string("confirm") . "</a>";
                 } else {
                     $confirmbutton = "";
                 }