From e5fc1583c7b89b19a603d7a04a1bc08742f523ba Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 10 Mar 2017 12:05:42 +0100
Subject: [PATCH] Fix No external access without using getUrlContent function.

---
 htdocs/core/tpl/login.tpl.php | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index ba501e802dd..e0aa28ce2d6 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -239,16 +239,21 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
 	</div></div>
 <?php
 }
+
+// Add commit strip
 if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
+    include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
 	if (substr($langs->defaultlang,0,2)=='fr') {
-		$xml = simplexml_load_file("http://www.commitstrip.com/fr/feed/");
+		$resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/");
 	} else {
-		$xml = simplexml_load_file("http://www.commitstrip.com/en/feed/");
+		$resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/");
 	}
-
-    $little = $xml->channel->item[0]->children('content',true);
-
-    print $little->encoded;
+    if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') 
+    {
+        $xml = simplexml_load_string($resgetcommitstrip['content']);
+        $little = $xml->channel->item[0]->children('content',true);
+        print $little->encoded;
+    }
 }
 
 ?>
-- 
GitLab