changed data_submitted for secureform; added sesskey

This commit is contained in:
toyomoyo
2006-02-21 02:02:24 +00:00
parent bb54c1c756
commit 5af0b52558
5 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -111,7 +111,7 @@
********************************************/
$entrysaved = false; //flag for displaying entry saved msg
if ($datarecord = data_submitted() and confirm_sesskey()) {
if ($datarecord = data_submitted($CFG->wwwroot.'/mod/data/add.php') and confirm_sesskey()) {
//if rid is present, we are in updating mode
if ($rid){
+1 -1
View File
@@ -156,7 +156,7 @@
break;
case 'update': ///update a field
if (confirm_sesskey() and $field = data_submitted()){
if (confirm_sesskey() and $field = data_submitted($CFG->wwwroot.'/mod/data/fields.php')){
$field->id = $fid;
$field->name = optional_param('name','',PARAM_NOTAGS);
+1
View File
@@ -944,6 +944,7 @@ function data_print_ratings($data, $record) {
if ($ratingsmenuused) {
echo '<input type="hidden" name="id" value="'.$course->id.'" />';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo "<input type=\"submit\" value=\"".get_string("sendinratings", "data")."\" />";
}
echo '</div>';
+3 -3
View File
@@ -18,12 +18,12 @@
$returntoview = false;
if ($data = data_submitted()) {
if (($data = data_submitted($CFG->wwwroot.'/mod/data/view.php')) and confirm_sesskey()) {
$lastrecordid = 0;
foreach ((array)$data as $recordid => $rating) {
if ($recordid == "id") {
if (($recordid == 'id') || ($recordid=='sesskey')) {
continue;
}
@@ -41,7 +41,7 @@
$newrating->userid = $USER->id;
$newrating->recordid = $recordid;
$newrating->rating = $rating;
print_object($newrating);
if (! insert_record("data_ratings", $newrating)) {
error("Could not insert a new rating ($recordid = $rating)");
}
+1 -1
View File
@@ -77,7 +77,7 @@
print_heading(format_string($data->name));
///processing submitted data, i.e updating form
if (($mytemplate = data_submitted()) && confirm_sesskey()){
if (($mytemplate = data_submitted($CFG->wwwroot.'/mod/data/templates.php')) && confirm_sesskey()){
//generate default template
if (!empty($mytemplate->defaultform)){