From 13e64d2f79df129e8fad1749c51e91f9e710fbe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Aug 2021 19:46:37 +0200 Subject: [PATCH] Fix replace file_get_contents with getURLContent --- htdocs/blockedlog/ajax/check_signature.php | 19 ++++++++++++------- htdocs/core/class/google.class.php | 6 ++++-- htdocs/printing/index.php | 3 ++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/blockedlog/ajax/check_signature.php b/htdocs/blockedlog/ajax/check_signature.php index ba164e3e715..4d59b56a981 100644 --- a/htdocs/blockedlog/ajax/check_signature.php +++ b/htdocs/blockedlog/ajax/check_signature.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/blockedlog/ajax/block-info.php + * \file htdocs/blockedlog/ajax/check_signature.php * \ingroup blockedlog - * \brief block-info + * \brief This page is not used yet. */ @@ -38,13 +38,15 @@ if (!defined('NOREQUIREHTML')) { require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; +require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; + if (empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { exit('BLOCKEDLOG_AUTHORITY_URL not set'); } -require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; -require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; $auth = new BlockedLogAuthority($db); $auth->syncSignatureWithAuthority(); @@ -63,8 +65,11 @@ if (is_array($bocks)) { $hash = $auth->getBlockchainHash(); -$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$auth->signature.'&h='.$hash; +// Call external authority +$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.urlencode($auth->signature).'&h='.urlencode($hash); + +$resarray = getURLContent($url, 'GET', '', 1, array(), array(), 2); +$res = $resarray['content']; -$res = file_get_contents($url); //echo $url; -echo $res; +echo dol_escape_htmltag($res); diff --git a/htdocs/core/class/google.class.php b/htdocs/core/class/google.class.php index ee122ff7cb5..4a91d548122 100644 --- a/htdocs/core/class/google.class.php +++ b/htdocs/core/class/google.class.php @@ -66,10 +66,12 @@ class GoogleAPI $i = 0; // Desired address - $urladdress = "https://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".$this->key; + $urladdress = "https://maps.google.com/maps/geo?q=".urlencode($address)."&output=xml&key=".urlencode($this->key); // Retrieve the URL contents - $page = file_get_contents($urladdress); + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $pagearray = getURLContent($urladdress, 'GET'); + $page = $pagearray['content']; $code = strstr($page, ''); $code = strstr($code, '>'); diff --git a/htdocs/printing/index.php b/htdocs/printing/index.php index 84132c784f4..2d20db4ddf7 100644 --- a/htdocs/printing/index.php +++ b/htdocs/printing/index.php @@ -58,7 +58,8 @@ foreach ($result as $driver) { $classname = 'printing_'.$driver; $langs->load($driver); $printer = new $classname($db); - if ($conf->global->{$printer->active}) { + $keyforprinteractive = $printer->active; + if ($keyforprinteractive && $conf->global->$keyforprinteractive) { //$printer->listJobs('commande'); $result = $printer->listJobs(); print $printer->resprint;