Permalink
Browse files

demos new security features optional_param, acceptGet

  • Loading branch information...
1 parent 924ccd6 commit 7b9cdb60cfa968eff99fa0030428ed23c6d05db4 jamiesensei committed Sep 27, 2006
Showing with 11 additions and 4 deletions.
  1. +11 −4 course/edit2.php
View
@@ -6,10 +6,17 @@
require_once("$CFG->libdir/blocklib.php");
require_once("$CFG->dirroot/enrol/enrol.class.php");
- $id = optional_param('id', 0, PARAM_INT); // course id
- $category = optional_param('category', 0, PARAM_INT); // possible default category
+ include_once $CFG->libdir.'/formslib.php';
require_login();
+
+ $mform =& new moodleform('edit_course', 'post', 'edit2.php');
+
+ $mform->acceptGet('id', 'category');
+
+ $id = $mform->optional_param('id', 0, PARAM_INT); // course id
+ $category = $mform->optional_param('category', 0, PARAM_INT); // possible default category
+
$disable_meta = false;
$focus = "";
@@ -160,13 +167,13 @@
include("edit_form.php");
$mform->setDefaults((array)$default);
- //setconstant overrides data coming from the form as well as default
+/* //setconstant overrides data coming from the form as well as default
//we use this to pass data into the form which we've already processed.
$mform->setConstants(array('id'=>$id,
'category'=>$category));
-
+*/
/// If data submitted, then process and store.

0 comments on commit 7b9cdb6

Please sign in to comment.