Explorar o código

Merge pull request #1098 from Alkarex/HTTPS-enclosures

SimplePie force HTTPS for enclosures
Alexandre Alapetite %!s(int64=10) %!d(string=hai) anos
pai
achega
ee69a24a2d
Modificáronse 2 ficheiros con 3 adicións e 6 borrados
  1. 1 0
      lib/SimplePie/SimplePie/Item.php
  2. 2 6
      lib/SimplePie/SimplePie/Sanitize.php

+ 1 - 0
lib/SimplePie/SimplePie/Item.php

@@ -2877,6 +2877,7 @@ class SimplePie_Item
 					$width = null;
 
 					$url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0]));
+					$url = $this->feed->sanitize->https_url($url);	//FreshRSS
 					if (isset($enclosure[0]['attribs']['']['type']))
 					{
 						$type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);

+ 2 - 6
lib/SimplePie/SimplePie/Sanitize.php

@@ -292,10 +292,6 @@ class SimplePie_Sanitize
 		$node =& $this->https_domains;
 		foreach ($segments as $segment)
 		{//Explore the tree
-			if ($node === true)
-			{
-				return true;
-			}
 			if (isset($node[$segment]))
 			{
 				$node =& $node[$segment];
@@ -305,14 +301,14 @@ class SimplePie_Sanitize
 				break;
 			}
 		}
-		return false;
+		return $node === true;
 	}
 
 	/**
 	 * Force HTTPS for selected Web sites
 	 * FreshRSS
 	 */
-	protected function https_url($url)
+	public function https_url($url)
 	{
 		return (strtolower(substr($url, 0, 7)) === 'http://') &&
 			$this->is_https_domain(parse_url($url, PHP_URL_HOST)) ?