From 191484ec668a3a58cfbe890ce00a7231a3f8d7b3 Mon Sep 17 00:00:00 2001 From: TheMrNomis Date: Fri, 27 Mar 2015 17:00:57 +0100 Subject: [PATCH] dump DB to ICS now functionnal --- calendar.php | 19 +++++++++---------- calendar.php~ | 15 ++++++++++----- testdb.db | Bin 2048 -> 2048 bytes 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/calendar.php b/calendar.php index 09e3624..ed9e9a6 100644 --- a/calendar.php +++ b/calendar.php @@ -5,19 +5,14 @@ # exit; # } header('Content-type: text/calendar; charset=utf-8'); - header('Content-Disposition: inline; filename=calendar.ics'); + header('Content-Disposition: inline; filename=kiwicalendar.ics'); include("./getEvents.php"); $icalheader = "BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//hacksw/handcal//NONSGML v1.0//EN" +PRODID:KiWiCalendar v1.0//EN +"; $icalfooter = "END:VCALENDAR"; -#"BEGIN:VEVENT -#UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test -#DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z -#DTSTART:19970714T170000Z -#DTEND:19970715T035959Z -#SUMMARY:Bastille Day Party" $events = getEvents(); @@ -27,8 +22,12 @@ PRODID:-//hacksw/handcal//NONSGML v1.0//EN" { echo "BEGIN:VEVENT SUMMARY:".$event["titre"]." -"."END:VEVENT"; +DTSTART:".date("Ymd\THis",strtotime($event["dtstart"]))." +DTEND:".date("Ymd\THis",strtotime($event["dtend"]))." +LOCATION:".$event["localisation"]." +CATEGORIES:".""." +DESCRIPTION:".$event["description"]." +END:VEVENT\n"; } echo $icalfooter; - print_r($events); ?> diff --git a/calendar.php~ b/calendar.php~ index b8b7b77..ad36749 100644 --- a/calendar.php~ +++ b/calendar.php~ @@ -5,19 +5,20 @@ # exit; # } header('Content-type: text/calendar; charset=utf-8'); - header('Content-Disposition: inline; filename=calendar.ics'); + header('Content-Disposition: inline; filename=kiwicalendar.ics'); include("./getEvents.php"); $icalheader = "BEGIN:VCALENDAR VERSION:2.0 -PRODID:-//hacksw/handcal//NONSGML v1.0//EN" +PRODID:KiWiCalendar v1.0//EN +"; $icalfooter = "END:VCALENDAR"; #"BEGIN:VEVENT #UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test #DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z #DTSTART:19970714T170000Z #DTEND:19970715T035959Z -SUMMARY:Bastille Day Party" +#SUMMARY:Bastille Day Party" $events = getEvents(); @@ -27,8 +28,12 @@ SUMMARY:Bastille Day Party" { echo "BEGIN:VEVENT SUMMARY:".$event["titre"]." -"."END:VEVENT"; +DTSTART:".date("Ymd\THis",strtotime($event["dtstart"]))." +DTEND:".date("Ymd\THis",strtotime($event["dtend"]))." +LOCATION:".$event["localisation"]." +CATEGORIES:".""." +DESCRIPTION:".$event["description"]." +END:VEVENT\n"; } echo $icalfooter; - print_r($events); ?> diff --git a/testdb.db b/testdb.db index e5a2fb17a63b7450fdf4713be41215fb4fa4880c..dc6b5e1940c792c3c4ee843922b55409a3214c38 100644 GIT binary patch delta 89 zcmZn=Xb_kn&B#1a#+i|MW5N<<4kl&=2Ih&(3Y!I4M3_bMnb;Xr9gU4$gA;QLa#CH( sQu9iTCNE=G7BNvUG`BJ^03ss;LsMM?LtP`2$#>b6nG}pBPh`&r0FnU}O8@`> delta 36 scmZn=Xb_kn&B!!S#+i|6W5N<