From 14026aa8f981e6118f7c00f9128850ede63aa92b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 3 Jul 2013 07:48:06 -0700 Subject: [PATCH] CRM-12783 - CRM_Dashlet_Page_Blog - Get content via HTTPS Note: I did a simulation with enable_ssl=false, and it degraded well. ---------------------------------------- * CRM-12783: As of 4.3, civicrm pulls in content by default from non-authenticated web site (http instead of https) http://issues.civicrm.org/jira/browse/CRM-12783 --- CRM/Dashlet/Page/Blog.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/CRM/Dashlet/Page/Blog.php b/CRM/Dashlet/Page/Blog.php index c9007db2ec..7be04dd734 100644 --- a/CRM/Dashlet/Page/Blog.php +++ b/CRM/Dashlet/Page/Blog.php @@ -38,7 +38,9 @@ */ class CRM_Dashlet_Page_Blog extends CRM_Core_Page { - const CHECK_TIMEOUT = 5, CACHE_DAYS = 1; + const CHECK_TIMEOUT = 5; + const CACHE_DAYS = 1; + const BLOG_URL = 'https://civicrm.org/blog/feed'; /** * List blog articles as dashlet @@ -85,14 +87,18 @@ class CRM_Dashlet_Page_Blog extends CRM_Core_Page { /** * Parse rss feed and cache results * - * @return array + * @return array|NULL array of blog items; or NULL if not available * * @access private */ private function _getFeed() { - ini_set('default_socket_timeout', self::CHECK_TIMEOUT); - $feed = @simplexml_load_file('http://civicrm.org/blog/feed'); - ini_restore('default_socket_timeout'); + $httpClient = new CRM_Utils_HttpClient(self::CHECK_TIMEOUT); + list ($status, $rawFeed) = $httpClient->get(self::BLOG_URL); + if ($status !== CRM_Utils_HttpClient::STATUS_OK) { + return NULL; + } + $feed = @simplexml_load_string($rawFeed); + $blog = array(); if ($feed && !empty($feed->channel->item)) { foreach ($feed->channel->item as $item) { -- 2.25.1