From 0d626493f37605695e28aa032830c9e33646bf2b Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 25 Feb 2008 07:17:04 +0000 Subject: [PATCH] Merged MDL-13643 from 1.9 --- lib/moodlelib.php | 20 +++++++++++++++++++- tag/edit.php | 2 +- tag/edit_form.php | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 239680e6ce..caf53402e8 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -566,6 +566,22 @@ function clean_param($param, $type) { $param = $textlib->substr(trim($param), 0, TAG_MAX_LENGTH); return $param; + + case PARAM_TAGLIST: + $tags = explode(',', $param); + $result = array(); + foreach ($tags as $tag) { + $res = clean_param($tag, PARAM_TAG); + if ($res != '') { + $result[] = $res; + } + } + if ($result) { + return implode(',', $result); + } else { + return ''; + } + default: // throw error, switched parameters in optional_param or another serious problem error("Unknown parameter type: $type"); } @@ -3040,7 +3056,9 @@ function authenticate_user_login($username, $password) { // failed if all the plugins have failed add_to_log(0, 'login', 'error', 'index.php', $username); - error_log('[client '.$_SERVER['REMOTE_ADDR']."] $CFG->wwwroot Failed Login: $username ".$_SERVER['HTTP_USER_AGENT']); + if (debugging('', DEBUG_ALL)) { + error_log('[client '.$_SERVER['REMOTE_ADDR']."] $CFG->wwwroot Failed Login: $username ".$_SERVER['HTTP_USER_AGENT']); + } return false; } diff --git a/tag/edit.php b/tag/edit.php index 06de0b80e2..92f1cf6cc3 100644 --- a/tag/edit.php +++ b/tag/edit.php @@ -77,7 +77,7 @@ if ($tagnew = $tagform->get_data()) { //updated related tags tag_set('tag', $tagnew->id, explode(',', trim($tagnew->relatedtags))); - //var_dump($tagnew); die(); + //print_object($tagnew); die(); redirect($CFG->wwwroot.'/tag/index.php?tag='.rawurlencode($tag->name)); // must use $tag here, as the name isn't in the edit form } diff --git a/tag/edit_form.php b/tag/edit_form.php index 43c657fbce..4311b94a7e 100644 --- a/tag/edit_form.php +++ b/tag/edit_form.php @@ -25,7 +25,7 @@ class tag_edit_form extends moodleform { $mform->addElement('html', '
'); $mform->addElement('textarea', 'relatedtags', get_string('relatedtags','tag'), 'cols="50" rows="3"'); - $mform->setType('relatedtags', PARAM_TAG); + $mform->setType('relatedtags', PARAM_TAGLIST); $mform->addElement('html', '
'); $mform->addElement('html', '
'); -- 2.39.5