RFE [ 747859 ] RSS Encoding

This commit is contained in:
Len Kranendonk 2004-08-19 08:13:25 +00:00
parent cd88107597
commit 3c338de79f
2 changed files with 31 additions and 12 deletions

View file

@ -15,8 +15,8 @@
- Added AOIRank and AOIHits macro's to retrieve user's Area's Of Interest - Added AOIRank and AOIHits macro's to retrieve user's Area's Of Interest
statistics. (Thanks to DonorWare for funding this feature.) statistics. (Thanks to DonorWare for funding this feature.)
- Fixed a typo in Forum/UI.pm - Fixed a typo in Forum/UI.pm
- bugfix [ 996284 ] Compile error in macro.pm - bugfix [ 996284 ] Compile error in macro.pm (Len Kranendonk)
- bugfix [ 997918 ] Default value in profile not working - bugfix [ 997918 ] Default value in profile not working (Len Kranendonk)
- bugfix [ 997916 ] Bug and solution in File.pm - bugfix [ 997916 ] Bug and solution in File.pm
- Added the page.isMyAncestor condition to the Navigation system. (Thanks to - Added the page.isMyAncestor condition to the Navigation system. (Thanks to
Len Kranendonk) Len Kranendonk)
@ -30,15 +30,18 @@
default page of your virtual host. default page of your virtual host.
- passing form param disableWobjects=$call shortcircuits most of - passing form param disableWobjects=$call shortcircuits most of
WebGUI::Wobject::WSClient::www_view() WebGUI::Wobject::WSClient::www_view()
- Added write permission checks to WebGUI::Template. - Added write permission checks to WebGUI::Template. (Len Kranendonk)
- Added Export Page functionality. - Added Export Page functionality.
- bugfix: Loginbox didn't support encrypt login. - bugfix: Loginbox didn't support encrypt login. (Len Kranendonk)
- Bugfix: [ 1000205 ] Password Recovery Doesn't Work - Bugfix: [ 1000205 ] Password Recovery Doesn't Work (Len Kranendonk)
- Bugfix: [ 1003594 ] Fixed Navigation Cacheing bug - Bugfix: [ 1003594 ] Fixed Navigation Cacheing bug (OpenTech / Len Kranendonk)
- Bugfix: [ 1000299 ] laodAllConfigs should be loadAllConfigs? - Bugfix: [ 1000299 ] laodAllConfigs should be loadAllConfigs? (Len
- Bugfix: [ 995088 ] Error in printable macro 6.1.1 Kranendonk)
- Bugfix: [ 995088 ] Error in printable macro 6.1.1 (Len Kranendonk)
- Bugfix: [ 1003511 ] Users cannot be added to Registered Users if removed - Bugfix: [ 1003511 ] Users cannot be added to Registered Users if removed
(Len Kranendonk)
- Bugfix: [ 996592 ] Fixed Infinite loop in Page.pm makeUnique in 6.1.1 - Bugfix: [ 996592 ] Fixed Infinite loop in Page.pm makeUnique in 6.1.1
(OpenTech / Len Kranendonk)
- Converted all IDs to use global unique ids rather than incremented ids as - Converted all IDs to use global unique ids rather than incremented ids as
they were in the past. they were in the past.
- BugFix: [ 999799 ] Fixed Package deletion/copy bug in 6.1.1 - BugFix: [ 999799 ] Fixed Package deletion/copy bug in 6.1.1
@ -58,6 +61,7 @@
- RFE [ 806332 ] Force SSL, a new page property "Encrypt page" is added. (Len - RFE [ 806332 ] Force SSL, a new page property "Encrypt page" is added. (Len
Kranendonk) Kranendonk)
- RFE [ 1004098 ] Additional navigation Template Parameters added. (Martin Kamerbeek / Procolix, code thanks to Opentech) - RFE [ 1004098 ] Additional navigation Template Parameters added. (Martin Kamerbeek / Procolix, code thanks to Opentech)
- RFE [ 747859 ] RSS Encoding (Len Kranendonk) NB: Needs perl 5.8.0 or up.
6.1.1 6.1.1
- bugfix [ 991313 ] Manage Translations doesn't work - bugfix [ 991313 ] Manage Translations doesn't work

View file

@ -25,6 +25,7 @@ use WebGUI::Session;
use WebGUI::Wobject; use WebGUI::Wobject;
use XML::RSSLite; use XML::RSSLite;
use LWP::UserAgent; use LWP::UserAgent;
use WebGUI::ErrorHandler;
our @ISA = qw(WebGUI::Wobject); our @ISA = qw(WebGUI::Wobject);
@ -182,11 +183,25 @@ sub _get_rss_data {
my $ua = LWP::UserAgent->new(timeout => 5); my $ua = LWP::UserAgent->new(timeout => 5);
my $response = $ua->get($url); my $response = $ua->get($url);
if (!$response->is_success()) { if (!$response->is_success()) {
warn("Error retrieving url '$url': " . WebGUI::ErrorHandler::warn("Error retrieving url '$url': " .
$response->status_line()); $response->status_line());
return undef; return undef;
} }
my $xml = $response->content(); my $xml = $response->content();
# Convert encoding if needed / Perl 5.8.0 or up required.
if ($] >= 5.008) {
$xml =~ /<\?xml.*?encoding=['"](\S+)['"]/i;
my $xmlEncoding = $1;
my $encoding = WebGUI::International::getLanguage($session{user}{language},"charset");
if (lc($xmlEncoding) ne lc($encoding)) {
use Encode qw(from_to);
eval { from_to($xml, $xmlEncoding, $encoding) };
WebGUI::ErrorHandler::warn($@) if ($@);
}
}
# there is no encode_entities_numeric that I can find, so I am # there is no encode_entities_numeric that I can find, so I am
# commenting this out. -hal # commenting this out. -hal
@ -198,7 +213,7 @@ sub _get_rss_data {
XML::RSSLite::parseXML($rss_lite, \$xml); XML::RSSLite::parseXML($rss_lite, \$xml);
}; };
if ($@) { if ($@) {
warn("error parsing rss for url $url"); WebGUI::ErrorHandler::warn("error parsing rss for url $url");
} }
# make sure that the {channel} points to the channel # make sure that the {channel} points to the channel
@ -209,10 +224,10 @@ sub _get_rss_data {
$rss_lite = {channel => $rss_lite}; $rss_lite = {channel => $rss_lite};
if (!($rss->{channel} = if (!($rss->{channel} =
_find_record($rss_lite, qr/^channel$/))) { _find_record($rss_lite, qr/^channel$/))) {
warn("unable to find channel info for url $url"); WebGUI::ErrorHandler::warn("unable to find channel info for url $url");
} }
if (!($rss->{items} = _find_record($rss_lite, qr/^items?$/))) { if (!($rss->{items} = _find_record($rss_lite, qr/^items?$/))) {
warn("unable to find item info for url $url"); WebGUI::ErrorHandler::warn("unable to find item info for url $url");
$rss->{items} = []; $rss->{items} = [];
} }