Skip to content

Commit

Permalink
Sets session cookie when curl is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
martin sarsale committed Jan 11, 2017
1 parent 2515efb commit 0f751cb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/utils/chart_publish.php
Expand Up @@ -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);
Expand All @@ -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'
)
);
Expand Down

0 comments on commit 0f751cb

Please sign in to comment.