diff --git a/htdocs/webcal/webcalexport.php b/htdocs/webcal/webcalexport.php
index cfbab3a00d5..05240bb95fc 100644
--- a/htdocs/webcal/webcalexport.php
+++ b/htdocs/webcal/webcalexport.php
@@ -28,13 +28,16 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require("../master.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/webcal/webcal.class.php');
-
// C'est un wrapper, donc header vierge
function llxHeader() { print '
Export cal'; }
function llxFooter() { print ''; }
+// Security check
+if (! $conf->webcal->enabled)
+ accessforbidden();
+
// Check config
-if (! $conf->webcal->enabled && empty($conf->global->PHPWEBCALENDAR_URL))
+if (empty($conf->global->PHPWEBCALENDAR_URL))
{
$user->getrights();
@@ -99,7 +102,7 @@ if ($result >= 0)
{
$attachment = false;
$encoding='UTF-8';
- $type='text/plain';
+ $type='text/calendar';
//$type='text/calendar';
if ($encoding) header('Content-Encoding: '.$encoding);