@@ -12,11 +12,11 @@ def rast_output(s)
12
12
title_str = @key . empty? ? @conf . msg_search : @conf . msg_search_result
13
13
str = <<-EOS
14
14
<form class="update" action="./">
15
- <h2>#{ @conf . site_name . escapeHTML } - #{ title_str . escapeHTML } </h2>
16
- <p>#{ @conf . msg_search_comment . escapeHTML } </p>
17
- <p><input type="text" name="key" size="20" value="#{ @key . escapeHTML } ">
15
+ <h2>#{ h ( @conf . site_name ) } - #{ h ( title_str ) } </h2>
16
+ <p>#{ h ( @conf . msg_search_comment ) } </p>
17
+ <p><input type="text" name="key" size="20" value="#{ h ( @key ) } ">
18
18
<input type="hidden" name="c" value="search">
19
- <input type="submit" name="search" value="#{ @conf . msg_search . escapeHTML } "></p>
19
+ <input type="submit" name="search" value="#{ h ( @conf . msg_search ) } "></p>
20
20
</form>
21
21
EOS
22
22
parser = @conf . parser ::new ( @conf )
@@ -47,13 +47,13 @@ def search
47
47
options = create_search_options
48
48
@result = db . search ( @key , options )
49
49
if @result . hit_count ==0
50
- rast_output ( "<p>#{ ( @conf . msg_search_not_found % @key ) . escapeHTML } </p>" )
50
+ rast_output ( "<p>#{ h ( @conf . msg_search_not_found % @key ) } </p>" )
51
51
else
52
52
rast_output ( format_result )
53
53
end
54
54
end
55
55
rescue
56
- rast_output ( "<p>Error : #{ $!. message . escapeHTML } </p>" )
56
+ rast_output ( "<p>Error : #{ h ( $!. message ) } </p>" )
57
57
ensure
58
58
rast_db_list . each do |db |
59
59
db . close if db
@@ -63,18 +63,18 @@ def search
63
63
end
64
64
65
65
def format_result
66
- head = "<p>#{ ( @conf . msg_search_hits % [ @key , @db . page_info . size , @result . hit_count ] ) . escapeHTML } (#{ @start + 1 } - #{ @start + @result . items . size } )</p>\n "
66
+ head = "<p>#{ h ( @conf . msg_search_hits % [ @key , @db . page_info . size , @result . hit_count ] ) } (#{ @start + 1 } - #{ @start + @result . items . size } )</p>\n "
67
67
ret = %Q(<dl class="search">\n )
68
68
@result . items . each do |item |
69
69
uri , title , last_modified = *item . properties
70
70
title = uri if title . empty?
71
- summary = item . summary . escapeHTML || ''
71
+ summary = h ( item . summary ) || ''
72
72
for term in @result . terms
73
- summary . gsub! ( Regexp . new ( Regexp . quote ( term . term . escapeHTML ) , true , "e" ) ,
73
+ summary . gsub! ( Regexp . new ( Regexp . quote ( h ( term . term ) ) , true , "e" ) ,
74
74
"<strong>\\ &</strong>" )
75
75
end
76
- ret << %Q|<dt><a href="#{ uri . escapeHTML } ">#{ title . escapeHTML } </a></dt>\n |
77
- ret << %Q|<dd>#{ summary } <br><a href="#{ uri . escapeHTML } ">#{ uri . escapeHTML } </a></dd>\n |
76
+ ret << %Q|<dt><a href="#{ h ( uri ) } ">#{ h ( title ) } </a></dt>\n |
77
+ ret << %Q|<dd>#{ summary } <br><a href="#{ h ( uri ) } ">#{ h ( uri ) } </a></dd>\n |
78
78
end
79
79
ret << "</dl>\n "
80
80
head + ret + format_links
0 commit comments