MDL-20353 adding missing data types of hidden form fields
authorskodak <skodak>
Sat, 26 Sep 2009 17:07:08 +0000 (17:07 +0000)
committerskodak <skodak>
Sat, 26 Sep 2009 17:07:08 +0000 (17:07 +0000)
50 files changed:
admin/generator.php
course/delete_category_form.php
course/edit_form.php
course/moodleform_mod.php
course/recent_form.php
course/request_form.php
course/reset_form.php
enrol/authorize/enrol_form.php
grade/edit/outcome/import_outcomes_form.php
grade/edit/tree/grade_form.php
grade/export/grade_export_form.php
grade/import/xml/grade_import_form.php
lib/formslib.php
lib/portfolio/forms.php
mod/assignment/mod_form.php
mod/feedback/choose_group_form.php
mod/feedback/delete_completed_form.php
mod/feedback/delete_item_form.php
mod/feedback/delete_template_form.php
mod/feedback/edit_form.php
mod/feedback/edit_item.php
mod/feedback/item/info/info_form.php
mod/feedback/item/label/label_form.php
mod/feedback/mod_form.php
mod/feedback/use_templ_form.php
mod/forum/post_form.php
mod/glossary/edit_form.php
mod/glossary/mod_form.php
mod/hotpot/mod_form.php
mod/page/mod_form.php
mod/quiz/mod_form.php
mod/resource/mod_form.php
mod/scorm/mod_form.php
mod/url/mod_form.php
question/move_form.php
question/type/calculated/datasetitems_form.php
question/type/calculated/edit_calculated_form.php
question/type/calculatedsimple/edit_calculatedsimple_form.php
question/type/calculatedsimple/questiontype.php
question/type/description/edit_description_form.php
question/type/essay/edit_essay_form.php
question/type/randomsamatch/edit_randomsamatch_form.php
repository/lib.php
tag/edit_form.php
user/edit_form.php
user/editadvanced_form.php
user/filters/user_filter_forms.php
user/profile/index_category_form.php
user/profile/index_field_form.php
webservice/lib.php

index b48b760..333848b 100755 (executable)
@@ -1283,6 +1283,7 @@ class generator_form extends moodleform {
 
         $mform =& $this->_form;
         $mform->addElement('hidden', 'do_generation', 1);
+        $mform->setType('do_generation', PARAM_INT);
 
         foreach ($generator->settings as $setting) {
             $type = 'advcheckbox';
index 372773b..9c3fb34 100644 (file)
@@ -110,11 +110,14 @@ class delete_category_form extends moodleform {
             }
         } else {
             $mform->addElement('hidden', 'fulldelete', 1);
+            $mform->setType('fulldelete', PARAM_INT);
             $mform->addElement('static', 'emptymessage', '', get_string('deletecategoryempty'));
         }
 
         $mform->addElement('hidden', 'delete');
+        $mform->setType('delete', PARAM_ALPHANUM);
         $mform->addElement('hidden', 'sure');
+        $mform->setType('sure', PARAM_ALPHANUM);
         $mform->setDefault('sure', md5(serialize($category)));
 
 //--------------------------------------------------------------------------------
index abcd88c..d5ff0e6 100644 (file)
@@ -65,6 +65,7 @@ class course_edit_form extends moodleform {
             $mform->addElement('select', 'category', get_string('category'), $displaylist);
         } else {
             $mform->addElement('hidden', 'category', null);
+            $mform->setType('category', PARAM_INT);
         }
         $mform->setHelpButton('category', array('coursecategory', get_string('category')));
         $mform->setDefault('category', $category->id);
@@ -369,6 +370,7 @@ class course_edit_form extends moodleform {
             $mform->setDefault('enablecompletion', $courseconfig->enablecompletion);
         } else {
             $mform->addElement('hidden', 'enablecompletion');
+            $mform->setType('enablecompletion', PARAM_INT);
             $mform->setDefault('enablecompletion',0);
         }
 
@@ -389,6 +391,7 @@ class course_edit_form extends moodleform {
             $mform->disabledIf('allowedmods', 'restrictmodules', 'eq', 0);
         } else {
             $mform->addElement('hidden', 'restrictmodules', null);
+            $mform->setType('restrictmodules', PARAM_INT);
         }
         if ($CFG->restrictmodulesfor == 'all') {
             $mform->setDefault('allowedmods', explode(',',$CFG->defaultallowedmodules));
index fc476a8..a2dae5d 100644 (file)
@@ -475,6 +475,7 @@ abstract class moodleform_mod extends moodleform {
             $mform->addElement('submit', 'unlockcompletion', get_string('unlockcompletion', 'completion'));
             $mform->registerNoSubmitButton('unlockcompletion');
             $mform->addElement('hidden', 'completionunlocked', 0);
+            $mform->setType('completionunlocked', PARAM_INT);
 
             $mform->addElement('select', 'completion', get_string('completion', 'completion'), 
                 array(COMPLETION_TRACKING_NONE=>get_string('completion_none', 'completion'), 
index c3cf6f4..12723eb 100644 (file)
@@ -122,6 +122,7 @@ class recent_form extends moodleform {
             }
         } else {
             $mform->addElement('hidden','group');
+            $mform->setType('group', PARAM_INT);
             $mform->setConstants(array('group'=>0));
         }
 
@@ -134,6 +135,7 @@ class recent_form extends moodleform {
         $mform->addElement('date_time_selector', 'date', get_string('since'), array('optional'=>true));
 
         $mform->addElement('hidden','id');
+        $mform->setType('id', PARAM_INT);
         $mform->setType('courseid', PARAM_INT);
 
         $this->add_action_buttons(false, get_string('showrecent'));
index d0de92b..d084fff 100644 (file)
@@ -130,6 +130,7 @@ class reject_request_form extends moodleform {
         $mform =& $this->_form;
 
         $mform->addElement('hidden', 'reject', 0);
+        $mform->setType('reject', PARAM_INT);
 
         $mform->addElement('header','coursedetails', get_string('coursereasonforrejecting'));
 
index 8acebf9..10da1c9 100644 (file)
@@ -80,6 +80,7 @@ class course_reset_form extends moodleform {
         }
 
         $mform->addElement('hidden', 'id', $COURSE->id);
+        $mform->setType('id', PARAM_INT);
 
         $buttonarray = array();
         $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('resetcourse'));
index 9aca6ba..e60d5bc 100755 (executable)
@@ -131,9 +131,14 @@ class enrol_authorize_form extends moodleform
             }
             else {
                 $mform->addElement('hidden', 'ccstate', '');
+                $mform->setType('ccstate', PARAM_ALPHANUM);
                 $mform->addElement('hidden', 'ccaddress', $USER->address);
+                $mform->setType('ccaddress', PARAM_ALPHANUM);
                 $mform->addElement('hidden', 'cccity', $USER->city);
+                $mform->setType('cccity', PARAM_ALPHANUM);
                 $mform->addElement('hidden', 'cccountry', $USER->country);
+                $mform->setType('ccountry', PARAM_ALPHA);
+                $mform->setDefault('cccountry', $USER->country);
             }
         }
         elseif (AN_METHOD_ECHECK == $paymentmethod)
index d22c526..92a3766 100644 (file)
@@ -26,7 +26,9 @@ class import_outcomes_form extends moodleform {
         //$this->set_upload_manager(new upload_manager('importfile', false, false, null, false, 0, true, true, false));
 
         $mform->addElement('hidden', 'action', 'upload');
+        $mform->setType('action', PARAM_ACTION);
         $mform->addElement('hidden', 'id', $COURSE->id);
+        $mform->setType('id', PARAM_INT);
 
         $scope = array();
         if (($COURSE->id > 1) && has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM))) {
index ef8c1c6..59c803b 100755 (executable)
@@ -106,7 +106,9 @@ class edit_grade_form extends moodleform {
 
         // hidden params
         $mform->addElement('hidden', 'oldgrade');
+        $mform->setType('oldgrade', PARAM_RAW);
         $mform->addElement('hidden', 'oldfeedback');
+        $mform->setType('oldfeedback', PARAM_RAW);
 
         $mform->addElement('hidden', 'id', 0);
         $mform->setType('id', PARAM_INT);
index f12fca0..7ea178d 100755 (executable)
@@ -128,6 +128,7 @@ class grade_export_form extends moodleform {
         }
 
         $mform->addElement('hidden', 'id', $COURSE->id);
+        $mform->setType('id', PARAM_INT);
         $this->add_action_buttons(false, get_string('submit'));
 
     }
index 26a44a7..52b2e3d 100644 (file)
@@ -28,6 +28,7 @@ class grade_import_form extends moodleform {
         // course id needs to be passed for auth purposes
         $mform->addElement('hidden', 'id', optional_param('id', 0, PARAM_INT));
         $mform->setType('id', PARAM_INT);
+
         $mform->addElement('header', 'general', get_string('importfile', 'grades'));
         $mform->disabledIf('url', 'userfile', 'noteq', '');
 
index 907cb7c..42aa86c 100644 (file)
@@ -149,8 +149,10 @@ abstract class moodleform {
         $this->definition();
 
         $this->_form->addElement('hidden', 'sesskey', null); // automatic sesskey protection
+        $this->_form->setType('sesskey', PARAM_RAW);
         $this->_form->setDefault('sesskey', sesskey());
         $this->_form->addElement('hidden', '_qf__'.$this->_formname, null);   // form submission marker
+        $this->_form->setType('_qf__'.$this->_formname, PARAM_RAW);
         $this->_form->setDefault('_qf__'.$this->_formname, 1);
         $this->_form->_setDefaultRuleMessages();
 
@@ -814,6 +816,7 @@ abstract class moodleform {
         $mform =& $this->_form;
         $mform->registerNoSubmitButton($addfieldsname);
         $mform->addElement('hidden', $repeathiddenname, $repeats);
+        $mform->setType($repeathiddenname, PARAM_INT);
         //value not to be overridden by submitted value
         $mform->setConstants(array($repeathiddenname=>$repeats));
         $namecloned = array();
@@ -912,6 +915,7 @@ abstract class moodleform {
         }
 
         $mform->addElement('hidden', "checkbox_controller$groupid");
+        $mform->setType("checkbox_controller$groupid", PARAM_INT);
         $mform->setConstants(array("checkbox_controller$groupid" => $new_select_value));
 
         // Locate all checkboxes for this group and set their value, IF the optional param was given
@@ -1113,6 +1117,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
             $this->registerNoSubmitButton('mform_showadvanced');
 
             $this->addElement('hidden', 'mform_showadvanced_last');
+            $this->setType('mform_showadvanced_last', PARAM_INT);
         }
     }
     /**
index ab96329..0892d2c 100644 (file)
@@ -45,7 +45,9 @@ final class portfolio_export_form extends moodleform {
 
         $mform =& $this->_form;
         $mform->addElement('hidden', 'stage', PORTFOLIO_STAGE_CONFIG);
+        $mform->setType('stage', PARAM_INT);
         $mform->addElement('hidden', 'instance', $this->_customdata['instance']->get('id'));
+        $mform->setType('instance', PARAM_INT);
 
         if (array_key_exists('formats', $this->_customdata) && is_array($this->_customdata['formats'])) {
             if (count($this->_customdata['formats']) > 1) {
@@ -57,6 +59,7 @@ final class portfolio_export_form extends moodleform {
             } else {
                 $f = array_shift($this->_customdata['formats']);
                 $mform->addElement('hidden', 'format', $f);
+                $mform->setType('format', PARAM_RAW);
             }
         }
 
@@ -75,6 +78,7 @@ final class portfolio_export_form extends moodleform {
             } else {
                 $mform->addElement('hidden', 'wait', 0);
             }
+            $mform->setType('wait', PARAM_INT);
         }
 
         if (array_key_exists('plugin', $this->_customdata) && is_object($this->_customdata['plugin'])) {
@@ -131,8 +135,11 @@ final class portfolio_admin_form extends moodleform {
         $strrequired = get_string('required');
 
         $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->get('id') : 0);
+        $mform->setType('edit', PARAM_INT);
         $mform->addElement('hidden', 'new',   $this->plugin);
+        $mform->setType('new', PARAM_INT);
         $mform->addElement('hidden', 'plugin', $this->plugin);
+        $mform->setType('plugin', PARAM_SAFEDIR);
 
         if (!$this->instance) {
             $insane = portfolio_instance_sanity_check($this->instance);
@@ -213,6 +220,7 @@ final class portfolio_user_form extends moodleform {
         $this->userid = $this->_customdata['userid'];
 
         $this->_form->addElement('hidden', 'config', $this->instance->get('id'));
+        $mform->setType('config', PARAM_INT);
 
         $this->instance->user_config_form($this->_form, $this->userid);
 
index 8ed8b2d..6aca75c 100644 (file)
@@ -18,8 +18,10 @@ class mod_assignment_mod_form extends moodleform_mod {
             $type = required_param('type', PARAM_ALPHA);
         }
         $mform->addElement('hidden', 'assignmenttype', $type);
+        $mform->setType('assignmenttype', PARAM_ALPHA);
         $mform->setDefault('assignmenttype', $type);
         $mform->addElement('hidden', 'type', $type);
+        $mform->setType('type', PARAM_ALPHA);
         $mform->setDefault('type', $type);
 
         require($CFG->dirroot.'/mod/assignment/type/'.$type.'/assignment.class.php');
index c4a6482..1d2c082 100644 (file)
@@ -41,7 +41,9 @@ class feedback_choose_group_form extends moodleform {
         // $mform->addElement('header', 'general', get_string('choose_group', 'feedback'));
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'do_show');
+        $mform->setType('do-show', PARAM_INT);
         
         // visible elements
         $groups_options = array();
index c79397e..38bf527 100644 (file)
@@ -19,9 +19,13 @@ class mod_feedback_delete_completed_form extends moodleform {
         
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'completedid');
+        $mform->setType('completeid', PARAM_INT);
         $mform->addElement('hidden', 'do_show');
+        $mform->setType('do_show', PARAM_INT);
         $mform->addElement('hidden', 'confirmdelete');
+        $mform->setType('confirmdelete', PARAM_INT);
 
         //-------------------------------------------------------------------------------
         // buttons
index b4eaab5..7d48508 100644 (file)
@@ -19,8 +19,11 @@ class mod_feedback_delete_item_form extends moodleform {
         
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'deleteitem');
+        $mform->setType('deleteitem', PARAM_INT);
         $mform->addElement('hidden', 'confirmdelete');
+        $mform->setType('confirmdelete', PARAM_INT);
 
         //-------------------------------------------------------------------------------
         // buttons
index f37fe84..75e85a1 100644 (file)
@@ -19,8 +19,11 @@ class mod_feedback_delete_template_form extends moodleform {
         
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'deletetempl');
+        $mform->setType('deletetempl', PARAM_INT);
         $mform->addElement('hidden', 'confirmdelete');
+        $mform->setType('confirmdelete', PARAM_INT);
 
         //-------------------------------------------------------------------------------
         // buttons
index 1521534..8f740d5 100644 (file)
@@ -30,7 +30,9 @@ class feedback_edit_add_question_form extends moodleform {
 
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'position');
+        $mform->setType('position', PARAM_INT);
 //-------------------------------------------------------------------------------
         // buttons
         $mform->addElement('submit', 'add_item', get_string('add_item', 'feedback'));
@@ -68,6 +70,7 @@ class feedback_edit_use_template_form extends moodleform {
         $mform->addElement('header', '', get_string('using_templates', 'feedback'));
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         
         // visible elements
         $templates_options = array();
@@ -113,8 +116,11 @@ class feedback_edit_create_template_form extends moodleform {
 
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'do_show');
+        $mform->setType('do_show', PARAM_INT);
         $mform->addElement('hidden', 'savetemplate', 1);
+        $mform->setType('savetemplate', PARAM_INT);
 
         //headline
         $mform->addElement('header', '', get_string('creating_templates', 'feedback'));
index 243ea48..a4e8a43 100644 (file)
@@ -157,9 +157,13 @@ $item_form = &$itemobj->show_edit($item);
 $i_form = &$item_form->get_item_form();
 // $i_form->addElement('header', 'general', 'Titel');
 $i_form->addElement('hidden', 'id', $id);
+$mform->setType('id', PARAM_INT);
 $i_form->addElement('hidden', 'itemid', isset($item->id)?$item->id:'');
+$mform->setType('itemid', PARAM_INT);
 $i_form->addElement('hidden', 'typ', $typ);
+$mform->setType('typ', PARAM_ALPHA);
 $i_form->addElement('hidden', 'feedbackid', $feedback->id);
+$mform->setType('feedbackid', PARAM_INT);
 
 
 $lastposition = $DB->count_records('feedback_item', array('feedback'=>$feedback->id));
@@ -179,10 +183,12 @@ $i_formselect->setValue($i_formselect_value);
 $buttonarray = array();
 if(!empty($item->id)){
     $i_form->addElement('hidden', 'updateitem', '1');
+    $mform->setType('updateitem', PARAM_INT);
     // $i_form->addElement('submit', 'update_item', get_string('update_item', 'feedback'));
     $buttonarray[] = &$i_form->createElement('submit', 'update_item', get_string('update_item', 'feedback'));
 }else{
     $i_form->addElement('hidden', 'saveitem', '1');
+    $mform->setType('saveitem', PARAM_INT);
     // $i_form->addElement('submit', 'save_item', get_string('save_item', 'feedback'));
     $buttonarray[] = &$i_form->createElement('submit', 'save_item', get_string('save_item', 'feedback'));
 }
index d792d4f..a7ead8c 100644 (file)
@@ -14,6 +14,7 @@ class feedback_info_form extends feedback_item_form {
         
         $mform->addElement('header', 'general', get_string($this->type, 'feedback'));
         $this->requiredcheck = &$mform->addElement('hidden', 'required');
+        $mform->setType('required', PARAM_INT);
         
         $this->itemname = &$mform->addElement('text', 'itemname', get_string('item_name', 'feedback'), array('size="'.FEEDBACK_ITEM_NAME_TEXTBOX_SIZE.'"','maxlength="255"'));
         $this->itemlabel = $mform->addElement('text', 'itemlabel', get_string('item_label', 'feedback'), array('size="'.FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE.'"','maxlength="255"'));
index b79d5d7..0719c98 100644 (file)
@@ -12,6 +12,7 @@ class feedback_label_form extends feedback_item_form {
         $mform->addElement('header', 'general', get_string($this->type, 'feedback'));
         
         $mform->addElement('hidden', 'itemname', $this->type);
+        $mform->setType('itemname', PARAM_INT);
         $this->area = $mform->addElement('htmleditor', 'presentation', '', array('rows'=>20));
     }
 }
index d40e082..1eedc58 100644 (file)
@@ -66,6 +66,7 @@ class mod_feedback_mod_form extends moodleform_mod {
             $multiple_submit_value = $feedback->multiple_submit ? get_string('yes') : get_string('no');
             $mform->addElement('text', 'multiple_submit_static', get_string('multiple_submit', 'feedback'), array('size'=>'4','disabled'=>'disabled', 'value'=>$multiple_submit_value));
             $mform->addElement('hidden', 'multiple_submit', '');
+            $mform->setType('', PARAM_INT);
             $mform->setHelpButton('multiple_submit_static', array('multiplesubmit', get_string('multiple_submit', 'feedback'), 'feedback'));
         }else {
             $mform->addElement('selectyesno', 'multiple_submit', get_string('multiple_submit', 'feedback'));
index 81a83a4..dca0b9c 100644 (file)
@@ -24,9 +24,13 @@ class mod_feedback_use_templ_form extends moodleform {
 
         // hidden elements
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'templateid');
+        $mform->setType('templateid', PARAM_INT);
         $mform->addElement('hidden', 'do_show');
+        $mform->setType('do_show', PARAM_INT);
         $mform->addElement('hidden', 'confirmadd');
+        $mform->setType('confirmadd', PARAM_INT);
 
         //-------------------------------------------------------------------------------
         // buttons
index 227b820..e77b143 100644 (file)
@@ -34,6 +34,7 @@ class mod_forum_post_form extends moodleform {
 
             $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('everyoneissubscribed', 'forum'));
             $mform->addElement('hidden', 'subscribe');
+            $mform->setType('subscribe', PARAM_INT);
             $mform->setHelpButton('subscribemessage', array('subscription', get_string('subscription', 'forum'), 'forum'));
 
         } else if (isset($forum->forcesubscribe)&& $forum->forcesubscribe != FORUM_DISALLOWSUBSCRIBE ||
@@ -48,6 +49,7 @@ class mod_forum_post_form extends moodleform {
         } else if ($forum->forcesubscribe == FORUM_DISALLOWSUBSCRIBE) {
             $mform->addElement('static', 'subscribemessage', get_string('subscription', 'forum'), get_string('disallowsubscribe', 'forum'));
             $mform->addElement('hidden', 'subscribe');
+            $mform->setType('subscribe', PARAM_INT);
             $mform->setHelpButton('subscribemessage', array('subscription', get_string('subscription', 'forum'), 'forum'));
         }
 
index d0767f7..f301c8c 100644 (file)
@@ -41,8 +41,11 @@ class mod_glossary_entry_form extends moodleform {
 
         if (!$glossary->usedynalink) {
             $mform->addElement('hidden', 'usedynalink',   $CFG->glossary_linkentries);
+            $mform->setType('usedynalink', PARAM_INT);
             $mform->addElement('hidden', 'casesensitive', $CFG->glossary_casesensitive);
+            $mform->setType('casesensitive', PARAM_INT);
             $mform->addElement('hidden', 'fullmatch',     $CFG->glossary_fullmatch);
+            $mform->setType('fullmatch', PARAM_INT);
 
         } else {
 //-------------------------------------------------------------------------------
@@ -64,7 +67,9 @@ class mod_glossary_entry_form extends moodleform {
         }
 
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'cmid');
+        $mform->setType('cmid', PARAM_INT);
 
 //-------------------------------------------------------------------------------
         $this->add_action_buttons();
index da243a6..ee265f2 100644 (file)
@@ -32,6 +32,7 @@ class mod_glossary_mod_form extends moodleform_mod {
 
         }else{
             $mform->addElement('hidden', 'globalglossary');
+            $mform->setType('globalglossary', PARAM_INT);
         }
 
         $options = array(1=>get_string('mainglossary', 'glossary'), 0=>get_string('secondaryglossary', 'glossary'));
index de15a80..ce62d01 100644 (file)
@@ -55,6 +55,7 @@ class mod_hotpot_mod_form extends moodleform_mod {
         } else {
             // existing HotPot
             $mform->addElement('hidden', 'namesource', HOTPOT_TEXTSOURCE_SPECIFIC);
+            $mform->setType('namesource', PARAM_RAW);
             $mform->addElement('text', 'name', get_string('name'), array('size' => '40'));
         }
         $mform->setType('namesource', PARAM_INT);
@@ -81,6 +82,7 @@ class mod_hotpot_mod_form extends moodleform_mod {
         }
         if (array_key_exists($location, $HOTPOT_LOCATION)) {
             $mform->addElement('hidden', 'location', $location);
+            $mform->setType('location', PARAM_RAW);
         } else { // admin can select from "site" or "course" files
            $mform->addElement('select', 'location', get_string('location', 'hotpot'), $HOTPOT_LOCATION);
         }
@@ -120,6 +122,7 @@ class mod_hotpot_mod_form extends moodleform_mod {
         } else {
             // existing HotPot
             $mform->addElement('hidden', 'summarysource', HOTPOT_TEXTSOURCE_SPECIFIC);
+            $mform->setType('summarysource', PARAM_RAW);
             $mform->addElement('htmleditor', 'summary', get_string('summary'));
             $mform->setType('summary', PARAM_RAW);
             $mform->setHelpButton('summary', array('writing', 'questions', 'richtext2'), false, 'editorhelpbutton');
index b7dd2b3..1e816e7 100644 (file)
@@ -60,6 +60,7 @@ class mod_page_mod_form extends moodleform_mod {
         }
         if (count($options) == 1) {
             $mform->addElement('hidden', 'display');
+            $mform->setType('display', PARAM_INT);
             reset($options);
             $mform->setDefault('display', key($options));
         } else {
index 9920634..8468b05 100644 (file)
@@ -271,6 +271,7 @@ class mod_quiz_mod_form extends moodleform_mod {
         $mform->setHelpButton('overallfeedbackhdr', array('overallfeedback', get_string('overallfeedback', 'quiz'), 'quiz'));
 
         $mform->addElement('hidden', 'grade', $quizconfig->maximumgrade);
+        $mform->setType('grade', PARAM_RAW);
         if (empty($this->_cm)) {
             $needwarning = $quizconfig->maximumgrade == 0;
         } else {
index 4976370..0589df5 100644 (file)
@@ -60,7 +60,8 @@ class mod_resource_mod_form extends moodleform_mod {
 
         $options = array('mainfile'=>$mainfile, 'subdirs'=>0, 'maxbytes'=>0, 'maxfiles'=>-1, 'filetypes'=>'*', 'returnvalue'=>'ref_id');
 
-        $mform->addElement('hidden', $mainfile, '', array('id'=>$mainfile.'-id'));
+        $mform->addElement('hidden', $mainfile, '', array('id'=>$mainfile.'-id')); // TODO: what is this?
+        $mform->setType('mainfile', PARAM_PATH);
         $mform->addElement('filemanager', 'files', get_string('selectfiles'), null, $options);
         $mform->addElement('static', '', get_string('selectedfile'), '<div id="'.$mainfile.'-label"></div>');
 
@@ -75,6 +76,7 @@ class mod_resource_mod_form extends moodleform_mod {
 
         if (count($options) == 1) {
             $mform->addElement('hidden', 'display');
+            $mform->setType('display', PARAM_INT);
             reset($options);
             $mform->setDefault('display', key($options));
         } else {
index 243c532..108a78c 100644 (file)
@@ -221,10 +221,15 @@ class mod_scorm_mod_form extends moodleform_mod {
 //-------------------------------------------------------------------------------
 // Hidden Settings
         $mform->addElement('hidden', 'datadir', null);
+        $mform->setType('datadir', PARAM_RAW);
         $mform->addElement('hidden', 'pkgtype', null);
+        $mform->setType('pkgtype', PARAM_RAW);
         $mform->addElement('hidden', 'launch', null);
+        $mform->setType('launch', PARAM_RAW);
         $mform->addElement('hidden', 'redirect', null);
+        $mform->setType('redirect', PARAM_RAW);
         $mform->addElement('hidden', 'redirecturl', null);
+        $mform->setType('redirecturl', PARAM_RAW);
 
 
 //-------------------------------------------------------------------------------
index b5fe332..489a385 100644 (file)
@@ -59,6 +59,7 @@ class mod_url_mod_form extends moodleform_mod {
         }
         if (count($options) == 1) {
             $mform->addElement('hidden', 'display');
+            $mform->setType('display', PARAM_INT);
             reset($options);
             $mform->setDefault('display', key($options));
         } else {
index 72fdc3e..f779342 100644 (file)
@@ -18,6 +18,7 @@ class question_move_form extends moodleform {
         $this->add_action_buttons(true, get_string('categorymoveto', 'quiz'));
 //--------------------------------------------------------------------------------
         $mform->addElement('hidden', 'delete', $currentcat);
+        $mform->setType('delete', PARAM_INT);
     }
 }
 ?>
index 47a0a6b..575650f 100644 (file)
@@ -86,8 +86,11 @@ class question_dataset_dependent_items_form extends moodleform {
             $this->qtypeobj->custom_generator_tools_part($mform, $idx, $j);
             $idx++;
             $mform->addElement('hidden', "definition[$j]");
+            $mform->setType("definition[$j]", PARAM_RAW);
             $mform->addElement('hidden', "itemid[$j]");
+            $mform->setType("itemid[$j]", PARAM_RAW);
             $mform->addElement('static', "divider[$j]", '', '<hr />');
+            $mform->setType("divider[$j]", PARAM_RAW);
             $j++;
         }
         $mform->addElement('header', 'updateanswershdr', get_string('answerstoleranceparam', 'qtype_datasetdependent'));
@@ -102,12 +105,16 @@ class question_dataset_dependent_items_form extends moodleform {
             }else if ('*' === $answer->answer){
                 $mform->addElement('static', 'answercomment['.($this->noofitems+$key1).']', $answer->answer);
                 $mform->addElement('hidden', 'tolerance['.$key.']', '');
+                $mform->setType('tolerance['.$key.']', PARAM_RAW);
                 $mform->setAdvanced('tolerance['.$key.']',true);
                 $mform->addElement('hidden', 'tolerancetype['.$key.']', '');
+                $mform->setType('tolerancetype['.$key.']', PARAM_RAW);
                 $mform->setAdvanced('tolerancetype['.$key.']',true);
                 $mform->addElement('hidden', 'correctanswerlength['.$key.']', '');
+                $mform->setType('correctanswerlength['.$key.']', PARAM_RAW);
                 $mform->setAdvanced('correctanswerlength['.$key.']',true);
                 $mform->addElement('hidden', 'correctanswerformat['.$key.']', '');
+                $mform->setType('correctanswerformat['.$key.']', PARAM_RAW);
                 $mform->setAdvanced('correctanswerformat['.$key.']',true);
             }else {
                 $mform->addElement('static', 'answercomment['.($this->noofitems+$key1).']', $answer->answer);
index 09e6b0e..8286f41 100644 (file)
@@ -95,6 +95,7 @@ class question_edit_calculated_form extends question_edit_form {
       //  echo "<p>question ".optional_param('multichoice', '', PARAM_RAW)." optional<pre>";print_r($this->question);echo "</pre></p>";
         $label = get_string("sharedwildcards", "qtype_datasetdependent");
         $mform->addElement('hidden', 'initialcategory', 1);
+        $mform->setType('initialcategory', PARAM_INT);
         $html2 = $this->qtypeobj->print_dataset_definitions_category($this->question);
         $mform->insertElementBefore($mform->createElement('static','listcategory',$label,$html2),'name');
         $addfieldsname='updatecategory';
@@ -139,6 +140,7 @@ class question_edit_calculated_form extends question_edit_form {
             $mform->addGroup($addgrp1, 'addgrp1', '', '   ', false);
         }else {
             $mform->addElement('hidden', 'multichoice',$this->editasmultichoice);
+            $mform->setType('multichoice', PARAM_INT);
         }
 
         if ($this->editasmultichoice == 1){
@@ -161,8 +163,12 @@ class question_edit_calculated_form extends question_edit_form {
         }else { //editing as regular
             $mform->addElement('header', 'choicehdr', get_string('regularcalculatedquestion', 'qtype_calculated'));
             $mform->addElement('hidden','single', '1');
+            $mform->setType('single', PARAM_INT);
+            
             $mform->addElement('hidden','shuffleanswers', '1');
-            $mform->addElement('hidden','answernumbering', 'abc');            
+            $mform->setType('shuffleanswers', PARAM_INT);
+            $mform->addElement('hidden','answernumbering', 'abc');
+            $mform->setType('answernumbering', PARAM_SAFEDIR);
         }
 
         $creategrades = get_grade_options();
@@ -179,10 +185,13 @@ class question_edit_calculated_form extends question_edit_form {
         if ($this->editasmultichoice == 1){
             $nounits = optional_param('nounits', 1, PARAM_INT);
             $mform->addElement('hidden', 'nounits', $nounits);
+            $mform->setType('nounits', PARAM_INT);
             $mform->setConstants(array('nounits'=>$nounits));
             for ($i=0; $i< $nounits; $i++) {
-                $mform->addElement('hidden','unit'."[$i]", optional_param('unit'."[$i]", '', PARAM_NOTAGS));  
-                $mform->addElement('hidden', 'multiplier'."[$i]", optional_param('multiplier'."[$i]", '', PARAM_NUMBER)); 
+                $mform->addElement('hidden','unit'."[$i]", optional_param('unit'."[$i]", '', PARAM_NOTAGS));
+                $mform->setType('unit'."[$i]", PARAM_NOTAGS); 
+                $mform->addElement('hidden', 'multiplier'."[$i]", optional_param('multiplier'."[$i]", '', PARAM_NUMBER));
+                $mform->setType('multiplier'."[$i]", PARAM_NUMBER);
             }  
 
         }else {
@@ -230,6 +239,7 @@ class question_edit_calculated_form extends question_edit_form {
         }
         //hidden elements
         $mform->addElement('hidden', 'synchronize', '');
+        $mform->setType('synchronize', PARAM_INT);
         if (isset($this->question->options)&& isset($this->question->options->synchronize) ){
             $mform->setDefault("synchronize", $this->question->options->synchronize);
         } else {
index 33e75d7..2ce3349 100644 (file)
@@ -284,7 +284,9 @@ class question_edit_calculatedsimple_form extends question_edit_form {
         $strquestionlabel = $this->qtypeobj->comment_header($this->nonemptyanswer);
         $label = get_string("sharedwildcards", "qtype_datasetdependent");
         $mform->addElement('hidden', 'initialcategory', 1);
+        $mform->setType('initialcategory', PARAM_INT);
         $mform->addElement('hidden', 'reload', 1);
+        $mform->setType('reload', PARAM_INT);
         $addfieldsname='updatequestion value';
         $addstring=get_string("updatecategory", "qtype_calculated");
         $mform->registerNoSubmitButton($addfieldsname);
index ae001db..787dba5 100644 (file)
@@ -237,6 +237,7 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
 
         $distriboptions = array('uniform' => get_string('uniform', 'qtype_datasetdependent'), 'loguniform' => get_string('loguniform', 'qtype_datasetdependent'));
         $mform->addElement('hidden', "calcdistribution[$idx]", 'uniform');
+        $mform->setType("calcdistribution[$idx]", PARAM_INT);
 
 
     }
index 6771eb5..184ff5c 100644 (file)
@@ -24,6 +24,7 @@ class question_edit_description_form extends question_edit_form {
         $mform->removeElement('penalty');
 
         $mform->addElement('hidden', 'defaultgrade', 0);
+        $mform->setType('defaultgrade', PARAM_RAW);
     }
 
     function qtype() {
index b207c2e..9efd100 100644 (file)
@@ -24,10 +24,12 @@ class question_edit_essay_form extends question_edit_form {
         $mform->setType('feedback', PARAM_RAW);
 
         $mform->addElement('hidden', 'fraction', 0);
+        $mform->setType('fraction', PARAM_RAW);
 
         //don't need this default element.
         $mform->removeElement('penalty');
         $mform->addElement('hidden', 'penalty', 0);
+        $mform->setType('penalty', PARAM_RAW);
     }
 
     function set_data($question) {
index 7e6ee47..f6adcd7 100644 (file)
@@ -30,6 +30,7 @@ class question_edit_randomsamatch_form extends question_edit_form {
         $mform->setType('feedback', PARAM_RAW);
 
         $mform->addElement('hidden', 'fraction', 0);
+        $mform->setType('fraction', PARAM_RAW);
     }
 
     function set_data($question) {
index 083bb40..89b823a 100644 (file)
@@ -1592,10 +1592,15 @@ final class repository_instance_form extends moodleform {
         $strrequired = get_string('required');
 
         $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->id : 0);
+        $mform->setType('edit', PARAM_INT);
         $mform->addElement('hidden', 'new',   $this->plugin);
+        $mform->setType('new', PARAM_FORMAT);
         $mform->addElement('hidden', 'plugin', $this->plugin);
+        $mform->setType('plugin', PARAM_SAFEDIR);
         $mform->addElement('hidden', 'typeid', $this->typeid);
+        $mform->setType('typeid', PARAM_INT);
         $mform->addElement('hidden', 'contextid', $this->contextid);
+        $mform->setType('contextid', PARAM_INT);
 
         $mform->addElement('text', 'name', get_string('name'), 'maxlength="100" size="30"');
         $mform->addRule('name', $strrequired, 'required', null, 'client');
@@ -1668,8 +1673,11 @@ final class repository_type_form extends moodleform {
         $strrequired = get_string('required');
 
         $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->get_typename() : 0);
+        $mform->setType('edit', PARAM_INT);
         $mform->addElement('hidden', 'new',   $this->plugin);
+        $mform->setType('new', PARAM_FORMAT);
         $mform->addElement('hidden', 'plugin', $this->plugin);
+        $mform->setType('plugin', PARAM_SAFEDIR);
 
         // let the plugin add its specific fields
         if (!$this->instance) {
index fbfdf06..5aaec36 100644 (file)
@@ -11,6 +11,7 @@ class tag_edit_form extends moodleform {
         $mform->addElement('header', 'tag', get_string('description','tag'));
 
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
 
         $systemcontext   = get_context_instance(CONTEXT_SYSTEM);
 
index 4326c30..5e9d9c3 100644 (file)
@@ -15,7 +15,9 @@ class user_edit_form extends moodleform {
 
         /// Add some extra hidden fields
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'course', $COURSE->id);
+        $mform->setType('course', PARAM_INT);
 
         /// Print the required moodle fields first
         $mform->addElement('header', 'moodle', $strgeneral);
index 0a82c74..69e3954 100644 (file)
@@ -15,7 +15,9 @@ class user_editadvanced_form extends moodleform {
 
         /// Add some extra hidden fields
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'course', $COURSE->id);
+        $mform->setType('course', PARAM_INT);
 
         /// Print the required moodle fields first
         $mform->addElement('header', 'moodle', $strgeneral);
index d1bbccd..9cd5079 100644 (file)
@@ -19,6 +19,7 @@ class user_add_filter_form extends moodleform {
         if ($extraparams) {
             foreach ($extraparams as $key=>$value) {
                 $mform->addElement('hidden', $key, $value);
+                $mform->setType($key, PARAM_RAW);
             }
         }
 
@@ -57,6 +58,7 @@ class user_active_filter_form extends moodleform {
             if ($extraparams) {
                 foreach ($extraparams as $key=>$value) {
                     $mform->addElement('hidden', $key, $value);
+                    $mform->setType($key, PARAM_RAW);
                 }
             }
 
index 44af21c..4424892 100644 (file)
@@ -14,7 +14,9 @@ class category_form extends moodleform {
 
         /// Add some extra hidden fields
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'action', 'editcategory');
+        $mform->setType('iction', PARAM_ACTION);
 
         $mform->addElement('text', 'name', get_string('profilecategoryname', 'admin'), 'maxlength="255" size="30"');
         $mform->setType('name', PARAM_MULTILANG);
index 781c7af..e61848a 100644 (file)
@@ -22,8 +22,11 @@ class field_form extends moodleform {
 
         /// Add some extra hidden fields
         $mform->addElement('hidden', 'id');
+        $mform->setType('id', PARAM_INT);
         $mform->addElement('hidden', 'action', 'editfield');
+        $mform->setType('action', PARAM_ACTION);
         $mform->addElement('hidden', 'datatype', $datatype);
+        $mform->setType('datatype', PARAM_ALPHA);
 
         $this->field->define_form($mform);
 
index b5ed730..0c40069 100644 (file)
@@ -415,6 +415,7 @@ final class wsuser_form extends moodleform {
         $mform =& $this->_form;
 
         $mform->addElement('hidden', 'username', $this->username);
+        $mform->setType('username', PARAM_RAW);
         $param = new stdClass();
         $param->username = $this->username;
         $wsuser = $DB->get_record("user", array("username" => $this->username));
@@ -441,6 +442,7 @@ final class wssettings_form extends moodleform {
         $mform =& $this->_form;
 
         $mform->addElement('hidden', 'settings', $settings);
+        $mform->setType('settings', PARAM_RAW);
         $param = new stdClass();
 
         require_once($CFG->dirroot . '/webservice/'. $settings . '/lib.php');
@@ -476,6 +478,7 @@ final class wsservicesettings_form extends moodleform {
         $mform =& $this->_form;
 
         $mform->addElement('hidden', 'serviceid', $serviceid);
+        $mform->setType('serviceid', PARAM_INT);
         $param = new stdClass();
 
      //   require_once($CFG->dirroot . '/webservice/'. $settings . '/lib.php');