MDL-30651 libraries: Replaced deprecated PARAM_INTEGER with PARAM_INT

This commit is contained in:
Rajesh Taneja 2012-05-11 10:49:51 +08:00
parent 3294034b80
commit 1e12c1203b
23 changed files with 46 additions and 45 deletions

View File

@ -68,7 +68,7 @@
switch ($action) {
case 'setstate':
if ($newstate = optional_param('newstate', '', PARAM_INTEGER)) {
if ($newstate = optional_param('newstate', '', PARAM_INT)) {
filter_set_global_state($filterpath, $newstate);
if ($newstate == TEXTFILTER_DISABLED) {
filter_set_applies_to_strings($filterpath, false);

View File

@ -38,7 +38,7 @@
throw new moodle_exception('invalidaccess');
}
if ($action != 'add') {
$roleid = required_param('roleid', PARAM_INTEGER);
$roleid = required_param('roleid', PARAM_INT);
} else {
$roleid = 0;
}

View File

@ -264,13 +264,13 @@ if ($hassiteconfig) {
'portfolio_moderate_db_threshold',
new lang_string('moderatedbsizethreshold', 'portfolio'),
new lang_string('moderatedbsizethresholddesc', 'portfolio'),
20, PARAM_INTEGER, 3));
20, PARAM_INT, 3));
$temp->add(new admin_setting_configtext(
'portfolio_high_db_threshold',
new lang_string('highdbsizethreshold', 'portfolio'),
new lang_string('highdbsizethresholddesc', 'portfolio'),
50, PARAM_INTEGER, 3));
50, PARAM_INT, 3));
$ADMIN->add('portfoliosettings', $temp);
$ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', new lang_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url);

View File

@ -34,7 +34,7 @@ require_capability('moodle/role:manage', $systemcontext);
// Get URL parameters.
$capability = optional_param('capability', '', PARAM_CAPABILITY);
$roleids = optional_param_array('roles', array('0'), PARAM_INTEGER);
$roleids = optional_param_array('roles', array('0'), PARAM_INT);
// Clean the passed in list of role ids. If 'All' selected as an option, or
// if none were selected, do all roles.

View File

@ -67,8 +67,8 @@ $communitymanager = new block_community_manager();
$renderer = $PAGE->get_renderer('block_community');
/// Check if the page has been called with trust argument
$add = optional_param('add', -1, PARAM_INTEGER);
$confirm = optional_param('confirmed', false, PARAM_INTEGER);
$add = optional_param('add', -1, PARAM_INT);
$confirm = optional_param('confirmed', false, PARAM_INT);
if ($add != -1 and $confirm and confirm_sesskey()) {
$course = new stdClass();
$course->name = optional_param('coursefullname', '', PARAM_TEXT);
@ -93,8 +93,8 @@ if ($usercandownload and $cancelrestore and confirm_sesskey()) {
/// Download
$huburl = optional_param('huburl', false, PARAM_URL);
$download = optional_param('download', -1, PARAM_INTEGER);
$downloadcourseid = optional_param('downloadcourseid', '', PARAM_INTEGER);
$download = optional_param('download', -1, PARAM_INT);
$downloadcourseid = optional_param('downloadcourseid', '', PARAM_INT);
$coursefullname = optional_param('coursefullname', '', PARAM_ALPHANUMEXT);
$backupsize = optional_param('backupsize', 0, PARAM_INT);
if ($usercandownload and $download != -1 and !empty($downloadcourseid) and confirm_sesskey()) {
@ -125,8 +125,8 @@ if ($usercandownload and $download != -1 and !empty($downloadcourseid) and confi
}
/// Remove community
$remove = optional_param('remove', '', PARAM_INTEGER);
$communityid = optional_param('communityid', '', PARAM_INTEGER);
$remove = optional_param('remove', '', PARAM_INT);
$communityid = optional_param('communityid', '', PARAM_INT);
if ($remove != -1 and !empty($communityid) and confirm_sesskey()) {
$communitymanager->block_community_remove_course($communityid, $USER->id);
echo $OUTPUT->header();
@ -152,8 +152,8 @@ $hubselectorform->set_data($fromformdata);
//Retrieve courses by web service
$courses = null;
if (optional_param('executesearch', 0, PARAM_INTEGER) and confirm_sesskey()) {
$downloadable = optional_param('downloadable', false, PARAM_INTEGER);
if (optional_param('executesearch', 0, PARAM_INT) and confirm_sesskey()) {
$downloadable = optional_param('downloadable', false, PARAM_INT);
$options = new stdClass();
if (!empty($fromformdata['coverage'])) {
@ -178,7 +178,7 @@ if (optional_param('executesearch', 0, PARAM_INTEGER) and confirm_sesskey()) {
$options->orderby = $fromformdata['orderby'];
//the range of course requested
$options->givememore = optional_param('givememore', 0, PARAM_INTEGER);
$options->givememore = optional_param('givememore', 0, PARAM_INT);
//check if the selected hub is from the registered list (in this case we use the private token)
$token = 'publichub';

View File

@ -49,7 +49,7 @@ class block_glossary_random_edit_form extends block_edit_form {
$mform->addElement('text', 'config_refresh', get_string('refresh', 'block_glossary_random'), array('size' => 5));
$mform->setDefault('config_refresh', 0);
$mform->setType('config_refresh', PARAM_INTEGER);
$mform->setType('config_refresh', PARAM_INT);
// and select quotetypes to put in dropdown box
$types = array(

View File

@ -54,11 +54,11 @@ class block_quiz_results_edit_form extends block_edit_form {
$mform->addElement('text', 'config_showbest', get_string('config_show_best', 'block_quiz_results'), array('size' => 3));
$mform->setDefault('config_showbest', 3);
$mform->setType('config_showbest', PARAM_INTEGER);
$mform->setType('config_showbest', PARAM_INT);
$mform->addElement('text', 'config_showworst', get_string('config_show_worst', 'block_quiz_results'), array('size' => 3));
$mform->setDefault('config_showworst', 0);
$mform->setType('config_showworst', PARAM_INTEGER);
$mform->setType('config_showworst', PARAM_INT);
$mform->addElement('selectyesno', 'config_usegroups', get_string('config_use_groups', 'block_quiz_results'));

View File

@ -40,7 +40,7 @@ class block_rss_client_edit_form extends block_edit_form {
$mform->setDefault('config_display_description', 0);
$mform->addElement('text', 'config_shownumentries', get_string('shownumentrieslabel', 'block_rss_client'), array('size' => 5));
$mform->setType('config_shownumentries', PARAM_INTEGER);
$mform->setType('config_shownumentries', PARAM_INT);
$mform->addRule('config_shownumentries', null, 'numeric', null, 'client');
if (!empty($CFG->block_rss_client_num_entries)) {
$mform->setDefault('config_shownumentries', $CFG->block_rss_client_num_entries);

View File

@ -147,8 +147,8 @@ class feed_edit_form extends moodleform {
}
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL);
$courseid = optional_param('courseid', 0, PARAM_INTEGER);
$rssid = optional_param('rssid', 0, PARAM_INTEGER); // 0 mean create new.
$courseid = optional_param('courseid', 0, PARAM_INT);
$rssid = optional_param('rssid', 0, PARAM_INT); // 0 mean create new.
if ($courseid == SITEID) {
$courseid = 0;

View File

@ -29,8 +29,8 @@ require_once($CFG->libdir . '/tablelib.php');
require_login();
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL);
$courseid = optional_param('courseid', 0, PARAM_INTEGER);
$deleterssid = optional_param('deleterssid', 0, PARAM_INTEGER);
$courseid = optional_param('courseid', 0, PARAM_INT);
$deleterssid = optional_param('deleterssid', 0, PARAM_INT);
if ($courseid == SITEID) {
$courseid = 0;

View File

@ -32,8 +32,8 @@ if (isguestuser()) {
}
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL);
$courseid = optional_param('courseid', 0, PARAM_INTEGER);
$rssid = required_param('rssid', PARAM_INTEGER);
$courseid = optional_param('courseid', 0, PARAM_INT);
$rssid = required_param('rssid', PARAM_INT);
if ($courseid = SITEID) {
$courseid = 0;

View File

@ -37,7 +37,7 @@ class block_tag_flickr_edit_form extends block_edit_form {
$mform->setType('config_title', PARAM_MULTILANG);
$mform->addElement('text', 'config_numberofphotos', get_string('numberofphotos', 'block_tag_flickr'), array('size' => 5));
$mform->setType('config_numberofvideos', PARAM_INTEGER);
$mform->setType('config_numberofvideos', PARAM_INT);
$mform->addElement('selectyesno', 'config_includerelatedtags', get_string('includerelatedtags', 'block_tag_flickr'));
$mform->setDefault('config_includerelatedtags', 0);

View File

@ -37,7 +37,7 @@ class block_tag_youtube_edit_form extends block_edit_form {
$mform->setType('config_title', PARAM_MULTILANG);
$mform->addElement('text', 'config_numberofvideos', get_string('numberofvideos', 'block_tag_youtube'), array('size' => 5));
$mform->setType('config_numberofvideos', PARAM_INTEGER);
$mform->setType('config_numberofvideos', PARAM_INT);
$categorychoices = $this->block->get_categories();
$mform->addElement('select', 'config_category', get_string('category', 'block_tag_youtube'), $categorychoices);

View File

@ -311,7 +311,7 @@ class core_group_external extends external_api {
foreach ($params['groupids'] as $groupid) {
// validate params
$groupid = validate_param($groupid, PARAM_INTEGER);
$groupid = validate_param($groupid, PARAM_INT);
if (!$group = groups_get_group($groupid, 'id, courseid', IGNORE_MISSING)) {
// silently ignore attempts to delete nonexisting groups
continue;

View File

@ -1108,7 +1108,7 @@ class block_manager {
* @return boolean true if anything was done. False if not.
*/
public function process_url_delete() {
$blockid = optional_param('bui_deleteid', null, PARAM_INTEGER);
$blockid = optional_param('bui_deleteid', null, PARAM_INT);
if (!$blockid) {
return false;
}
@ -1134,9 +1134,9 @@ class block_manager {
* @return boolean true if anything was done. False if not.
*/
public function process_url_show_hide() {
if ($blockid = optional_param('bui_hideid', null, PARAM_INTEGER)) {
if ($blockid = optional_param('bui_hideid', null, PARAM_INT)) {
$newvisibility = 0;
} else if ($blockid = optional_param('bui_showid', null, PARAM_INTEGER)) {
} else if ($blockid = optional_param('bui_showid', null, PARAM_INT)) {
$newvisibility = 1;
} else {
return false;
@ -1169,7 +1169,7 @@ class block_manager {
public function process_url_edit() {
global $CFG, $DB, $PAGE, $OUTPUT;
$blockid = optional_param('bui_editid', null, PARAM_INTEGER);
$blockid = optional_param('bui_editid', null, PARAM_INT);
if (!$blockid) {
return false;
}
@ -1367,7 +1367,7 @@ class block_manager {
public function process_url_move() {
global $CFG, $DB, $PAGE;
$blockid = optional_param('bui_moveid', null, PARAM_INTEGER);
$blockid = optional_param('bui_moveid', null, PARAM_INT);
if (!$blockid) {
return false;
}

View File

@ -254,6 +254,7 @@ define('PARAM_CLEAN', 'clean');
/**
* PARAM_INTEGER - deprecated alias for PARAM_INT
* @deprecated since 2.0
*/
define('PARAM_INTEGER', 'int');

View File

@ -26,9 +26,9 @@ require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
// Look for old-style URLs, such as may be in the logs, and redirect them to startattemtp.php.
if ($id = optional_param('id', 0, PARAM_INTEGER)) {
if ($id = optional_param('id', 0, PARAM_INT)) {
redirect($CFG->wwwroot . '/mod/quiz/startattempt.php?cmid=' . $id . '&sesskey=' . sesskey());
} else if ($qid = optional_param('q', 0, PARAM_INTEGER)) {
} else if ($qid = optional_param('q', 0, PARAM_INT)) {
if (!$cm = get_coursemodule_from_instance('quiz', $qid)) {
print_error('invalidquizid', 'quiz');
}

View File

@ -324,7 +324,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
$questionid = $matches[2];
// Make sure two questions don't overwrite each other. If we get a second
// question with the same position, shift the second one along to the next gap.
$value = clean_param($value, PARAM_INTEGER);
$value = clean_param($value, PARAM_INT);
while (array_key_exists($value, $questions)) {
$value++;
}

View File

@ -183,10 +183,10 @@ $quizsettings->add(new admin_setting_configtext_with_advanced('quiz/subnet',
// Enforced delay between attempts.
$quizsettings->add(new admin_setting_configtext_with_advanced('quiz/delay1',
get_string('delay1st2nd', 'quiz'), get_string('configdelay1st2nd', 'quiz'),
array('value' => 0, 'fix' => true), PARAM_INTEGER));
array('value' => 0, 'fix' => true), PARAM_INT));
$quizsettings->add(new admin_setting_configtext_with_advanced('quiz/delay2',
get_string('delaylater', 'quiz'), get_string('configdelaylater', 'quiz'),
array('value' => 0, 'fix' => true), PARAM_INTEGER));
array('value' => 0, 'fix' => true), PARAM_INT));
// Browser security.
$quizsettings->add(new mod_quiz_admin_setting_browsersecurity('quiz/browsersecurity',

View File

@ -176,7 +176,7 @@ class qtype_match_question extends question_graded_automatically_with_countback
public function get_expected_data() {
$vars = array();
foreach ($this->stemorder as $key => $notused) {
$vars[$this->field($key)] = PARAM_INTEGER;
$vars[$this->field($key)] = PARAM_INT;
}
return $vars;
}

View File

@ -41,7 +41,7 @@ class qtype_truefalse_question extends question_graded_automatically {
public $falseanswerid;
public function get_expected_data() {
return array('answer' => PARAM_INTEGER);
return array('answer' => PARAM_INT);
}
public function get_correct_response() {

View File

@ -61,7 +61,7 @@ class core_user_external extends external_api {
'lang' => new external_value(PARAM_SAFEDIR, 'Language code such as "en", must exist on server', VALUE_DEFAULT, $CFG->lang, NULL_NOT_ALLOWED),
'theme' => new external_value(PARAM_PLUGIN, 'Theme name such as "standard", must exist on server', VALUE_OPTIONAL),
'timezone' => new external_value(PARAM_TIMEZONE, 'Timezone code such as Australia/Perth, or 99 for default', VALUE_OPTIONAL),
'mailformat' => new external_value(PARAM_INTEGER, 'Mail format code is 0 for plain text, 1 for HTML etc', VALUE_OPTIONAL),
'mailformat' => new external_value(PARAM_INT, 'Mail format code is 0 for plain text, 1 for HTML etc', VALUE_OPTIONAL),
'description' => new external_value(PARAM_TEXT, 'User profile description, no HTML', VALUE_OPTIONAL),
'city' => new external_value(PARAM_NOTAGS, 'Home city of the user', VALUE_OPTIONAL),
'country' => new external_value(PARAM_ALPHA, 'Home country code of the user, such as AU or CZ', VALUE_OPTIONAL),
@ -286,7 +286,7 @@ class core_user_external extends external_api {
'lang' => new external_value(PARAM_SAFEDIR, 'Language code such as "en", must exist on server', VALUE_OPTIONAL, '', NULL_NOT_ALLOWED),
'theme' => new external_value(PARAM_PLUGIN, 'Theme name such as "standard", must exist on server', VALUE_OPTIONAL),
'timezone' => new external_value(PARAM_TIMEZONE, 'Timezone code such as Australia/Perth, or 99 for default', VALUE_OPTIONAL),
'mailformat' => new external_value(PARAM_INTEGER, 'Mail format code is 0 for plain text, 1 for HTML etc', VALUE_OPTIONAL),
'mailformat' => new external_value(PARAM_INT, 'Mail format code is 0 for plain text, 1 for HTML etc', VALUE_OPTIONAL),
'description' => new external_value(PARAM_TEXT, 'User profile description, no HTML', VALUE_OPTIONAL),
'city' => new external_value(PARAM_NOTAGS, 'Home city of the user', VALUE_OPTIONAL),
'country' => new external_value(PARAM_ALPHA, 'Home country code of the user, such as AU or CZ', VALUE_OPTIONAL),
@ -471,7 +471,7 @@ class core_user_external extends external_api {
'lang' => new external_value(PARAM_SAFEDIR, 'Language code such as "en", must exist on server', VALUE_OPTIONAL),
'theme' => new external_value(PARAM_PLUGIN, 'Theme name such as "standard", must exist on server', VALUE_OPTIONAL),
'timezone' => new external_value(PARAM_TIMEZONE, 'Timezone code such as Australia/Perth, or 99 for default', VALUE_OPTIONAL),
'mailformat' => new external_value(PARAM_INTEGER, 'Mail format code is 0 for plain text, 1 for HTML etc', VALUE_OPTIONAL),
'mailformat' => new external_value(PARAM_INT, 'Mail format code is 0 for plain text, 1 for HTML etc', VALUE_OPTIONAL),
'description' => new external_value(PARAM_RAW, 'User profile description', VALUE_OPTIONAL),
'descriptionformat' => new external_format_value('description', VALUE_OPTIONAL),
'city' => new external_value(PARAM_NOTAGS, 'Home city of the user', VALUE_OPTIONAL),

View File

@ -149,7 +149,7 @@ abstract class user_selector_base {
/**
* @return array of user objects. The users that were selected. This is a more sophisticated version
* of optional_param($this->name, array(), PARAM_INTEGER) that validates the
* of optional_param($this->name, array(), PARAM_INT) that validates the
* returned list of ids against the rules for this user selector.
*/
public function get_selected_users() {
@ -368,8 +368,8 @@ abstract class user_selector_base {
protected function load_selected_users() {
// See if we got anything.
if ($this->multiselect) {
$userids = optional_param_array($this->name, array(), PARAM_INTEGER);
} else if ($userid = optional_param($this->name, 0, PARAM_INTEGER)) {
$userids = optional_param_array($this->name, array(), PARAM_INT);
} else if ($userid = optional_param($this->name, 0, PARAM_INT)) {
$userids = array($userid);
}
// If there are no users there is nobody to load