178 |
|
|
179 |
#----------------------------------SUBROUTINES------------------------- |
#----------------------------------SUBROUTINES------------------------- |
180 |
|
|
181 |
|
# Decode quoted strings (in From: and Subject) |
182 |
|
|
183 |
|
sub DecodeQuoted { |
184 |
|
my $tmp = $_[0]; |
185 |
|
if ($tmp =~ /=?ISO-8859-[1-2]?(.)?/i) { |
186 |
|
$tmp =~ s/=([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
187 |
|
$tmp =~ s/=\?ISO-8859-[1-2]\?.\?(.*)\?=/$1/i; |
188 |
|
} |
189 |
|
return $tmp; |
190 |
|
} |
191 |
|
|
192 |
#-----------------------------Sub ParseHeaders----------------------------- |
#-----------------------------Sub ParseHeaders----------------------------- |
193 |
#Subroutine to parse the headers on each message to exctract the TO:, FROM:, |
#Subroutine to parse the headers on each message to exctract the TO:, FROM:, |
238 |
#of each line |
#of each line |
239 |
if (/^From:/ ){ |
if (/^From:/ ){ |
240 |
$from = $'; #Get string following the succesful match. |
$from = $'; #Get string following the succesful match. |
241 |
|
$from = DecodeQuoted($from); |
242 |
$from =~ s/</<\;/; #Strip out angled brackets to prevent browsers |
$from =~ s/</<\;/; #Strip out angled brackets to prevent browsers |
243 |
$from =~ s/>/>\;/; #from interpreting them as unknown HTML codes. |
$from =~ s/>/>\;/; #from interpreting them as unknown HTML codes. |
244 |
} |
} |
247 |
} |
} |
248 |
elsif (/^Subject:/) { |
elsif (/^Subject:/) { |
249 |
$sub = $'; |
$sub = $'; |
250 |
|
$sub = DecodeQuoted($sub); |
251 |
} |
} |
252 |
elsif (/^Date:/) { |
elsif (/^Date:/) { |
253 |
$date = $'; |
$date = $'; |
254 |
} |
} |
255 |
} |
} |
256 |
$date=~ s/.*\,(.*)\+.*/$1/; |
$date=~ s/.*\,(.*)\+.*/$1/; |
257 |
|
$date="<small>$date</small>"; |
258 |
print "<td><a href='.' OnClick='document.lire$i.submit();return false;'>$from </a></td><td><b>$sub </b></td><td>$date </td>"; |
print "<td><a href='.' OnClick='document.lire$i.submit();return false;'>$from </a></td><td><b>$sub </b></td><td>$date </td>"; |
259 |
|
|
260 |
#for each message header, also provide a FORM button to |
#for each message header, also provide a FORM button to |