diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index fe55987a77a..5d32d0e23ca 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -208,45 +208,43 @@ if ($rss) { } } - if ($result >= 0) { - $attachment = false; - if (GETPOSTISSET("attachment")) { - $attachment = GETPOST("attachment"); - } - //$attachment = false; - $contenttype = 'application/rss+xml'; - if (GETPOSTISSET("contenttype")) { - $contenttype = GETPOST("contenttype"); - } - //$contenttype='text/plain'; - $outputencoding = 'UTF-8'; - - if ($contenttype) { - header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); - } - if ($attachment) { - header('Content-Disposition: attachment; filename="'.$filename.'"'); - } - - // Ajout directives pour resoudre bug IE - //header('Cache-Control: Public, must-revalidate'); - //header('Pragma: public'); - if ($cachedelay) { - header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); - } else { - header('Cache-Control: private, must-revalidate'); - } - - // Clean parameters - $outputfile = $dir_temp.'/'.$filename; - $result = readfile($outputfile); - if (!$result) { - print 'File '.$outputfile.' was empty.'; - } - - // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); - exit; + $attachment = false; + if (GETPOSTISSET("attachment")) { + $attachment = GETPOST("attachment"); } + //$attachment = false; + $contenttype = 'application/rss+xml'; + if (GETPOSTISSET("contenttype")) { + $contenttype = GETPOST("contenttype"); + } + //$contenttype='text/plain'; + $outputencoding = 'UTF-8'; + + if ($contenttype) { + header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); + } + if ($attachment) { + header('Content-Disposition: attachment; filename="'.$filename.'"'); + } + + // Ajout directives pour resoudre bug IE + //header('Cache-Control: Public, must-revalidate'); + //header('Pragma: public'); + if ($cachedelay) { + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); + } else { + header('Cache-Control: private, must-revalidate'); + } + + // Clean parameters + $outputfile = $dir_temp.'/'.$filename; + $result = readfile($outputfile); + if (!$result) { + print 'File '.$outputfile.' was empty.'; + } + + // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); + exit; } elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file)) { // Get logos readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file));