From 909409b5efbc5b14eca29d1fef5f8dc1152e25b4 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 8 Mar 2007 08:13:11 +0000 Subject: [PATCH] Merged fix for rss enclosure notices from 1.8 --- lib/rsslib.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/rsslib.php b/lib/rsslib.php index b530dbb8a7..37406ef65b 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -557,7 +557,12 @@ function rss_add_enclosures($item){ // take into account attachments (e.g. from forum) - with these, we are able to know the file size if (isset($item->attachments) && is_array($item->attachments)) { foreach ($item->attachments as $attachment){ - $type = $mediafiletypes[substr($attachment->url, strrpos($attachment->url, '.')+1)]['type']; + $extension = strtolower(substr($attachment->url, strrpos($attachment->url, '.')+1)); + if (isset($mediafiletypes[$extension]['type'])) { + $type = $mediafiletypes[$extension]['type']; + } else { + $type = 'document/unknown'; + } $returnstring .= "\nurl\" length=\"$attachment->length\" type=\"$type\" />\n"; } } @@ -569,7 +574,12 @@ function rss_add_enclosures($item){ // loop over matches of regular expression for ($i = 0; $i < count($matches[2]); $i++){ $url = htmlspecialchars($matches[2][$i]); - $type = $mediafiletypes[strtolower($matches[3][$i])]['type']; + $extension = strtolower($matches[3][$i]); + if (isset($mediafiletypes[$extension]['type'])) { + $type = $mediafiletypes[$extension]['type']; + } else { + $type = 'document/unknown'; + } // the rss_*_tag functions can't deal with methods, unfortunately $returnstring .= "\n\n"; -- 2.39.5