From e4ca4b5e3d0858d3159390ee6e8290af762cf2b9 Mon Sep 17 00:00:00 2001 From: Simon Marcellin Date: Mon, 18 Mar 2024 16:37:50 +0100 Subject: [PATCH] starting to move code server side --- ics.php | 88 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/ics.php b/ics.php index fd03a78..0c8e833 100644 --- a/ics.php +++ b/ics.php @@ -11,6 +11,51 @@ header('HTTP/1.0 401 Unauthorized'); die('

Access denied.

'); } + + /*function ics2json($input) + { + $id = 0; + $root = array(); + $curr = root; + input.split("\r\n").forEach(l => + { + var key = l.split(":")[0].split(";")[0]; + var val = l.split(":")[1]; + if (key == "BEGIN") + { + if (curr[val]) + { + val += "_" + (id++); + } + curr[val] = { + parent: curr + }; + curr = curr[val]; + } + else if (key == "END") + { + var parent = curr.parent; + delete curr.parent; + curr = parent; + } + else + { + curr[key] = key.startsWith("DT") ? dt(val) : val; + } + + }); + + root.VCALENDAR.VEVENTS = []; + Object.keys(root.VCALENDAR) + .filter(k => (k == "VEVENT" || k.startsWith("VEVENT_"))) + .forEach(k => + { + root.VCALENDAR.VEVENTS.push(root.VCALENDAR[k]); + delete root.VCALENDAR[k]; + }); + + return root.VCALENDAR; + }*/ // Get ics file $curl = curl_init(); @@ -43,50 +88,7 @@
Récupération du calendrier...