From 0f751cbfc89dbea8d84be0e9d459636e0599c894 Mon Sep 17 00:00:00 2001 From: martin sarsale Date: Wed, 11 Jan 2017 00:06:56 -0300 Subject: [PATCH] Sets session cookie when curl is not available --- lib/utils/chart_publish.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/utils/chart_publish.php b/lib/utils/chart_publish.php index cfc7ca8eda..1ac0718f3b 100644 --- a/lib/utils/chart_publish.php +++ b/lib/utils/chart_publish.php @@ -243,11 +243,12 @@ function publish_push_to_cdn($cdn_files, $chart) { function download($url, $outf) { + $strCookie = 'DW-SESSION=' . $_COOKIE['DW-SESSION'] . '; path=/'; + if (function_exists('curl_init')) { $ch = curl_init($url); $fp = fopen($outf, 'w'); - $strCookie = 'DW-SESSION=' . $_COOKIE['DW-SESSION'] . '; path=/'; session_write_close(); curl_setopt($ch, CURLOPT_FILE, $fp); @@ -263,7 +264,7 @@ function download($url, $outf) { } else { $cfg = array( 'http' => array( - 'header' => 'Connection: close\r\n', + 'header' => "Connection: close\r\nCookie: $strCookie\r\n", 'method' => 'GET' ) );