From 58b3bfa487a64098ea4ff70be5924b854c547802 Mon Sep 17 00:00:00 2001 From: Simon Marcellin Date: Mon, 18 Mar 2024 11:07:49 +0100 Subject: [PATCH] porting code to server side (in progress) --- .htaccess | 4 +++ ics.php | 64 ++++++++++++++++++++++++----------------- settings.php.sample.php | 1 + 3 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 .htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..53cac3b --- /dev/null +++ b/.htaccess @@ -0,0 +1,4 @@ + +RewriteEngine on +RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] + \ No newline at end of file diff --git a/ics.php b/ics.php index 5b930aa..fd03a78 100644 --- a/ics.php +++ b/ics.php @@ -1,32 +1,46 @@ - -
Evénements à venir
+Access denied.

'); + } + + // Get ics file + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_USERPWD, $user . ':' . $password); + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + $result = curl_exec($curl); + + if (!$result) + { + die('

Error while getting ics file from caldav server.

'); + } + curl_close($curl); + + // port "showresult" js function: + $recent = 7; + if (isset($_GET['recent'])) + { + $recent = $_GET['recent']; + } + $recentonly = isset($_GET['recentonly']); + + echo '

Evénements à venir

'; + +?> + + + +
Récupération du calendrier...
- - diff --git a/settings.php.sample.php b/settings.php.sample.php index 3de1331..564c3d6 100644 --- a/settings.php.sample.php +++ b/settings.php.sample.php @@ -1,4 +1,5 @@