contrib modules security updates
This commit is contained in:
@@ -19,12 +19,7 @@
|
||||
* stdClass The structured datas extracted from the feed.
|
||||
*/
|
||||
function common_syndication_parser_parse($string) {
|
||||
if (!defined('LIBXML_VERSION') || (version_compare(phpversion(), '5.1.0', '<'))) {
|
||||
@ $xml = simplexml_load_string($string, NULL);
|
||||
}
|
||||
else {
|
||||
@ $xml = simplexml_load_string($string, NULL, LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NOCDATA);
|
||||
}
|
||||
@ $xml = simplexml_load_string($string, NULL, LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_NOCDATA);
|
||||
|
||||
// Got a malformed XML.
|
||||
if ($xml === FALSE || is_null($xml)) {
|
||||
@@ -43,18 +38,6 @@ function common_syndication_parser_parse($string) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cached version of the <var>$url</var>
|
||||
*/
|
||||
function _parser_common_syndication_cache_get($url) {
|
||||
$cache_file = _parser_common_syndication_sanitize_cache() . '/' . md5($url);
|
||||
if (file_exists($cache_file)) {
|
||||
$file_content = file_get_contents($cache_file);
|
||||
return unserialize($file_content);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the feed format of a SimpleXML parsed object structure.
|
||||
*
|
||||
@@ -182,16 +165,14 @@ function _parser_common_syndication_atom10_parse($feed_XML) {
|
||||
}
|
||||
}
|
||||
|
||||
$author_found = FALSE;
|
||||
$original_author = '';
|
||||
if (!empty($news->source->author->name)) {
|
||||
$original_author = "{$news->source->author->name}";
|
||||
$author_found = TRUE;
|
||||
}
|
||||
elseif (!empty($news->author->name)) {
|
||||
$original_author = "{$news->author->name}";
|
||||
$author_found = TRUE;
|
||||
}
|
||||
if (!empty($feed_XML->author->name) && !$author_found) {
|
||||
elseif (!empty($feed_XML->author->name)) {
|
||||
$original_author = "{$feed_XML->author->name}";
|
||||
}
|
||||
|
||||
@@ -262,9 +243,8 @@ function _parser_common_syndication_RDF10_parse($feed_XML) {
|
||||
'rss' => 'http://purl.org/rss/1.0/',
|
||||
);
|
||||
|
||||
// Get all namespaces declared in the feed element, with special handling
|
||||
// for PHP versions prior to 5.1.2 as they don't handle namespaces.
|
||||
$namespaces = version_compare(phpversion(), '5.1.2', '<') ? array() : $feed_XML->getNamespaces(TRUE);
|
||||
// Get all namespaces declared in the feed element.
|
||||
$namespaces = $feed_XML->getNamespaces(TRUE);
|
||||
|
||||
// Process the <rss:channel> resource containing feed metadata:
|
||||
foreach ($feed_XML->children($canonical_namespaces['rss'])->channel as $rss_channel) {
|
||||
@@ -379,11 +359,9 @@ function _parser_common_syndication_RSS20_parse($feed_XML) {
|
||||
|
||||
$category = $news->xpath('category');
|
||||
// Get children for current namespace.
|
||||
if (version_compare(phpversion(), '5.1.2', '>')) {
|
||||
$content = (array)$news->children($ns["content"]);
|
||||
$dc = (array)$news->children($ns["dc"]);
|
||||
$georss = (array)$news->children($ns["georss"]);
|
||||
}
|
||||
$content = (array)$news->children($ns["content"]);
|
||||
$dc = (array)$news->children($ns["dc"]);
|
||||
$georss = (array)$news->children($ns["georss"]);
|
||||
$news = (array) $news;
|
||||
$news['category'] = $category;
|
||||
|
||||
@@ -505,12 +483,25 @@ function _parser_common_syndication_RSS20_parse($feed_XML) {
|
||||
*/
|
||||
function _parser_common_syndication_parse_date($date_str) {
|
||||
// PHP < 5.3 doesn't like the GMT- notation for parsing timezones.
|
||||
$date_str = str_replace("GMT-", "-", $date_str);
|
||||
$date_str = str_replace("GMT+", "+", $date_str);
|
||||
$date_str = str_replace('GMT-', '-', $date_str);
|
||||
$date_str = str_replace('GMT+', '+', $date_str);
|
||||
$parsed_date = strtotime($date_str);
|
||||
|
||||
if ($parsed_date === FALSE || $parsed_date == -1) {
|
||||
$parsed_date = _parser_common_syndication_parse_w3cdtf($date_str);
|
||||
}
|
||||
|
||||
if (($parsed_date === FALSE || $parsed_date == -1)) {
|
||||
// PHP does not support the UT timezone. Fake it. The system that generated
|
||||
// this, Google Groups, probably meant UTC.
|
||||
$date_str = strtolower(trim($date_str));
|
||||
$last_three = substr($date_str, strlen($date_str) - 3, 3);
|
||||
|
||||
if ($last_three == ' ut') {
|
||||
$parsed_date = strtotime($date_str . 'c');
|
||||
}
|
||||
}
|
||||
|
||||
return $parsed_date === FALSE ? time() : $parsed_date;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user