115 |
# Search terms - if any. |
# Search terms - if any. |
116 |
my $terms = $ARGUMENTS{ "q" }; |
my $terms = $ARGUMENTS{ "q" }; |
117 |
|
|
118 |
|
|
119 |
|
# |
120 |
|
# Remove XSS attacks |
121 |
|
# |
122 |
|
if ( defined( $terms ) && length( $terms ) ) |
123 |
|
{ |
124 |
|
$terms =~ s/</</g; |
125 |
|
$terms =~ s/>/>/g; |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
# |
# |
130 |
# The mode will be either 'any' or 'all' |
# The mode will be either 'any' or 'all' |
131 |
# |
# |
138 |
$mode = "any"; |
$mode = "any"; |
139 |
} |
} |
140 |
|
|
|
print "Search mode '$mode'\n"; |
|
141 |
|
|
142 |
# |
# |
143 |
# Now do the searching for real. |
# Now do the searching for real. |
158 |
$match = 1; |
$match = 1; |
159 |
foreach my $term ( split( ' ', $terms ) ) |
foreach my $term ( split( ' ', $terms ) ) |
160 |
{ |
{ |
|
print "Testing individual term '$term'\n"; |
|
161 |
# If the line doesn't contain a match for this term |
# If the line doesn't contain a match for this term |
162 |
# we've failed |
# we've failed |
163 |
if ( ! ( $line =~ /$term/i ) ) |
if ( ! ( $line =~ /$term/i ) ) |
171 |
# Searching for any term. |
# Searching for any term. |
172 |
foreach my $term ( split( ' ', $terms ) ) |
foreach my $term ( split( ' ', $terms ) ) |
173 |
{ |
{ |
|
print "Testing individual term '$term'\n"; |
|
174 |
if ( $line =~ /$term/i ) |
if ( $line =~ /$term/i ) |
175 |
{ |
{ |
176 |
$match ++; |
$match ++; |
262 |
# Display format for the results. |
# Display format for the results. |
263 |
my $format = &getConfig( "plugin_search_song_format", |
my $format = &getConfig( "plugin_search_song_format", |
264 |
'$ARTIST - $SONGNAME' ); |
'$ARTIST - $SONGNAME' ); |
265 |
|
$tagCache->setSongFormat( $format ); |
266 |
|
|
267 |
# |
# |
268 |
# Display the results. |
# Display the results. |