Bug 66910 - Fix quoting keywords and descriptions

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1677 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2013-06-05 13:00:01 +00:00
parent d9da143acd
commit 7dd47421b7
2 changed files with 11 additions and 10 deletions

View File

@ -76,8 +76,6 @@ use constant ID_FIELD => 'bug_id';
use constant NAME_FIELD => 'alias';
use constant LIST_ORDER => ID_FIELD;
use Data::Dumper;
# This is a sub because it needs to call other subroutines.
sub DB_COLUMNS
{
@ -1738,8 +1736,8 @@ sub _check_keywords {
# CustIS Bug 66910 - Adding new keyword to DB
my %keyword_descriptions;
foreach my $kd (split(/[@]+/, trim($keyword_description_string))) {
my @this_kd = split(/[=]+/, $kd);
foreach my $kd (split(/\@+/, trim($keyword_description_string))) {
my @this_kd = map { url_decode($_) } split /=+/, $kd;
$keyword_descriptions{$this_kd[0]} = $this_kd[1];
}

View File

@ -284,12 +284,12 @@ function check_new_keywords(form)
{
if (input_keywords[i].trim() != "" && exist_keywords.indexOf(input_keywords[i].trim()) == -1)
{
non_exist_keywords[cnt_exist_keywords] = htmlspecialchars(input_keywords[i].trim());
non_exist_keywords[cnt_exist_keywords] = input_keywords[i].trim();
cnt_exist_keywords++;
}
}
if (non_exist_keywords.length > 0)
if (non_exist_keywords.length > 0)
{
var keywords_submit = true;
var kd_container = document.getElementById("keywords_description_container");
@ -298,11 +298,14 @@ function check_new_keywords(form)
for(var i = 0; i < non_exist_keywords.length; i++)
{
var this_value = "";
if (document.getElementById('kd_' + i) != undefined && document.getElementById('kd_' + i).value != "" && document.getElementById('kd_' + i).getAttribute('data-key') == non_exist_keywords[i].trim())
if (document.getElementById('kd_' + i) && document.getElementById('kd_' + i).value != "" &&
document.getElementById('kd_' + i).getAttribute('data-key') == non_exist_keywords[i])
{
this_value = document.getElementById('kd_' + i).value;
}
desc_html += "<br /><label>Description for new item of keywords - <b>" + non_exist_keywords[i].trim() + "</b></label><br /><input type=\"text\" value=\"" + htmlspecialchars(this_value) + "\" class=\"text_input\" name=\"kd\" id=\"kd_" + i + "\" data-key=\"" + htmlspecialchars(non_exist_keywords[i].trim()) + "\" style=\"border: solid 1px red;\" /> <br/>";
desc_html += "<br /><label>Description for new item of keywords - <b>" + htmlspecialchars(non_exist_keywords[i]) +
"</b></label><br /><input type=\"text\" value=\"" + htmlspecialchars(this_value) + "\" class=\"text_input\" name=\"kd\" id=\"kd_" +
i + "\" data-key=\"" + htmlspecialchars(non_exist_keywords[i]) + "\" style=\"border: solid 1px red;\" /> <br/>";
}
kd_container.innerHTML = desc_html;
@ -317,7 +320,7 @@ function check_new_keywords(form)
kd_descriptions_val += "@";
}
var this_key = kd_descriptions[i].getAttribute('data-key');
kd_descriptions_val += this_key + "=" + htmlspecialchars(kd_descriptions[i].value);
kd_descriptions_val += encodeURIComponent(this_key) + "=" + encodeURIComponent(kd_descriptions[i].value);
}
else
{
@ -335,4 +338,4 @@ function check_new_keywords(form)
return keywords_submit;
}
return true;
}
}