#!/usr/bin/perl ################################################################### # CyberCalendar v1.8 # # Displays a vCalendar file for an event # Copyright 1999, 2000, 2001 Shawn Ewald # ################################################################### # License: # # ----------------------------------------------------------------# # This program is free software; you can redistribute it and/or # # modify it under the terms of the GNU General Public License # # as published by the Free Software Foundation; either version 2 # # of the License, or (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # ################################################################### # For the full text of the GNU General Public License, go to: # # http://www.gnu.org/copyleft/gpl.html # ################################################################### # Script Modules use vars qw($config $db $http_in $vcal); use CyberCalendar::Application; use strict; ################################################################### # Begin Script $vcal = CyberCalendar::Application->new(); $vcal->init("text/x-vcalendar"); $config = $CyberCalendar::Application::config; $db = $CyberCalendar::Application::db; $http_in = $CyberCalendar::Application::http_in; show_event(); sub show_event { my ($rows, $event) = get_event_data(); if ($rows == 0) { print "Error: Event not found.\n$!\n"; } # if else { my $cal = CyberCalendar::Calendar->new(); $event->{dateid} = $cal->vcal_date($event->{dateid}, $event->{starttime}); if ($event->{enddate} ne '0000-00-00' or $event->{enddate} != 0) { my $cal = CyberCalendar::Calendar->new(); $event->{enddate} = $cal->vcal_date($event->{enddate}, $event->{starttime}); } # if else { $event->{enddate} = $event->{dateid}; } $event->{Calendar} = $http_in->{Calendar}; $event->{DateID} = $http_in->{DateID}; $event->{Repeatid} = $http_in->{Repeatid}; my $vcfile = CyberCalendar::Util->new(); print $vcfile->vcal($config, $event); } # else } # endsub show_event sub get_event_data { my $query = qq(SELECT * from $http_in->{Calendar} WHERE dateid = ? AND repeatid = ?); $db->query($query, CyberCalendar::Application::http2dateid($http_in->{DateID}), $http_in->{Repeatid}); return ($db->rowcount, $db->result("hashref"), $db->finish); } # endsub show_event_data $vcal->my_exit;