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 @@
-
-
+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.